< Summary

Class:WinSolutions.Sveta.Server.Utils.DataUtils
Assembly:WinSolutions.Sveta.Server
File(s):/opt/dev/sveta_api_build/WinSolutions.Sveta.Server/Utils/DataUtils.cs
Covered lines:0
Uncovered lines:15
Coverable lines:15
Total lines:32
Line coverage:0% (0 of 15)
Covered branches:0
Total branches:14
Branch coverage:0% (0 of 14)

Metrics

MethodLine coverage Branch coverage
CopyTo(...)0%0%

File(s)

/opt/dev/sveta_api_build/WinSolutions.Sveta.Server/Utils/DataUtils.cs

#LineLine coverage
 1using System;
 2using System.Collections.Generic;
 3using System.Linq;
 4using System.Text;
 5
 6namespace WinSolutions.Sveta.Server.Utils
 7{
 8    class DataUtils
 9    {
 10        public static void CopyTo(object src, object dst)
 011        {
 12
 013            var srcType = src.GetType();
 014            foreach (var fi in dst.GetType().GetFields().Where(p=>p.IsPublic))
 015            {
 016                var rfi = srcType.GetField(fi.Name);
 17
 018                if(rfi != null)
 019                    rfi.SetValue(dst,fi.GetValue(src));
 020            }
 21
 022            foreach (var pi in dst.GetType().GetProperties().Where(p=>p.CanWrite && p.CanRead))
 023            {
 024                var rpi = srcType.GetProperty(pi.Name);
 25
 26
 027                if(rpi != null)
 028                    rpi.SetValue(dst,pi.GetValue(src,null),null);
 029            }
 030        }
 31    }
 32}

Methods/Properties

CopyTo(...)