private ReturnLastAddedListing ( ) : |
||
리턴 |
public void AddListingTest() { ManageController controller = new ManageController(); ListingModel listing = new ListingModel(); listing.Title = "Unit Test"; listing.StartDate = new DateTime(2016, 3, 20, 12, 00, 00); listing.EndDate = new DateTime(2016, 3, 21, 12, 00, 00); listing.Area = "History"; listing.Frequency = "Always"; listing.Description = "Unit testing!"; listing.HangoutUrl = "what.com"; listing.TeacherId = 5; listing.Open = false; //Testing the AddListing function controller.AddListing(listing); //Check that the listing was actually added to the database ListingModel lastAdded = controller.ReturnLastAddedListing(); Assert.IsTrue( listing.Title == lastAdded.Title && listing.StartDate == lastAdded.StartDate && listing.EndDate == lastAdded.EndDate && listing.Area == lastAdded.Area && listing.Frequency == lastAdded.Frequency && listing.Description == lastAdded.Description && listing.HangoutUrl == lastAdded.HangoutUrl && listing.TeacherId == lastAdded.TeacherId && listing.Open == lastAdded.Open ); }
public void DeleteListingTest() { ManageController controller = new ManageController(); //Deleting the listing added in the previous test ListingModel listing = controller.ReturnLastAddedListing(); //Check that the DeleteListing function completed successfully Assert.AreEqual(controller.DeleteListing(listing),"Listing Deleted"); //Check that the listing was actually deleted from the database ListingModel lastAdded = controller.ReturnLastAddedListing(); Assert.IsFalse( listing.Title == lastAdded.Title && listing.StartDate == lastAdded.StartDate && listing.EndDate == lastAdded.EndDate && listing.Area == lastAdded.Area && listing.Frequency == lastAdded.Frequency && listing.Description == lastAdded.Description && listing.HangoutUrl == lastAdded.HangoutUrl && listing.TeacherId == lastAdded.TeacherId && listing.Open == lastAdded.Open); }
public void UpdateListingTest() { ManageController controller = new ManageController(); ListingModel listingModel = controller.ReturnLastAddedListing(); ListingInfo listing = new ListingInfo(); listing.Id = listingModel.Id; listing.Title = "Unit Test (Updated)"; listing.StartDate = listingModel.StartDate; listing.EndDate = listingModel.EndDate; listing.Area = listingModel.Area; listing.Frequency = listingModel.Frequency; listing.Description = "Unit testing... again!"; listing.HangoutUrl = listingModel.HangoutUrl; listing.TeacherId = listingModel.TeacherId; listing.Open = listingModel.Open; listing.Teacher = "*****@*****.**"; //Check that the UpdateListing function completed successfully Assert.AreEqual(controller.UpdateListing(listing), "Listing Updated"); //Check that the listing was actually updated in the database ListingModel lastAdded = controller.ReturnLastAddedListing(); Assert.IsTrue( listing.Title == lastAdded.Title && listing.StartDate == lastAdded.StartDate && listing.EndDate == lastAdded.EndDate && listing.Area == lastAdded.Area && listing.Frequency == lastAdded.Frequency && listing.Description == lastAdded.Description && listing.HangoutUrl == lastAdded.HangoutUrl && listing.TeacherId == lastAdded.TeacherId && listing.Open == lastAdded.Open); }