Exemple #1
0
        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);
            }
        }
            public IShoppingListSection CreateSection(SectionId sectionId)
            {
                var sectionDef = ShoppingListSectionDefinition.FromId(sectionId);

                return(ShoppingListSectionFixture.CreateValid(sectionDef));
            }