public void RoomPricesDetailsNotFound() { RoomPricesController controller = new RoomPricesController(); var result = (HttpStatusCodeResult)controller.Details(-1); Assert.AreEqual(404, result.StatusCode); Assert.IsInstanceOfType(result, typeof(HttpStatusCodeResult)); }
public void RoomPricesIndex() { RoomPricesController controller = new RoomPricesController(); var result = controller.Index(); Assert.IsInstanceOfType(result, typeof(ViewResult)); }
public void RoomPricesCreate() { RoomPricesController controller = new RoomPricesController(); RoomPrice roomPrice = new RoomPrice(); roomPrice.RoomTypeId = 1; roomPrice.StartDate = new DateTime(2015, 9, 17); roomPrice.EndDate = new DateTime(2015, 9, 25); roomPrice.SpecialPrice = 250; roomPrice.RoomPriceId = 0; roomPrice.AccomodationId = 1; var result = controller.Create(roomPrice); Assert.IsInstanceOfType(result, typeof(RedirectToRouteResult)); }
public void AccomodationsCreateInvalidInput() { RoomPricesController controller = new RoomPricesController(); RoomPrice roomPrice = new RoomPrice(); roomPrice.RoomTypeId = 1; roomPrice.StartDate = new DateTime(2015, 9, 17); roomPrice.EndDate = new DateTime(2015, 9, 25); roomPrice.SpecialPrice = -250; roomPrice.RoomPriceId = 0; roomPrice.AccomodationId = 1; var context = new ValidationContext(roomPrice, null, null); var results = new List<ValidationResult>(); TypeDescriptor.AddProviderTransparent(new AssociatedMetadataTypeTypeDescriptionProvider(typeof(RoomPrice), typeof(RoomPrice)), typeof(RoomPrice)); var isModelStateValid = Validator.TryValidateObject(roomPrice, context, results, true); Assert.AreEqual(false, isModelStateValid); }
public void RoomPricesDeleteNull() { RoomPricesController controller = new RoomPricesController(); var result = (HttpStatusCodeResult)controller.Delete(null); Assert.AreEqual(400, result.StatusCode); Assert.IsInstanceOfType(result, typeof(HttpStatusCodeResult)); }
public void RoomPricesDelete() { RoomPricesController controller = new RoomPricesController(); var result = controller.Delete(1); Assert.IsNotNull(result); }