public IStoreItemAvailability CreateValidFor(IStore store)
        {
            var definition = new StoreItemAvailabilityDefinition
            {
                StoreId          = store.Id,
                DefaultSectionId = commonFixture.ChooseRandom(store.Sections).Id
            };

            return(Create(definition));
        }
        public IEnumerable <IStoreItemAvailability> CreateManyValid(int count = 3)
        {
            List <IStore> stores = storeFixture.CreateManyValid(count).ToList();

            foreach (var store in stores)
            {
                var defaultSection = commonFixture.ChooseRandom(store.Sections);

                var definition = new StoreItemAvailabilityDefinition
                {
                    StoreId          = store.Id,
                    DefaultSectionId = defaultSection.Id
                };

                yield return(Create(definition));
            }
        }
        public IStoreItemAvailability Create(StoreItemAvailabilityDefinition definition)
        {
            var fixture = commonFixture.GetNewFixture();

            if (definition.StoreId != null)
            {
                fixture.ConstructorArgumentFor <StoreItemAvailability, StoreId>("storeId", definition.StoreId);
            }
            if (definition.Price.HasValue)
            {
                fixture.ConstructorArgumentFor <StoreItemAvailability, float>("price", definition.Price.Value);
            }
            if (definition.DefaultSectionId != null)
            {
                fixture.ConstructorArgumentFor <StoreItemAvailability, SectionId>("defaultSectionId", definition.DefaultSectionId);
            }

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