Example #1
0
        public void CreateBooking_ThrowsError_InternalServerError()
        {
            //Arrange
            var excpetion = new ConnApsDomain.Exceptions.InternalException();

            facade.Setup(f => f.CancelBooking("3445", model.FacilityId, model.BookingId)).Throws(excpetion);
            var controller = new BookingController(facade.Object)
            {
                ControllerContext = controllerContext
            };

            //Act
            var result = controller.CancelBooking(model);

            //Assert
            Assert.NotNull(result);
            Assert.IsType <InternalServerErrorResult>(result);
        }
Example #2
0
        public void FetchBuildingInfo_ThrowsError_InternalServerError()
        {
            //Arrange
            var excpetion = new ConnApsDomain.Exceptions.InternalException();

            facade.Setup(f => f.FetchBuilding("3445")).Throws(excpetion);

            var controller = new BuildingController(facade.Object)
            {
                ControllerContext = controllerContext
            };

            //Act
            var result = controller.FetchBuildingInfo();

            //Assert
            Assert.NotNull(result);
            Assert.IsType <InternalServerErrorResult>(result);
        }
Example #3
0
        public void UpdateApartment_ThrowsError_InternalError()
        {
            //Arrange
            var exception = new ConnApsDomain.Exceptions.InternalException();

            facade.Setup(f => f.UpdateApartment(model.Id, model.Level, model.Number, model.TenantsAllowed, model.FacingDirection, "3445")).Throws(exception);

            var controller = new ApartmentController(facade.Object)
            {
                ControllerContext = controllerContext
            };

            //Act
            var result = controller.UpdateApartment(model);

            //Assert
            Assert.NotNull(result);

            Assert.IsType <InternalServerErrorResult>(result);
        }
Example #4
0
        public void UpdateFacility_ThrowsError_InternalError()
        {
            //Arrange
            var exception = new ConnApsDomain.Exceptions.InternalException();

            facade.Setup(f => f.UpdateFacility("3445", model.Id, model.Level, model.Number)).Throws(exception);

            var controller = new FacilityController(facade.Object)
            {
                ControllerContext = controllerContext
            };

            //Act
            var result = controller.UpdateFacility(model);

            //Assert
            Assert.NotNull(result);

            Assert.IsType <InternalServerErrorResult>(result);
        }
        public void UpdateTenant_ThrowsError_InternalError()
        {
            //Arrange
            var exception = new ConnApsDomain.Exceptions.InternalException();

            facade.Setup(f => f.UpdatePerson(model.FirstName, model.LastName, model.DoB, model.Phone, "3445")).Throws(exception);

            var controller = new AccountController(facade.Object)
            {
                ControllerContext = controllerContext
            };

            //Act
            var result = controller.EditAccount(model);

            //Assert
            Assert.NotNull(result);

            Assert.IsType <InternalServerErrorResult>(result);
        }
        public void ChangeApartment_ThrowsError_InternalError()
        {
            //Arrange
            var exception = new ConnApsDomain.Exceptions.InternalException();

            facade.Setup(f => f.ChangeApartment(model.UserId, model.ApartmentId)).Throws(exception);

            var controller = new TenantController(facade.Object)
            {
                ControllerContext = controllerContext
            };

            //Act
            var result = controller.ChangeApartment(model);

            //Assert
            Assert.NotNull(result);

            Assert.IsType <InternalServerErrorResult>(result);
        }
Example #7
0
        public void UpdateBuilding_ThrowsError_InternalServerError()
        {
            //Arrange
            var excpetion = new ConnApsDomain.Exceptions.InternalException();

            facade.Setup(f => f.UpdateBuilding("3445", model.BuildingName, model.Address)).Throws(excpetion);

            var controller = new BuildingController(facade.Object)
            {
                ControllerContext = controllerContext
            };

            //Act
            var result = controller.UpdateBuilding(model);

            //Assert
            Assert.NotNull(result);

            Assert.IsType <InternalServerErrorResult>(result);
        }
        public void FetchBuildingManagers_ThrowsError_InternalError()
        {
            //Arrange
            var exception = new ConnApsDomain.Exceptions.InternalException();

            facade.Setup(f => f.UpdateBuildingManager(model.UserId, model.FirstName, model.LastName, model.DateOfBirth, model.Phone)).Throws(exception);

            var controller = new BuildingManagerController(facade.Object)
            {
                ControllerContext = controllerContext
            };

            //Act
            var result = controller.UpdateBuildingManager(model);

            //Assert
            Assert.NotNull(result);

            Assert.IsType <InternalServerErrorResult>(result);
        }