public void ServiceAddKarmaTest() { CongregatioServiceClient client = new CongregatioServiceClient(); var user = ObjectHelpers.CreateUser("*****@*****.**"); client.AddUser(user); user = client.FindUserByEmail(user.Email); client.IncrementKarma(user.UserId); user = client.FindUserByEmail(user.Email); Assert.IsTrue(user.Karma == 1); client.DecrementKarma(user.UserId); user = client.FindUserByEmail(user.Email); Assert.IsTrue(user.Karma == 0); CleanUp(user, client); }
public void ServiceAddUserToRoleNoManagerTest() { CongregatioServiceClient client = new CongregatioServiceClient(); var user = ObjectHelpers.CreateUser("*****@*****.**"); //unit.UserRepository.Add(user); client.AddUser(user); user = client.FindUserByEmail(user.Email); //unit.SaveChanges(); //var role = client.FindRoleByName("User"); //user.Roles.Add(role); //client.UpdatUser(user); client.AddToRole(user, "User"); user = client.FindUserByEmail(user.Email); Assert.IsTrue(user.Roles.Count > 0); CleanUp(user, client); }
public void ServiceAttendEventTest() { CongregatioServiceClient client = new CongregatioServiceClient(); var user = ObjectHelpers.CreateUser("*****@*****.**"); var @event = ObjectHelpers.CreateEvent(user, "ServiceAttendEventTest"); var attendee = ObjectHelpers.CreateUser("*****@*****.**"); try { client.AddUser(user); client.AddUser(attendee); client.AddEvent(@event); //user = unit.UserRepository.FindByEmail(user.Email); attendee = client.FindUserByEmail(attendee.Email); @event = client.GetEventByTitle(@event.EventTitle); } catch (Exception e) { Console.WriteLine(e.Message); } try { client.AttendEvent(attendee.UserId, @event); } catch (Exception e) { Console.WriteLine(e.Message); } @event = client.GetEventByIdLong(@event.Id); attendee =client.FindUserById(attendee.UserId); Assert.IsTrue(attendee.AttendedEvents.Count > 0); Assert.IsTrue(@event.Attendees.Count > 0); CleanUp(client, @event, attendee); }
public void ServiceStalkUserTest() { CongregatioServiceClient client = new CongregatioServiceClient(); var stalker = ObjectHelpers.CreateUser("*****@*****.**"); var stalked = ObjectHelpers.CreateUser("*****@*****.**"); client.AddUser(stalker); client.AddUser(stalked); stalker = client.FindUserByEmail(stalker.Email); stalked = client.FindUserByEmail(stalked.Email); //stalker.StalkedPeople.Add(stalked); //client.UpdateUser(stalker); client.StalkUser(stalker.UserId, stalked.UserId); stalker = client.FindUserByEmail(stalker.Email); stalked = client.FindUserByEmail(stalked.Email); Assert.IsTrue(stalker.StalkedPeople.Count > 0); Assert.IsTrue(stalked.Stalkers.Count > 0); CleanUp(stalker, client); CleanUp(client.FindUserById(stalked.UserId), client); }
public void ServiceReportEvent() { CongregatioServiceClient client = new CongregatioServiceClient(); var user = ObjectHelpers.CreateUser("*****@*****.**"); var @event = ObjectHelpers.CreateEvent(user); client.AddUser(user); client.AddEvent(@event); user = client.FindUserByEmail(user.Email); @event = client.GetEventByTitle(@event.EventTitle); client.ReportEvent(user.UserId,@event.Id, "ServiceReportTest"); var reports = client.FindReportsByEvent(@event.Id); Assert.IsTrue(reports.Any()); Assert.IsTrue(reports.FirstOrDefault().Reason.Equals("ServiceReportTest")); reports = client.FindReportsByUser(user.UserId); Assert.IsTrue(reports.Any()); Assert.IsTrue(reports.FirstOrDefault().Reason.Equals("ServiceReportTest")); var report = reports.FirstOrDefault(); CleanUp(client,report); }