Esempio n. 1
0
        public async Task TestPutAircraftNotFoundResult()
        {
            // Arrange & Act

            var mockRepoAircraft = new Mock <IAircraftRepository>();
            var controller       = new AircraftController(mockRepoAircraft.Object);

            controller.ModelState.AddModelError("error", "some error");

            // Act
            var result = controller.Put(id: "0", model: null);

            // Assert
            Assert.IsType <NotFoundResult>(result);
        }
Esempio n. 2
0
        public async Task TestPutAircraftReturnsNotFoundResultId()
        {
            // Arrange
            String        testId        = "101";
            Aircraft      aircraft      = GetTestAircrafts()[0];
            AircraftModel aircraftmodel = GetTestAircraftsModels()[0];

            var mockRepoAircraft = new Mock <IAircraftRepository>();

            mockRepoAircraft.Setup(c => c.Update(aircraft));
            var controller = new AircraftController(mockRepoAircraft.Object);

            // Act
            var result = controller.Put(testId, aircraftmodel);

            // Assert
            Assert.IsType <NotFoundResult>(result);
        }