public void AddSection_WithNewSection_ShouldThrowDomainException() { IShoppingList shoppingList = shoppingListFixture.CreateValid(); var existingSectionIds = shoppingList.Sections.Select(s => s.Id.Value); var sectionDef = ShoppingListSectionDefinition.FromId(commonFixture.NextInt(existingSectionIds)); IShoppingListSection section = shoppingListSectionFixture.CreateValid(sectionDef); // Act shoppingList.AddSection(section); // Assert using (new AssertionScope()) { shoppingList.Sections.Should().Contain(section); } }
private IShoppingList GetShoppingListContainingOneItem(StoreId storeId, SectionId sectionId) { var sectionDef = new ShoppingListSectionDefinition { Id = sectionId, Items = shoppingListItemFixture.AsModelFixture().CreateValid().ToMonoList(), }; var section = shoppingListSectionFixture.CreateValid(sectionDef); var listDef = new ShoppingListDefinition { StoreId = storeId, Sections = section.ToMonoList() }; return(shoppingListFixture.CreateValid(listDef)); }
public IShoppingListSection CreateSection(SectionId sectionId) { var sectionDef = ShoppingListSectionDefinition.FromId(sectionId); return(ShoppingListSectionFixture.CreateValid(sectionDef)); }