コード例 #1
0
        public void RoomPricesDetailsNotFound()
        {
            RoomPricesController controller = new RoomPricesController();
            var result = (HttpStatusCodeResult)controller.Details(-1);
            Assert.AreEqual(404, result.StatusCode);
            Assert.IsInstanceOfType(result, typeof(HttpStatusCodeResult));

        }
コード例 #2
0
        public void RoomPricesIndex()
        {
            RoomPricesController controller = new RoomPricesController();

            var result = controller.Index();
            Assert.IsInstanceOfType(result, typeof(ViewResult));

        }
コード例 #3
0
        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));


       

        }
コード例 #4
0
        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);

        }
コード例 #5
0
        public void RoomPricesDeleteNull()
        {
            RoomPricesController controller = new RoomPricesController();
            var result = (HttpStatusCodeResult)controller.Delete(null);
            Assert.AreEqual(400, result.StatusCode);
            Assert.IsInstanceOfType(result, typeof(HttpStatusCodeResult));

        }
コード例 #6
0
        public void RoomPricesDelete()
        {
            RoomPricesController controller = new RoomPricesController();
            var result = controller.Delete(1);
            Assert.IsNotNull(result);

        }