Ejemplo n.º 1
0
        public void EnsureICanInjectContextInstance()
        {
            FakeBlogContext    context = new FakeBlogContext();
            FakeBlogRepository repo    = new FakeBlogRepository(context);

            Assert.IsNotNull(repo.Context);
        }
Ejemplo n.º 2
0
        public void Setup()
        {
            fake_post_table = new List <Post>();
            fake_context    = new Mock <FakeBlogContext>();
            mock_posts_set  = new Mock <DbSet <Post> >();
            repo            = new FakeBlogRepository(fake_context.Object);

            John = new ApplicationUser {
                Id = "John-id-1", UserName = "******", Email = "*****@*****.**"
            };
            Jane = new ApplicationUser {
                Id = "Jane-id-1", UserName = "******", Email = "*****@*****.**"
            };

            PostTitle   = "My Coding Story";
            PostContent = "Blah blah blah blah blah blah blah blah blah blah blah blah blah.";
        }
Ejemplo n.º 3
0
 public void Setup()
 {
     fakePostTable = new List <Post>();
     fakeContext   = new Mock <FakeBlogContext>();
     mockPostSet   = new Mock <DbSet <Post> >();
     repo          = new FakeBlogRepository(fakeContext.Object);
     sammy         = new ApplicationUser {
         AuthorId = "sammy-author-id", UserName = "******", Id = "sammy-user-id", Email = "*****@*****.**"
     };
     sally = new ApplicationUser {
         AuthorId = "sally-author-id", UserName = "******", Id = "sally-user-id", Email = "*****@*****.**"
     };
     postA = new Post {
         PostId = 12345, IsDraft = false, Title = "My First Post", Contents = "Sample text goes here.  I wonder what I will write about in the future.  No one will ever read this so it's ok.", DateCreated = DateTime.Now
     };
     postB = new Post {
         PostId = 23456, IsDraft = true, Title = "My Second Post", Contents = "I can't believe people read my first post ... I wonder what I will write about in the future.  No one will ever read this so it's ok.", DateCreated = DateTime.Now
     };
     postC = new Post {
         PostId = 34567, IsDraft = true, Title = "My First Bit Of Ideas", Contents = "This is going to be a blog post about bugs, will write more later.", DateCreated = DateTime.Now
     };
 }
Ejemplo n.º 4
0
        public void EnsureIHaveNotNullContext()
        {
            FakeBlogRepository repo_local = new FakeBlogRepository();

            Assert.IsNotNull(repo_local.Context);
        }
Ejemplo n.º 5
0
        public void EnsureICanCreateInstanceofRepo()
        {
            FakeBlogRepository repo = new FakeBlogRepository();

            Assert.IsNotNull(repo);
        }