public void Test_UpdatePassenger()
        {
            // Arrange
            var model = JsonConvert.DeserializeObject <TestingAssignment.Models.Passenger>(File.ReadAllText("Data/UpdateUser.json"));

            // Act
            var resultObj = mockDataRepository.Setup(x => x.Update(model)).Returns(model);
            var response  = _passengerController.Put(model);

            // Assert
            Assert.AreEqual(model, response);
        }
示例#2
0
        public void UpdatePassengerTestPass()
        {
            //Arrange
            var passenger = new Passenger();

            passenger.Id        = 1;
            passenger.FirstName = "iPrince";
            passenger.LastName  = "Makwana";
            passenger.ContactNo = 9426;
            var res = mockData.Setup(x => x.UpdatePassenger(passenger)).Returns("Successfully updated");

            //Act
            var result = _passengerController.Put(passenger);

            //Assert
            //Assert.Equal("Successfully updated", result);
            //Assert.IsType<OkResult>(result);

            NegotiatedContentResult <Passenger> negResult = Assert.IsType <NegotiatedContentResult <Passenger> >(result);

            Assert.Equal(HttpStatusCode.Accepted, negResult.StatusCode);
        }