public Friendship Create(Friendship friendship) { Validator.Validate(friendship); var saveFriendship = _FriendshipRepository.Save(friendship); return saveFriendship; }
public Friendship Update(Friendship friendship) { DbEntityEntry entry = _context.Entry(friendship); entry.State = EntityState.Modified; _context.SaveChanges(); return friendship; }
public Friendship Update(Friendship friendship) { Validator.Validate(friendship); var updateFriendship = _FriendshipRepository.Update(friendship); return updateFriendship; }
public void CreateAValidFriendshiNameAndIdTest() { Friendship Friendship = new Friendship(); Friendship.Name = "Lages"; Friendship.Id = 1; Validator.Validate(Friendship); }
public void Setup() { _Friendship = ObjectMother.GetFriendship(); _mockRepository = new MockRepository(MockBehavior.Default); _FriendshipRepoMoq = _mockRepository.Create<IFriendshipRepository>(); _service = new FriendshipService(_FriendshipRepoMoq.Object); }
public void Follow(Friendship friendship) { this.FollowersCount += 1; followers.Add(friendship); foreach (var postsOfFriend in friendship.posts) { posts.Add(postsOfFriend); } }
public IEnumerable<Post> GetAllPostsOfFriendship(Friendship friendship) { IEnumerable<Post> posts = null; foreach (var post in friendship.posts) { posts = postRepository.GetAll().Where(x => x.Message == post.Message); } return posts; }
public static Friendship GetFriendship() { Friendship friendship = new Friendship(); friendship.Name = "user1"; friendship.FollowersCount = 20; friendship.Id = 1; friendship.followers.Add(new Friendship() { Name = "user1", FollowersCount = 20, Id = 1, posts = new List<Post>() { new Post(){ Id = 1, Name = "name1", Message = "Post1" }} }); friendship.posts.Add(new Post() { Id = 1, Name = "name1", Message = "Post1" }); friendship.posts.Add(new Post() { Id = 2, Name = "name2", Message = "Post2" }); friendship.posts.Add(new Post() { Id = 3, Name = "name3", Message = "Post3" }); friendship.posts.Add(new Post() { Id = 4, Name = "name4", Message = "Post4" }); friendship.followers.Add(new Friendship() { Name = "user2", FollowersCount = 20, Id = 1 }); return friendship; }
public Friendship Save(Friendship friendship) { var newFriendship = _context.Friendships.Add(friendship); _context.SaveChanges(); return newFriendship; }
public void UnFollow(Friendship friendship) { this.FollowersCount -= 1; posts.RemoveAll(x => this.Id != friendship.Id); }
public void Setup() { _Friendship = ObjectMother.GetFriendship(); }