Example #1
0
        public void ShouldCreateStoreAndRetrieve()
        {
            //Arrange

            var author = new Author
            {
                FirstName = "Devlin",
                LastName = "Liles",
                Email = "*****@*****.**",
                TwitterHandle = "@DevlinLiles"
            };


            //Act - Scenario
            var blogService = new TestBlogService(repo);
            blogService.StartBlog("Testing", author);

            blogService.Post("Testing", new Post
            {
                Title = "Test One",
                Body = "This is a body paragraph"
            });

            //Assert
            blogService.Posts("Testing").Count().Should().Be(1);
            (repo.Context as IDataContext).AsQueryable<Post>().Count().Should().Be(1);
        }
        public void Setup()
        {
            repo = new Repository(new InMemoryDataContext());

            var author = new Author
            {
                FirstName = "Devlin",
                LastName = "Liles",
                Email = "*****@*****.**",
                TwitterHandle = "@DevlinLiles"
            };


            //Act - Scenario
            var blogService = new TestBlogService(repo);
            blogService.StartBlog("Testing", author);

            blogService.Post("Testing", new Post
            {
                Title = "Test One",
                Body = "This is a body paragraph"
            });

            blogService.Post("Testing", new Post
            {
                Title = "Test Two",
                Body = "This is a body paragraph"
            });

            blogService.Post("Testing", new Post
            {
                Title = "Test first",
                Body = "This is a first"
            });

            blogService.Post("Testing", new Post
            {
                Title = "Test First",
                Body = "This is a real first (for testing ascii order F<f)"
            });
        }
 public void StartBlog(string title, Author author)
 {
     _repo.Context.Add(new Blog(title) {Author = author});
 }