예제 #1
0
        public void CheckAddCorrectly()
        {
            ICollection <IUserPost> sut = GetAllUserPost();
            UserInfo person             = new UserInfo()
            {
                Username         = "******",
                Name             = "emil georgi",
                NumberOfComments = 1234,
                NumberOfPosts    = 10,
                ProfilPictureUrl = "https://i.imgur.com/ciVNs.gif",
                RegisterDate     = DateTime.Now,
            };

            IUserPost savedPerson = AddIUserPost(person);

            Assert.Equal(person, savedPerson);
        }
        public TestingDatabase()
        {
            _connection = new SqliteConnection("Filename=:memory:");
            _connection.Open();

            _db = new SMModelersContext(
                new DbContextOptionsBuilder <SMModelersContext>()
                .UseSqlite(_connection)
                .Options);

            _db.Database.EnsureCreated();

            _comment = new PostCommentManager(_db);

            _image = new PostImageManager(_db, _cloudImage, _s3Provider);

            _post = new UserPostManager(_db, _comment, _image);
        }
 public UserPostController(IUserPost userPost, IPostComment postComment, UserManager <ApplicationUser> userManager)
 {
     _userPost    = userPost;
     _postComment = postComment;
     _userManager = userManager;
 }
예제 #4
0
        private IUserPost AddIUserPost(IUserPost userPost)
        {
            var entry = GetDbContext().Add(userPost);

            return(entry.Entity);
        }
 public UserPageManager(SMModelersContext context, IUserPost post)
 {
     _context = context;
     _post    = post;
 }