ReturnLastAddedAssignment() 개인적인 메소드

private ReturnLastAddedAssignment ( ) : AssignedListing
리턴 iMentor.Models.AssignedListing
예제 #1
0
        public void AddParticipantTest()
        {
            ManageController controller = new ManageController();
            AssignedListing test = new AssignedListing();

            test.ListingId  = 1;
            test.UserId     = 5;

            //Check that the AddParticipant function completed successfully
            Assert.AreEqual(controller.AddParticipant(test), "Assignment Added");

            //Check that the assignment was actually added to the database
            AssignedListing lastAdded = controller.ReturnLastAddedAssignment();

            Assert.IsTrue(  lastAdded.ListingId == test.ListingId    &&
                            lastAdded.UserId    == test.UserId);
        }
예제 #2
0
        public void RemoveParticipantTest()
        {
            ManageController controller = new ManageController();

            //Deleting the assignment that was added in previous test
            AssignedListing test = controller.ReturnLastAddedAssignment();

            //Check that the RemoveParticipant function completed successfully
            Assert.AreEqual(controller.RemoveParticipant(test), "Assignment Removed");

            //Check that the assignment was actually deleted from the database
            AssignedListing lastAdded = controller.ReturnLastAddedAssignment();

            //*This assert may fail even though the assignment was removed
            Assert.IsFalse( lastAdded.ListingId == test.ListingId   &&
                            lastAdded.UserId    == test.UserId);
        }