コード例 #1
0
    public void MatchesAllCatalogItems()
    {
        var catalogItemIds = new int[] { 1, 3 };
        var spec           = new eShopWeb.ApplicationCore.Specifications.CatalogItemsSpecification(catalogItemIds);

        var result = GetTestCollection()
                     .AsQueryable()
                     .Where(spec.WhereExpressions.FirstOrDefault().Filter);

        Assert.NotNull(result);
        Assert.Equal(2, result.ToList().Count);
    }
コード例 #2
0
    public void MatchesSpecificCatalogItem()
    {
        var catalogItemIds = new int[] { 1 };
        var spec           = new eShopWeb.ApplicationCore.Specifications.CatalogItemsSpecification(catalogItemIds);

        var result = GetTestCollection()
                     .AsQueryable()
                     .Where(spec.WhereExpressions.FirstOrDefault());

        Assert.NotNull(result);
        Assert.Single(result.ToList());
    }