예제 #1
0
        public async Task Should_return_false_when_forum_is_not_valid()
        {
            using (var dbContext = new AtlesDbContext(Shared.CreateContextOptions()))
            {
                var sut    = new ForumRules(dbContext);
                var actual = await sut.IsValidAsync(Guid.NewGuid(), Guid.NewGuid());

                Assert.IsFalse(actual);
            }
        }
예제 #2
0
        public async Task Should_return_true_when_forum_is_valid()
        {
            var options  = Shared.CreateContextOptions();
            var category = new Category(Guid.NewGuid(), Guid.NewGuid(), "Category", 1, Guid.NewGuid());
            var forum    = new Forum(Guid.NewGuid(), category.Id, "Forum", "my-forum", "My Forum", 1);

            using (var dbContext = new AtlesDbContext(options))
            {
                dbContext.Categories.Add(category);
                dbContext.Forums.Add(forum);
                await dbContext.SaveChangesAsync();
            }

            using (var dbContext = new AtlesDbContext(options))
            {
                var sut    = new ForumRules(dbContext);
                var actual = await sut.IsValidAsync(forum.Category.SiteId, forum.Id);

                Assert.IsTrue(actual);
            }
        }