public IStore CreateValid(StoreDefinition baseDefinition)
        {
            baseDefinition.Sections ??= CreateValidSections(3).ToList();
            baseDefinition.IsDeleted ??= false;

            return(Create(baseDefinition));
        }
        public IStore CreateValid(StoreDefinition baseDefinition, int sectionAmount)
        {
            List <IStoreSection> sections = CreateValidSections(sectionAmount).ToList();

            baseDefinition.Sections ??= sections;
            baseDefinition.IsDeleted ??= false;

            return(Create(baseDefinition));
        }
        public IEnumerable <IStore> CreateManyValid(IEnumerable <StoreDefinition> definitions)
        {
            var definitionsList = definitions.ToList();

            var uniqueStoreIds = commonFixture.NextUniqueInts(definitionsList.Count).ToList();

            for (int i = 0; i < definitionsList.Count; i++)
            {
                StoreDefinition definition = definitionsList[i];
                definition.Id ??= new StoreId(uniqueStoreIds[i]);
                yield return(CreateValid(definition));
            }
        }
        public IEnumerable <IStore> CreateManyValid(StoreDefinition baseDefinition, int count = 3)
        {
            if (count <= 0)
            {
                throw new ArgumentException($"{nameof(count)} must be greater than 0.");
            }

            var uniqueStoreIds = commonFixture.NextUniqueInts(count);

            foreach (int uniqueStoreId in uniqueStoreIds)
            {
                var definition = baseDefinition.Clone();
                definition.Id = new StoreId(uniqueStoreId);
                yield return(Create(definition));
            }
        }
        public IStore Create(StoreDefinition definition)
        {
            var fixture = commonFixture.GetNewFixture();

            if (definition.Id != null)
            {
                fixture.ConstructorArgumentFor <Store, StoreId>("id", definition.Id);
            }
            if (definition.Name != null)
            {
                fixture.ConstructorArgumentFor <Store, string>("name", definition.Name);
            }
            if (definition.IsDeleted != null)
            {
                fixture.ConstructorArgumentFor <Store, bool>("isDeleted", definition.IsDeleted.Value);
            }
            if (definition.Sections != null)
            {
                fixture.ConstructorArgumentFor <Store, IEnumerable <IStoreSection> >("sections", definition.Sections);
            }

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