public void Edit_UpdatesInviteeToDatabase() { //Arrange string inviteeName = "Jane Doe"; string inviteeEmailAddress = "*****@*****.**"; Invitee newInvitee = new Invitee(inviteeName, inviteeEmailAddress); newInvitee.Save(); //Act Invitee foundInvitee = Invitee.Find(newInvitee.GetId()); string newInviteeName = "John Smith"; string newInviteeEmailAddress = "*****@*****.**"; foundInvitee.Edit(newInviteeName, newInviteeEmailAddress); Invitee updatedInvitee = Invitee.Find(newInvitee.GetId()); List <Invitee> result = Invitee.GetAll(); List <Invitee> testList = new List <Invitee> { updatedInvitee }; //Assert CollectionAssert.AreEqual(testList, result); }
public void Delete_DeletesEventInviteeFromDatabase() { //Arrange string eventName = "July 4th BBQ"; DateTime eventDate = new DateTime(2019, 07, 04); string eventLocation = "Capitol Hill"; int menusId = 1; Event newEvent = new Event(eventName, eventDate, eventLocation, menusId); newEvent.Save(); string inviteeName = "Jane Doe"; string inviteeEmailAddress = "*****@*****.**"; Invitee newInvitee = new Invitee(inviteeName, inviteeEmailAddress); newInvitee.Save(); //Act Event foundEvent = Event.Find(newEvent.GetId()); Invitee foundInvitee = Invitee.Find(newInvitee.GetId()); foundInvitee.AddEvent(foundEvent); List <Event> result = foundInvitee.GetEvents(); foundInvitee.DeleteEvent(foundEvent); List <Event> testList = foundInvitee.GetEvents(); //Assert CollectionAssert.AreNotEqual(testList, result); }
public void Save_SavesEventInviteeToDatabase_InviteeList() { //Arrange string eventName = "July 4th BBQ"; DateTime eventDate = new DateTime(2019, 04, 04); string eventLocation = "Capitol Hill"; int menusId = 1; Event newEvent = new Event(eventName, eventDate, eventLocation, menusId); newEvent.Save(); string inviteeName = "Jane Doe"; string inviteeEmailAddress = "*****@*****.**"; Invitee newInvitee = new Invitee(inviteeName, inviteeEmailAddress); newInvitee.Save(); //Act Event foundEvent = Event.Find(newEvent.GetId()); Invitee foundInvitee = Invitee.Find(newInvitee.GetId()); foundEvent.AddInvitee(foundInvitee); List <Invitee> result = newEvent.GetInvitees(); List <Invitee> testList = new List <Invitee> { foundInvitee }; //Assert CollectionAssert.AreEqual(testList, result); }
public void AddEvent_AddInstanceOfEventForInvitee_True() { _invitee.Save(); ActionResult showPost = _controller.AddEvent(_invitee.GetId(), 0); Assert.IsInstanceOfType(showPost, typeof(ActionResult)); }
public void GetId_ReturnsInviteeId_Int() { //Arrange string inviteeName = "Jane Doe"; string inviteeEmailAddress = "*****@*****.**"; Invitee newInvitee = new Invitee(inviteeName, inviteeEmailAddress); //Act int result = newInvitee.GetId(); //Assert Assert.AreEqual(0, result); }
public void Find_ReturnsInviteeInDatabase_Invitee() { //Arrange string inviteeName = "Jane Doe"; string inviteeEmailAddress = "*****@*****.**"; Invitee newInvitee = new Invitee(inviteeName, inviteeEmailAddress); newInvitee.Save(); //Act Invitee foundInvitee = Invitee.Find(newInvitee.GetId()); //Assert Assert.AreEqual(newInvitee, foundInvitee); }
public void GetEvents_RetrievesAllEventsWithInvitee_EventList() { //Arrange string eventName1 = "July 4th BBQ"; DateTime eventDate1 = new DateTime(2019, 07, 04); string eventLocation1 = "Capitol Hill"; int menusId1 = 1; Event newEvent1 = new Event(eventName1, eventDate1, eventLocation1, menusId1); newEvent1.Save(); string eventName2 = "Birthday Party"; DateTime eventDate2 = new DateTime(2019, 05, 03); string eventLocation2 = "Saltys"; int menusId2 = 2; Event newEvent2 = new Event(eventName2, eventDate2, eventLocation2, menusId2); newEvent2.Save(); string inviteeName = "Jane Doe"; string inviteeEmailAddress = "*****@*****.**"; Invitee newInvitee = new Invitee(inviteeName, inviteeEmailAddress); newInvitee.Save(); //Act Event foundEvent1 = Event.Find(newEvent1.GetId()); Event foundEvent2 = Event.Find(newEvent2.GetId()); Invitee foundInvitee = Invitee.Find(newInvitee.GetId()); foundInvitee.AddEvent(foundEvent1); foundInvitee.AddEvent(foundEvent2); List <Event> newList = new List <Event> { newEvent1, newEvent2 }; List <Event> resultList = foundInvitee.GetEvents(); //Assert CollectionAssert.AreEqual(newList, resultList); }
public void GetInvitees_RetrievesAllInviteesWithEvent_InviteeList() { //Arrange string eventName = "July 4th BBQ"; DateTime eventDate = new DateTime(2019, 04, 04); string eventLocation = "Capitol Hill"; int menusId = 1; Event newEvent = new Event(eventName, eventDate, eventLocation, menusId); newEvent.Save(); string inviteeName1 = "Jane Doe"; string inviteeEmailAddress1 = "*****@*****.**"; Invitee newInvitee1 = new Invitee(inviteeName1, inviteeEmailAddress1); newInvitee1.Save(); string inviteeName2 = "John Smith"; string inviteeEmailAddress2 = "*****@*****.**"; Invitee newInvitee2 = new Invitee(inviteeName2, inviteeEmailAddress2); newInvitee2.Save(); //Act Event foundEvent = Event.Find(newEvent.GetId()); Invitee foundInvitee1 = Invitee.Find(newInvitee1.GetId()); Invitee foundInvitee2 = Invitee.Find(newInvitee2.GetId()); foundEvent.AddInvitee(foundInvitee1); foundEvent.AddInvitee(foundInvitee2); List <Invitee> newList = new List <Invitee> { newInvitee1, newInvitee2 }; //Act List <Invitee> resultList = foundEvent.GetInvitees(); //Assert CollectionAssert.AreEqual(newList, resultList); }