public static CpuNodeModel ToModel(this CpuNodeDto cpuNodeDto) { if (cpuNodeDto == null) { throw new ArgumentNullException(nameof(cpuNodeDto)); } return(new CpuNodeModel { Name = cpuNodeDto.Name, Value = cpuNodeDto.Value, NodeType = cpuNodeDto.NodeType, OsIndex = cpuNodeDto.OsIndex, Children = cpuNodeDto.Children?.Select(c => c.ToModel()).ToList() ?? new List <CpuNodeModel>(), MemoryChildren = cpuNodeDto.MemoryChildren?.Select(c => c.ToModel()).ToList() ?? new List <CpuNodeModel>() }); }
public static void AssertTopology(CpuNodeModel model, CpuNodeDto dto) { Assert.AreEqual(model.Name, dto.Name); Assert.AreEqual(model.Value, dto.Value); Assert.AreEqual(model.NodeType, dto.NodeType); Assert.AreEqual(model.OsIndex, dto.OsIndex); AssertCollectionsAreEqual(model.MemoryChildren, dto.MemoryChildren, (a, b) => { AssertTopology(a, b); return(true); }); AssertCollectionsAreEqual(model.Children, dto.Children, (a, b) => { AssertTopology(a, b); return(true); }); }