public async Task AddCircleTopicReply_AddNotificationToCommentOwner() { var repliedUserName = "******"; int repliedUserNameId = TestDataSeeder.GetAppUserIdByName(repliedUserName); var commentOwnerName = "TestMember1"; int commentOwnerId = TestDataSeeder.GetAppUserIdByName(commentOwnerName); await LoginByUser(repliedUserName); var contents = BuildStringContent(new CircleTopicCommentReply() { AppUserId = repliedUserNameId, CommentId = 1, Reply = "Reply Test" }); var response = await _client.PostAsync("/api/circletopiccommentreply", contents); response.EnsureSuccessStatusCode(); //Check if notification was created await LoginByUser(commentOwnerName); var notifications = await _client.GetAsync("/api/notification/" + commentOwnerId); string result = await notifications.Content.ReadAsStringAsync(); Assert.Contains("notificationType\":" + (int)NotificationEnum.NewCircleCommentReplyByMember, result); }
private async Task <HttpResponseMessage> participateEvent(string userName, int circleEventId) { int userId = TestDataSeeder.GetAppUserIdByName(userName); await LoginByUser(userName); var contents = BuildStringContent(new CircleEventParticipation() { AppUserId = userId, CircleEventId = circleEventId }); return(await _client.PostAsync("/api/circleeventparticipation", contents)); }
public async Task AcceptRequest_AddMemberAndNotification() { //Arrange string circleOwnerName = "TestMember1"; // int ownerUserId = TestData.GetAppUserIdByName(circleOwnerName); // int ownerUserId = 11; string requestUserName = "******"; // int requestUserId = 13; int requestUserId = TestDataSeeder.GetAppUserIdByName(requestUserName); //Act var approvingRequest = new CircleRequest { AppUserId = requestUserId, CircleId = 1 }; //Accept circle request by owner await LoginByUser(circleOwnerName); var contents = new StringContent(JsonConvert.SerializeObject(approvingRequest), Encoding.UTF8, "application/json"); var response = await _client.PostAsync("/api/circlemember/approve", contents); response.EnsureSuccessStatusCode(); //Check if a new member was added response = await _client.GetAsync("/api/circlemember/" + approvingRequest.CircleId + "/latest"); response.EnsureSuccessStatusCode(); var jsonResult = JsonConvert.DeserializeObject <JArray>(await response.Content.ReadAsStringAsync()); var memberList = jsonResult.ToObject <List <CircleMember> >(); Assert.True(memberList.Any(ml => ml.AppUserId == requestUserId && ml.CircleId == 1)); //Check if notification was created await LoginByUser(requestUserName); var notifications = await _client.GetAsync("/api/notification/" + requestUserId); string result = await notifications.Content.ReadAsStringAsync(); Assert.Contains("notificationType\":" + (int)NotificationEnum.CircleRequestAccepted, result); }