public void Load_FilterContainsCorrectTypes()
        {
            var filter = new AccessoryFilterViewModel();

            filter.Load();

            var status1 = filter.Type.FirstOrDefault(checkbox => checkbox.Value == 0);
            var status2 = filter.Type.FirstOrDefault(checkbox => checkbox.Value == 1);

            Assert.Multiple(() =>
            {
                Assert.AreEqual(2, filter.Type.Count);
                Assert.IsNotNull(status1);
                Assert.IsNotNull(status2);
            }
                            );
        }
示例#2
0
        private IProductRepository MockDataSource(SKUInfo skuInfo)
        {
            Fake().DocumentType <Tableware>(Tableware.CLASS_NAME);
            Fake().DocumentType <FilterPack>(FilterPack.CLASS_NAME);

            var accessory1 = TreeNode.New <Tableware>().With(x =>
            {
                x.DocumentName = ACCESSORY_TITLE1;
                x.SKU          = skuInfo;
            });

            var accessory2 = TreeNode.New <FilterPack>().With(x =>
            {
                x.DocumentName = ACCESSORY_TITLE2;
                x.SKU          = skuInfo;
            });

            var repository     = Substitute.For <IProductRepository>();
            var grinderClasses = new[] { FilterPack.CLASS_NAME, Tableware.CLASS_NAME };

            filter = Substitute.For <AccessoryFilterViewModel>();
            repository.GetProducts(filter, Arg.Is <string[]>(collection => collection.SequenceEqual(grinderClasses)))
            .Returns(new List <SKUTreeNode> {
                accessory1, accessory2
            });

            filter2 = Substitute.For <AccessoryFilterViewModel>();
            repository.GetProducts(filter2, Arg.Is <string[]>(collection => collection.SequenceEqual(grinderClasses)))
            .Returns(new List <SKUTreeNode> {
                accessory2
            });

            filter3 = Substitute.For <AccessoryFilterViewModel>();
            repository.GetProducts(filter3, Arg.Is <string[]>(collection => collection.SequenceEqual(grinderClasses)))
            .Returns(new List <SKUTreeNode>());

            return(repository);
        }