예제 #1
0
                public void SellableItemCompare_ByImportData_ListPricingTest_08_AreEqual(
                    SellableItem ItemA,
                    List <Money> PricesA)
                {
                    /**********************************************
                    * Arrange
                    **********************************************/
                    var comparer = new ImportSellableItemComparer(SellableItemComparerConfiguration.ByImportData);

                    ItemA.GetPolicy <ListPricingPolicy>().AddPrices(PricesA);
                    var ItemB = ItemA.Clone();

                    /**********************************************
                    * Act
                    **********************************************/
                    bool   result        = false;
                    Action executeAction = () => result = comparer.Equals(ItemA, ItemB);

                    /**********************************************
                    * Assert
                    **********************************************/
                    executeAction.Should().NotThrow <Exception>();
                    ItemA.GetPolicy <ListPricingPolicy>().Prices.Cast <Money>().Count().Should().BeGreaterThan(0);
                    ItemA.GetPolicy <ListPricingPolicy>().Prices.Cast <Money>().Count().Should().Be(ItemB.GetPolicy <ListPricingPolicy>().Prices.Cast <Money>().Count());
                    result.Should().BeTrue();
                }
예제 #2
0
                public void SellableItemCompare_ByImportData_ListPricingTest_03_PoliciesBoth_IsNull(
                    SellableItem ItemA,
                    List <Money> PricesA)
                {
                    /**********************************************
                    * Arrange
                    **********************************************/
                    var comparer = new ImportSellableItemComparer(SellableItemComparerConfiguration.ByImportData);

                    ItemA.GetPolicy <ListPricingPolicy>().AddPrices(PricesA);
                    var ItemB = ItemA.Clone();

                    ItemA.Policies = null;
                    ItemB.Policies = null;

                    /**********************************************
                    * Act
                    **********************************************/
                    bool   result        = false;
                    Action executeAction = () => result = comparer.Equals(ItemA, ItemB);

                    /**********************************************
                    * Assert
                    **********************************************/
                    executeAction.Should().NotThrow <Exception>();
                    result.Should().BeTrue();
                }
예제 #3
0
                public void SellableItemCompare_ByImportData_ListPricingTest_04_DifferentCount(
                    SellableItem ItemA,
                    List <Money> PricesA)
                {
                    /**********************************************
                    * Arrange
                    **********************************************/
                    var comparer = new ImportSellableItemComparer(SellableItemComparerConfiguration.ByImportData);

                    ItemA.GetPolicy <ListPricingPolicy>().AddPrices(PricesA);
                    var ItemB  = ItemA.Clone();
                    var policy = ItemA.GetPolicy <ListPricingPolicy>();

                    policy.RemovePrice(policy.Prices.Cast <Money>().First());

                    /**********************************************
                    * Act
                    **********************************************/
                    bool   result        = false;
                    Action executeAction = () => result = comparer.Equals(ItemA, ItemB);

                    /**********************************************
                    * Assert
                    **********************************************/
                    executeAction.Should().NotThrow <Exception>();
                    ItemA.GetPolicy <ListPricingPolicy>().Prices.Cast <Money>().Count().Should().NotBe(ItemB.GetPolicy <ListPricingPolicy>().Prices.Cast <Money>().Count());
                    result.Should().BeFalse();
                }
예제 #4
0
                public void SellableItemCompare_ByImportData_ListPricingTest_05_SameCount_EachListWithDifferentDuplicates(
                    SellableItem ItemA,
                    List <Money> PricesA)
                {
                    /**********************************************
                    * Arrange
                    **********************************************/
                    var comparer = new ImportSellableItemComparer(SellableItemComparerConfiguration.ByImportData);

                    ItemA.GetPolicy <ListPricingPolicy>().AddPrices(PricesA);
                    var ItemB             = ItemA.Clone();
                    var initialPriceCount = ItemA.GetPolicy <ListPricingPolicy>().Prices.Cast <Money>().Count();
                    var policyA           = ItemA.GetPolicy <ListPricingPolicy>();

                    policyA.AddPrice(policyA.Prices.Cast <Money>().ElementAt(0).Clone());
                    var policyB = ItemA.GetPolicy <ListPricingPolicy>();

                    policyB.AddPrice(policyB.Prices.Cast <Money>().ElementAt(2).Clone());

                    /**********************************************
                    * Act
                    **********************************************/
                    bool   result        = false;
                    Action executeAction = () => result = comparer.Equals(ItemA, ItemB);

                    /**********************************************
                    * Assert
                    **********************************************/
                    executeAction.Should().NotThrow <Exception>();
                    ItemA.GetPolicy <ListPricingPolicy>().Prices.Cast <Money>().Count().Should().Be(ItemB.GetPolicy <ListPricingPolicy>().Prices.Cast <Money>().Count());
                    // Turns out we can't add duplicates. If this behaviour every changes, you will need to revist.
                    ItemA.GetPolicy <ListPricingPolicy>().Prices.Cast <Money>().Count().Should().Be(initialPriceCount);
                    result.Should().BeTrue();
                }
                public void SellableItemCompare_ByImportData_ProductExtensionComponent_05_AreDifferent(
                    SellableItem ItemA,
                    ProductExtensionComponent ProductExtensionComponentA)
                {
                    /**********************************************
                    * Arrange
                    **********************************************/
                    var comparer = new ImportSellableItemComparer(SellableItemComparerConfiguration.ByImportData);

                    ItemA.Components.Add(ProductExtensionComponentA);
                    var ItemB = ItemA.Clone();

                    ItemB.GetComponent <ProductExtensionComponent>().Style += "1";

                    /**********************************************
                    * Act
                    **********************************************/
                    bool   result        = false;
                    Action executeAction = () => result = comparer.Equals(ItemA, ItemB);

                    /**********************************************
                    * Assert
                    **********************************************/
                    executeAction.Should().NotThrow <Exception>();
                    ItemA.GetComponent <ProductExtensionComponent>().Style.Should().NotBeNullOrWhiteSpace();
                    result.Should().BeFalse();
                }
                public void SellableItemCompare_ByImportData_ProductExtensionComponent_03_ItemBoth_IsNull(
                    SellableItem ItemA)
                {
                    /**********************************************
                    * Arrange
                    **********************************************/
                    var comparer = new ImportSellableItemComparer(SellableItemComparerConfiguration.ByImportData);
                    var ItemB    = ItemA.Clone();

                    ItemA.GetComponent <ProductExtensionComponent>().Style = null;
                    ItemB.GetComponent <ProductExtensionComponent>().Style = null;

                    /**********************************************
                    * Act
                    **********************************************/
                    bool   result        = false;
                    Action executeAction = () => result = comparer.Equals(ItemA, ItemB);

                    /**********************************************
                    * Assert
                    **********************************************/
                    executeAction.Should().NotThrow <Exception>();
                    ItemA.GetComponent <ProductExtensionComponent>().Style.Should().BeNull();
                    result.Should().BeTrue();
                }
예제 #7
0
                public void SellableItemCompare_ByImportData_Images_05_SameCount_EachListWithDifferentDuplicates(
                    SellableItem ItemA,
                    ImagesComponent ImagesComponentA)
                {
                    /**********************************************
                    * Arrange
                    **********************************************/
                    var comparer = new ImportSellableItemComparer(SellableItemComparerConfiguration.ByImportData);

                    ItemA.Components.Add(ImagesComponentA);
                    var ItemB = ItemA.Clone();

                    ItemA.GetComponent <ImagesComponent>().Images.Add(ItemA.GetComponent <ImagesComponent>().Images[0].Clone().ToString());
                    ItemB.GetComponent <ImagesComponent>().Images.Add(ItemB.GetComponent <ImagesComponent>().Images[2].Clone().ToString());

                    /**********************************************
                    * Act
                    **********************************************/
                    bool   result        = false;
                    Action executeAction = () => result = comparer.Equals(ItemA, ItemB);

                    /**********************************************
                    * Assert
                    **********************************************/
                    executeAction.Should().NotThrow <Exception>();
                    ItemA.GetComponent <ImagesComponent>().Images.Count().Should().Be(ItemB.GetComponent <ImagesComponent>().Images.Count());
                    result.Should().BeFalse();
                }
예제 #8
0
                public void SellableItemCompare_ByImportData_Images_02_ImagesB_IsNull(
                    SellableItem ItemA,
                    ImagesComponent ImagesComponentA)
                {
                    /**********************************************
                    * Arrange
                    **********************************************/
                    var comparer = new ImportSellableItemComparer(SellableItemComparerConfiguration.ByImportData);

                    ItemA.Components.Add(ImagesComponentA);
                    var ItemB = ItemA.Clone();

                    ItemB.GetComponent <ImagesComponent>().Images = null;

                    /**********************************************
                    * Act
                    **********************************************/
                    bool   result        = false;
                    Action executeAction = () => result = comparer.Equals(ItemA, ItemB);

                    /**********************************************
                    * Assert
                    **********************************************/
                    executeAction.Should().NotThrow <Exception>();
                    ItemA.GetComponent <ImagesComponent>().Images.Count().Should().BeGreaterThan(0);
                    result.Should().BeFalse();
                }
예제 #9
0
                public void SellableItemCompare_ByImportData_Catalogs_03_ListBoth_IsNull(
                    SellableItem ItemA)
                {
                    /**********************************************
                    * Arrange
                    **********************************************/
                    var comparer = new ImportSellableItemComparer(SellableItemComparerConfiguration.ByImportData);
                    var ItemB    = ItemA.Clone();

                    ItemA.ParentCatalogList = null;
                    ItemB.ParentCatalogList = null;

                    /**********************************************
                    * Act
                    **********************************************/
                    bool   result        = false;
                    Action executeAction = () => result = comparer.Equals(ItemA, ItemB);

                    /**********************************************
                    * Assert
                    **********************************************/
                    executeAction.Should().NotThrow <Exception>();
                    ItemA.ParentCatalogList.Should().BeNull();
                    result.Should().BeTrue();
                }
예제 #10
0
                public void SellableItemCompare_ByImportData_Catalogs_04_DifferentCount(
                    SellableItem ItemA)
                {
                    /**********************************************
                    * Arrange
                    **********************************************/
                    var comparer = new ImportSellableItemComparer(SellableItemComparerConfiguration.ByImportData);

                    ItemA.ParentCatalogList = "06f5147b-9e24-fa33-20fb-d4b7d8d21392|440c1cd5-20c1-e0d1-3319-9766112ed9ca|59ddadc1-9b88-727e-9e14-3f6cf321ae0f";
                    var ItemB = ItemA.Clone();

                    ItemB.ParentCatalogList = "06f5147b-9e24-fa33-20fb-d4b7d8d21392|59ddadc1-9b88-727e-9e14-3f6cf321ae0f";

                    /**********************************************
                    * Act
                    **********************************************/
                    bool   result        = false;
                    Action executeAction = () => result = comparer.Equals(ItemA, ItemB);

                    /**********************************************
                    * Assert
                    **********************************************/
                    executeAction.Should().NotThrow <Exception>();
                    ItemA.ParentCatalogList.Split('|').Count().Should().NotBe(ItemB.ParentCatalogList.Split('|').Count());
                    result.Should().BeFalse();
                }
예제 #11
0
                public void SellableItemCompare_ByImportData_Categories_07_SameCountButDifferentValues(
                    SellableItem ItemA)
                {
                    /**********************************************
                    * Arrange
                    **********************************************/
                    var comparer = new ImportSellableItemComparer(SellableItemComparerConfiguration.ByImportData);

                    ItemA.ParentCategoryList = "06f5147b-9e24-fa33-20fb-d4b7d8d21392|440c1cd5-20c1-e0d1-3319-9766112ed9ca|59ddadc1-9b88-727e-9e14-3f6cf321ae0f";
                    var ItemB = ItemA.Clone();

                    ItemB.ParentCategoryList = "06f5147b-9e24-fa33-20fb-d4b7d8d21392|440c1cd5-20c1-e0d1-3319-9766112ed9ca|f8fd76b4-d5b0-4fa2-b881-2867488e5609";

                    /**********************************************
                    * Act
                    **********************************************/
                    bool   result        = false;
                    Action executeAction = () => result = comparer.Equals(ItemA, ItemB);

                    /**********************************************
                    * Assert
                    **********************************************/
                    executeAction.Should().NotThrow <Exception>();
                    ItemA.ParentCategoryList.Split('|').Count().Should().BeGreaterThan(0);
                    ItemA.ParentCategoryList.Split('|').Count().Should().Be(ItemB.ParentCategoryList.Split('|').Count());
                    result.Should().BeFalse();
                }
            public void SellableItemCompare_ByImportData_05_IdsSame_OtherFieldsSame(
                SellableItem ItemA)
            {
                /**********************************************
                * Arrange
                **********************************************/
                var comparer = new ImportSellableItemComparer(SellableItemComparerConfiguration.ByImportData);
                var ItemB    = ItemA.Clone();

                /**********************************************
                * Act
                **********************************************/
                bool   result        = false;
                Action executeAction = () => result = comparer.Equals(ItemA, ItemB);

                /**********************************************
                * Assert
                **********************************************/
                executeAction.Should().NotThrow <Exception>();
                result.Should().BeTrue();
            }
            public void SellableItemCompare_ByImportData_04_ByImportData_IdsDifferent(
                SellableItem ItemA)
            {
                /**********************************************
                * Arrange
                **********************************************/
                var comparer = new ImportSellableItemComparer(SellableItemComparerConfiguration.ByImportData);
                var ItemB    = ItemA.Clone();

                ItemB.ProductId = ItemB.ProductId + "1";

                /**********************************************
                * Act
                **********************************************/
                bool   result        = false;
                Action executeAction = () => result = comparer.Equals(ItemA, ItemB);

                /**********************************************
                * Assert
                **********************************************/
                executeAction.Should().NotThrow <Exception>();
                result.Should().BeFalse();
            }
예제 #14
0
                public void SellableItemCompare_ByImportData_TagsTest_02_TagsB_IsNull(
                    SellableItem ItemA)
                {
                    /**********************************************
                    * Arrange
                    **********************************************/
                    var comparer = new ImportSellableItemComparer(SellableItemComparerConfiguration.ByImportData);
                    var ItemB    = ItemA.Clone();

                    ItemB.Tags = null;

                    /**********************************************
                    * Act
                    **********************************************/
                    bool   result        = false;
                    Action executeAction = () => result = comparer.Equals(ItemA, ItemB);

                    /**********************************************
                    * Assert
                    **********************************************/
                    executeAction.Should().NotThrow <Exception>();
                    result.Should().BeFalse();
                }
예제 #15
0
                public void SellableItemCompare_ByImportData_TagsTest_06_AreEqual(
                    SellableItem ItemA)
                {
                    /**********************************************
                    * Arrange
                    **********************************************/
                    var comparer = new ImportSellableItemComparer(SellableItemComparerConfiguration.ByImportData);
                    var ItemB    = ItemA.Clone();

                    /**********************************************
                    * Act
                    **********************************************/
                    bool   result        = false;
                    Action executeAction = () => result = comparer.Equals(ItemA, ItemB);

                    /**********************************************
                    * Assert
                    **********************************************/
                    executeAction.Should().NotThrow <Exception>();
                    ItemA.Tags.Count.Should().BeGreaterThan(0);
                    ItemA.Tags.Count.Should().Be(ItemB.Tags.Count);
                    result.Should().BeTrue();
                }