public static Item GetSource(IStoreItem destination, CommonFixture commonFixture) { Item predecessor = null; if (destination.Predecessor != null) { predecessor = GetSource(destination.Predecessor, commonFixture); } var availabilities = destination.Availabilities .Select(av => StoreItemAvailabilityConverterTests.GetSource(av)) .ToList(); return(new Item { Id = destination.Id.Value, Name = destination.Name, Deleted = destination.IsDeleted, Comment = destination.Comment, IsTemporary = destination.IsTemporary, QuantityType = destination.QuantityType.ToInt(), QuantityInPacket = destination.QuantityInPacket, QuantityTypeInPacket = destination.QuantityTypeInPacket.ToInt(), ItemCategoryId = destination.ItemCategoryId?.Value, ManufacturerId = destination.ManufacturerId?.Value, PredecessorId = predecessor?.Id, Predecessor = predecessor, AvailableAt = availabilities, CreatedFrom = destination.TemporaryId?.Value }); }
public static void AddDependencies(IServiceCollection serviceCollection) { serviceCollection.AddInstancesOfGenericType(typeof(StoreItemConverter).Assembly, typeof(IToDomainConverter <,>)); serviceCollection.AddInstancesOfNonGenericType(typeof(IStoreItemFactory).Assembly, typeof(IStoreItemFactory)); StoreItemAvailabilityConverterTests.AddDependencies(serviceCollection); ManufacturerConverterTests.AddDependencies(serviceCollection); ItemCategoryConverterTests.AddDependencies(serviceCollection); }