コード例 #1
0
        public void DeleteCarsShould_ReturnJSON_WithModelParameter()
        {
            //Arrange
            var carsService = new Mock <ICarsService>();
            var mapProvider = new Mock <IMapProvider>();
            var sut         = new CarsGridController(carsService.Object, mapProvider.Object);

            var description = "Description";
            var model       = new CarViewModel()
            {
                Description = description
            };

            //Act
            var result = sut.DeleteCar(model) as JsonResult;

            var data = result.Data as IList <CarViewModel>;
        }
コード例 #2
0
        public void DeleteCarsShould_CallServiceMethodDelete()
        {
            //Arrange
            var carsService = new Mock <ICarsService>();
            var mapProvider = new Mock <IMapProvider>();
            var sut         = new CarsGridController(carsService.Object, mapProvider.Object);

            var description = "Description";
            var model       = new CarViewModel()
            {
                Description = description
            };

            //Act
            sut.DeleteCar(model);

            //Assert
            carsService.Verify(c => c.Delete(null), Times.Once);
        }