예제 #1
0
        public void TestGetByAuthorId()
        {
            this.Setup();
            var context2 = CreateContext(nameDB);

            var controller = new BlogController(context2);
            var result     = controller.GetByAuthorId(1).Result;

            Post[] posts = new Post[] {
                new Post {
                    PostId = 1, Title = "Post1", Body = "Body1", Date = DateTime.Now.Date, AuthorId = 1,
                    Author = new Author {
                        Name = "Author1", Pass = "******", Mail = "*****@*****.**"
                    }
                }
            };
            Assert.AreEqual(posts, result.Value);
            Assert.AreEqual(posts.Count(), result.Value.Count());
        }