Ejemplo n.º 1
0
        public void FieldTestComparisonMissingField()
        {
            var dep = new FieldComparisonDependency("", ComponentType.GPU, "Recommended Power Supply", ComponentType.PowerSupply, "Wattage", FieldComparisonDependency.CompareMode.LessThanOrEqual)
            {
                FailOnEmpty = true
            };
            var items = new List <Item>()
            {
                new Item()
                {
                    Name          = "GPU",
                    ComponentType = ComponentType.GPU,
                    Specs         = new Dictionary <string, string>()
                    {
                        { "Recommended Power Supply", "500 Watts" }
                    }
                },
                new Item()
                {
                    Name          = "PSU",
                    ComponentType = ComponentType.PowerSupply,
                    Specs         = new Dictionary <string, string>()
                    {
                    }
                },
            };

            Assert.AreEqual(dep.HasErrors(items).Count, 2);

            items = new List <Item>()
            {
                new Item()
                {
                    Name          = "GPU",
                    ComponentType = ComponentType.GPU,
                    Specs         = new Dictionary <string, string>()
                    {
                    }
                },
                new Item()
                {
                    Name          = "PSU",
                    ComponentType = ComponentType.PowerSupply,
                    Specs         = new Dictionary <string, string>()
                    {
                        { "Wattage", "100 Watts" }
                    }
                },
            };

            Assert.AreEqual(dep.HasErrors(items).Count, 2);
        }