public void Find_FindAttractionInDatabase_Attraction() { //Arrange Attraction testAttraction = new Attraction("testName", 1); testAttraction.Save(); //Act Attraction resultById = Attraction.Find(testAttraction.GetId()); //Assert Assert.AreEqual(testAttraction, resultById); }
public void Delete_DeleteAttractionFromDatabase_Attraction() { // Arrange Attraction testAttraction = new Attraction("testName", 1, "testDescription"); testAttraction.Save(); // Act testAttraction.Delete(); // Assert Assert.AreEqual(0, Attraction.Find(testAttraction.GetId()).GetId()); }
public void EditDescription_ChangeAttractionDescriptionInDatabase_Attraction() { // Arrange Attraction testAttraction = new Attraction("testAttraction", 1, "testDescription"); testAttraction.Save(); string testDescription = "testDescription2"; // Act testAttraction.EditDescription(testDescription); // Assert Assert.AreEqual(testDescription, Attraction.Find(testAttraction.GetId()).GetDescription()); }
public void Save_AssignsIdToObject_Id() { //Arrange Attraction testAttraction = new Attraction("testName", 1); //Act testAttraction.Save(); Attraction savedAttraction = Attraction.GetAll()[0]; int result = savedAttraction.GetId(); int testId = testAttraction.GetId(); //Assert Assert.AreEqual(testId, result); }
public void GetTest_ReturnDataField() { // Arrange int id = 1; string name = "testAttraction"; int cityId = 1; string description = ""; Attraction testAttraction = new Attraction(name, cityId, description, id); // Act int resultId = testAttraction.GetId(); string resultName = testAttraction.GetName(); int resultCityId = testAttraction.GetCityId(); string resultDescription = testAttraction.GetDescription(); // Assert Assert.AreEqual(id, resultId); Assert.AreEqual(name, resultName); Assert.AreEqual(cityId, resultCityId); Assert.AreEqual(description, resultDescription); }