public void Modify_WithValidData_ShouldModifyItem() { // Arrange Fixture fixture = commonFixture.GetNewFixture(); var isTemporary = commonFixture.NextBool(); var definition = StoreItemDefinition.FromTemporary(isTemporary); IStoreItem storeItem = storeItemFixture.CreateValid(definition); ItemModify itemModify = fixture.Create <ItemModify>(); IEnumerable <IStoreItemAvailability> availabilities = storeItemAvailabilityFixture.CreateManyValid().ToList(); // Act storeItem.Modify(itemModify, availabilities); // Assert using (new AssertionScope()) { storeItem.Name.Should().Be(itemModify.Name); storeItem.Comment.Should().Be(itemModify.Comment); storeItem.QuantityType.Should().Be(itemModify.QuantityType); storeItem.QuantityInPacket.Should().Be(itemModify.QuantityInPacket); storeItem.QuantityTypeInPacket.Should().Be(itemModify.QuantityTypeInPacket); storeItem.Availabilities.Should().BeEquivalentTo(availabilities); storeItem.ItemCategoryId.Should().Be(itemModify.ItemCategoryId); storeItem.ManufacturerId.Should().Be(itemModify.ManufacturerId); storeItem.IsTemporary.Should().Be(isTemporary); } }
public void Modify(ItemModify itemChange, IEnumerable <IStoreItemAvailability> availabilities) { Name = itemChange.Name; Comment = itemChange.Comment; QuantityType = itemChange.QuantityType; QuantityInPacket = itemChange.QuantityInPacket; QuantityTypeInPacket = itemChange.QuantityTypeInPacket; ItemCategoryId = itemChange.ItemCategoryId; ManufacturerId = itemChange.ManufacturerId; this.availabilities = availabilities.ToList(); }