public void Add_Returns() { var fakeConfig = MakeFakeConfig(); var stubFileDataAccess = new StubIFileDataAccess <BlogUser>(); var fileAdapter = new BlogUserFileAdapter(fakeConfig, stubFileDataAccess); var param_entity = new BlogUserFactory().Create(); fileAdapter.Add(param_entity); }
public void Edit_Returns() { var fakeConfig = MakeFakeConfig(); var stubFileDataAccess = new StubIFileDataAccess <BlogUser>(); var fileAdapter = new BlogUserFileAdapter(fakeConfig, stubFileDataAccess); var param_entity = new BlogUserFactory().Create(); var stub_blogUser = new BlogUserFactory().Create(); stub_blogUser.UserId = Guid.Parse("55555555-5555-5555-5555-555555555555"); var stub_list = new List <BlogUser> { param_entity, stub_blogUser }; stubFileDataAccess.StubReadDatabase(stub_list); fileAdapter.Edit(param_entity); }
public void List_ReturnsExpectedList() { var fakeConfig = MakeFakeConfig(); var stubFileDataAccess = new StubIFileDataAccess <BlogUser>(); var fileAdapter = new BlogUserFileAdapter(fakeConfig, stubFileDataAccess); var stub_blogUser = new BlogUserFactory().Create(); var stub_list = new List <BlogUser> { stub_blogUser }; stubFileDataAccess.StubReadDatabase(stub_list); var expected = stub_list; var actual = fileAdapter.List(); Assert.Equal(expected, actual); }
public void DeleteByAuthorId_Returns() { var fakeConfig = MakeFakeConfig(); var stubFileDataAccess = new StubIFileDataAccess <BlogPost>(); var fileAdapter = new BlogPostFileAdapter(fakeConfig, stubFileDataAccess); var stub_blogPost1 = new BlogPostFactory().Create(); var stub_blogPost2 = new BlogPostFactory().Create(); stub_blogPost2.AuthorId = Guid.Parse("55555555-5555-5555-5555-555555555555"); var stub_list = new List <BlogPost> { stub_blogPost1, stub_blogPost2 }; stubFileDataAccess.StubReadDatabase(stub_list); fileAdapter.DeleteAllByAuthorId(stub_blogPost2.AuthorId); }
public void Delete_Returns() { var fakeConfig = MakeFakeConfig(); var stubFileDataAccess = new StubIFileDataAccess <BlogPost>(); var fileAdapter = new BlogPostFileAdapter(fakeConfig, stubFileDataAccess); var param_entity = new BlogPostFactory().Create(); var stub_blogPost = new BlogPostFactory().Create(); stub_blogPost.PostId = Guid.Parse("55555555-5555-5555-5555-555555555555"); var stub_list = new List <BlogPost> { param_entity, stub_blogPost }; stubFileDataAccess.StubReadDatabase(stub_list); fileAdapter.Delete(param_entity); }
public void GetById_ReturnsExpectedBlogUser() { var fakeConfig = MakeFakeConfig(); var stubFileDataAccess = new StubIFileDataAccess <BlogUser>(); var fileAdapter = new BlogUserFileAdapter(fakeConfig, stubFileDataAccess); var stub_blogUser1 = new BlogUserFactory().Create(); var stub_blogUser2 = new BlogUserFactory().Create(); stub_blogUser2.UserId = Guid.Parse("55555555-5555-5555-5555-555555555555"); var stub_list = new List <BlogUser> { stub_blogUser1, stub_blogUser2 }; stubFileDataAccess.StubReadDatabase(stub_list); var expected = stub_blogUser2; var actual = fileAdapter.GetById(stub_blogUser2.UserId); Assert.Equal(expected, actual); }
public void ListByAuthorId_ReturnsExpectedList() { var fakeConfig = MakeFakeConfig(); var stubFileDataAccess = new StubIFileDataAccess <BlogPost>(); var fileAdapter = new BlogPostFileAdapter(fakeConfig, stubFileDataAccess); var stub_blogPost1 = new BlogPostFactory().Create(); var stub_blogPost2 = new BlogPostFactory().Create(); stub_blogPost2.AuthorId = Guid.Parse("55555555-5555-5555-5555-555555555555"); var stub_list = new List <BlogPost> { stub_blogPost1, stub_blogPost2 }; stubFileDataAccess.StubReadDatabase(stub_list); var expected = new List <BlogPost> { stub_blogPost2 }; var actual = fileAdapter.ListByAuthorId(stub_blogPost2.AuthorId); Assert.Equal(expected, actual); }