예제 #1
0
        public void ensureRemovingValidCustomizedProductRemovesCustomizedProduct()
        {
            CatalogueCollection catalogueCollection = buildCatalogueCollection();

            CustomizedProduct customizedProduct = buildCustomizedProduct("1234");

            catalogueCollection.removeCustomizedProduct(customizedProduct);

            Assert.False(catalogueCollection.hasCustomizedProduct(customizedProduct));
            Assert.Single(catalogueCollection.catalogueCollectionProducts);
        }
예제 #2
0
        public void ensureCreatingCatalogueCollectionWithCustomizedProductCollectionAddsAllCustomizedProducts()
        {
            CustomizedProductCollection customizedProductCollection = new CustomizedProductCollection("Closets Spring 2019");

            CustomizedProduct customizedProduct1 = buildCustomizedProduct("1234");

            customizedProduct1.finalizeCustomization();     //!customized products added to collections need to be finished

            customizedProductCollection.addCustomizedProduct(customizedProduct1);

            CustomizedProduct customizedProduct2 = buildCustomizedProduct("1235");

            customizedProduct2.finalizeCustomization();     //!customized products added to collections need to be finished

            customizedProductCollection.addCustomizedProduct(customizedProduct2);

            CatalogueCollection catalogueCollection = new CatalogueCollection(customizedProductCollection);

            Assert.True(catalogueCollection.hasCustomizedProduct(customizedProduct1));
            Assert.True(catalogueCollection.hasCustomizedProduct(customizedProduct2));
        }
예제 #3
0
        public void ensureAddingCustomizedProductNotAddedTocustomizedProductCollectionDoesNotAddCustomizedProduct()
        {
            CatalogueCollection catalogueCollection = buildCatalogueCollection();

            CustomizedProduct customizedProduct = buildCustomizedProduct("12345");

            try
            {
                catalogueCollection.addCustomizedProduct(customizedProduct);
            }
            catch (Exception) { }

            Assert.Equal(2, catalogueCollection.catalogueCollectionProducts.Count);
            Assert.False(catalogueCollection.hasCustomizedProduct(customizedProduct));
        }
예제 #4
0
        public void ensureAddingValidCustomizedProductAddsCustomizedProduct()
        {
            CatalogueCollection catalogueCollection = buildCatalogueCollection();

            CustomizedProductCollection customizedProductCollection = catalogueCollection.customizedProductCollection;

            CustomizedProduct customizedProduct = buildCustomizedProduct("123545");

            customizedProduct.finalizeCustomization();

            customizedProductCollection.addCustomizedProduct(customizedProduct);

            catalogueCollection.addCustomizedProduct(customizedProduct);

            Assert.Equal(3, catalogueCollection.catalogueCollectionProducts.Count);
            Assert.True(catalogueCollection.hasCustomizedProduct(customizedProduct));
        }