private void CleanUp(CongregatioServiceClient client, Report report) { var user = report.ReportedBy; var @event = report.ReportedEvent; client.RemoveReport(report); client.RemoveEvent(@event); user = client.FindUserById(user.UserId); client.RemoveUser(user); }
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 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 SuggestedEventsTest() { CongregatioServiceClient client = new CongregatioServiceClient(); var stalked = ObjectHelpers.CreateUser("*****@*****.**"); var stalker = ObjectHelpers.CreateUser("*****@*****.**"); var stalkedHostedEvent = ObjectHelpers.CreateEvent(stalked); client.AddUser(stalked); client.AddUser(stalker); client.AddEvent(stalkedHostedEvent); stalkedHostedEvent = client.GetEventByTitle(stalkedHostedEvent.EventTitle); client.StalkUser(stalker.UserId, stalked.UserId); stalked = client.FindUserById(stalked.UserId); stalker = client.FindUserById(stalker.UserId); var events = client.SuggestedEvents(stalker.UserId); Assert.IsTrue(events.Count > 0); Assert.IsTrue(events[0].EventTitle.Equals(stalkedHostedEvent.EventTitle)); CleanUp(client, stalker, stalkedHostedEvent); }
private void CleanUp(CongregatioServiceClient client, Event @event, User attendee) { var user = @event.User; @event.Attendees = new List<User>(); client.UpdateEvent(@event); attendee.AttendedEvents = new List<Event>(); client.UpdateUser(attendee); @event = client.GetEventByIdLong(@event.Id); attendee = client.FindUserById(attendee.UserId); client.RemoveUser(attendee); client.RemoveEvent(@event); user = client.FindUserById(user.UserId); client.RemoveUser(user); }