Exemplo n.º 1
0
        public void DeleteEnginePower_ExistingEnginePower_StatusOk()
        {
            //Arrange
            var controller = new EnginePowerController(_enginePowerService, _mapper, _log);

            //Act
            var result = controller.DeleteEnginePower(1);

            //Asserts
            result.Should().BeOfType <OkResult>();
            _enginePowerService.Received(1).DeleteEnginePower(Arg.Is <EnginePower>(x => x == _enginePower));
            _enginePowerService.Received(1).SaveChanges();
            _log.Received(1).Save(Arg.Any <string>(), "Usunięto rodzaj paliwa", nameof(EnginePowerController));
        }
Exemplo n.º 2
0
        public void DeleteEnginePower_NonexistentEnginePower_StatusNotFound()
        {
            //Arrange
            var controller = new EnginePowerController(_enginePowerService, _mapper, _log);

            //Act
            var result = controller.DeleteEnginePower(2);

            //Asserts
            result.Should().BeOfType <NotFoundResult>();
            _enginePowerService.DidNotReceive().DeleteEnginePower(Arg.Any <EnginePower>());
            _enginePowerService.DidNotReceive().SaveChanges();
            _log.DidNotReceive().Save(Arg.Any <string>(), Arg.Any <string>(), nameof(EnginePowerController));
        }