public IEnumerable <IStoreSection> CreateMany(StoreSectionDefinition definition, int amount)
        {
            var definitions = new List <StoreSectionDefinition>();

            for (int i = 0; i < amount; i++)
            {
                definitions.Add(definition.Clone());
            }

            return(Create(definitions));
        }
        // todo: outsource this to StoreSectionFixture
        private IEnumerable <IStoreSection> CreateValidSections(int sectionAmount)
        {
            List <IStoreSection> sections = storeSectionFixture
                                            .CreateMany(StoreSectionDefinition.FromIsDefaultSection(false), sectionAmount - 1)
                                            .ToList();
            IEnumerable <int> otherSectionIds = sections.Select(s => s.Id.Value);

            int defaultSectionId         = commonFixture.NextUniqueInts(1, otherSectionIds).First();
            var defaultSectionDefinition = new StoreSectionDefinition()
            {
                Id = new SectionId(defaultSectionId),
                IsDefaultSection = true
            };
            IStoreSection defaultSection = storeSectionFixture.Create(defaultSectionDefinition);

            sections.Add(defaultSection);
            sections.Shuffle();

            return(sections);
        }
        public IStoreSection Create(StoreSectionDefinition definition)
        {
            var fixture = commonFixture.GetNewFixture();

            if (definition.Id != null)
            {
                fixture.ConstructorArgumentFor <StoreSection, SectionId>("id", definition.Id);
            }
            if (definition.Name != null)
            {
                fixture.ConstructorArgumentFor <StoreSection, string>("name", definition.Name);
            }
            if (definition.SortingIndex != null)
            {
                fixture.ConstructorArgumentFor <StoreSection, int>("sortingIndex", definition.SortingIndex.Value);
            }
            if (definition.IsDefaultSection != null)
            {
                fixture.ConstructorArgumentFor <StoreSection, bool>("isDefaultSection", definition.IsDefaultSection.Value);
            }

            return(fixture.Create <StoreSection>());
        }