Пример #1
0
        public StringFilterNullTests()
        {
            _processor = new PagrProcessor(new PagrOptionsAccessor());

            _comments = new List <Comment>
            {
                new Comment
                {
                    Id          = 0,
                    DateCreated = DateTimeOffset.UtcNow,
                    Text        = "This text contains null somewhere in the middle of a string",
                    Author      = "Dog",
                },
                new Comment
                {
                    Id          = 1,
                    DateCreated = DateTimeOffset.UtcNow,
                    Text        = "null is here in the text",
                    Author      = "Cat",
                },
                new Comment
                {
                    Id          = 2,
                    DateCreated = DateTimeOffset.UtcNow,
                    Text        = "Regular comment without n*ll.",
                    Author      = "Mouse",
                },
                new Comment
                {
                    Id          = 100,
                    DateCreated = DateTimeOffset.UtcNow,
                    Text        = null,
                    Author      = "null",
                },
            }.AsQueryable();
        }
Пример #2
0
        public General(ITestOutputHelper testOutputHelper)
        {
            _testOutputHelper = testOutputHelper;
            _processor        = new ApplicationPagrProcessor(new PagrOptionsAccessor(),
                                                             new PagrCustomSortMethods(),
                                                             new PagrCustomFilterMethods());

            _posts = new List <Post>
            {
                new Post
                {
                    Id         = 0,
                    Title      = "A",
                    LikeCount  = 100,
                    IsDraft    = true,
                    CategoryId = null,
                    TopComment = new Comment {
                        Id = 0, Text = "A1"
                    },
                    FeaturedComment = new Comment {
                        Id = 4, Text = "A2"
                    }
                },
                new Post
                {
                    Id         = 1,
                    Title      = "B",
                    LikeCount  = 50,
                    IsDraft    = false,
                    CategoryId = 1,
                    TopComment = new Comment {
                        Id = 3, Text = "B1"
                    },
                    FeaturedComment = new Comment {
                        Id = 5, Text = "B2"
                    }
                },
                new Post
                {
                    Id         = 2,
                    Title      = "C",
                    LikeCount  = 0,
                    CategoryId = 1,
                    TopComment = new Comment {
                        Id = 2, Text = "C1"
                    },
                    FeaturedComment = new Comment {
                        Id = 6, Text = "C2"
                    }
                },
                new Post
                {
                    Id         = 3,
                    Title      = "D",
                    LikeCount  = 3,
                    IsDraft    = true,
                    CategoryId = 2,
                    TopComment = new Comment {
                        Id = 1, Text = "D1"
                    },
                    FeaturedComment = new Comment {
                        Id = 7, Text = "D2"
                    }
                },
            }.AsQueryable();

            _comments = new List <Comment>
            {
                new Comment
                {
                    Id          = 0,
                    DateCreated = DateTimeOffset.UtcNow.AddDays(-20),
                    Text        = "This is an old comment."
                },
                new Comment
                {
                    Id          = 1,
                    DateCreated = DateTimeOffset.UtcNow.AddDays(-1),
                    Text        = "This is a fairly new comment."
                },
                new Comment
                {
                    Id          = 2,
                    DateCreated = DateTimeOffset.UtcNow,
                    Text        = "This is a brand new comment. (Text in braces, comma separated)"
                },
            }.AsQueryable();
        }