public void Show(List <CarRating> rc, RentCarController ctrl) { _ctrl = ctrl; ShowProfit(); ShowRating(); excelapp.Visible = true; }
public void GetCar_ShouldNotFindCar() { var controller = new RentCarController(GetTestCars()); var result = controller.GetCar(999); Assert.IsInstanceOfType(result, typeof(NotFoundResult)); }
public async Task GetAllCarsAsync_ShouldReturnAllCars() { var testCars = GetTestCars(); var controller = new RentCarController(testCars); var result = await controller.GetAllCarsAsync() as List <Car>; Assert.AreEqual(testCars.Count, result.Count); }
public void GetAllCars_ShouldReturnAllCars() { var testCars = GetTestCars(); var controller = new RentCarController(testCars); var result = controller.GetAllCars() as List <Car>; Assert.AreEqual(testCars.Count, result.Count); }
public Cars(RentCarController ctrl, Form1 parent) { this.ctrl = ctrl; this.parent = parent; InitializeComponent(); label1.TextAlign = ContentAlignment.MiddleCenter; cars = ctrl.GetCars(); comboBox1.Text = "Цена"; radioButton1.Checked = true; }
public async Task GetCarAsync_ShouldReturnCorrectCar() { var testCars = GetTestCars(); var controller = new RentCarController(testCars); var result = await controller.GetCarAsync(1) as OkNegotiatedContentResult <Car>; Assert.IsNotNull(result); Assert.AreEqual(testCars[0].Make, result.Content.Make); }
public void GetCar_ShouldReturnCorrectCar() { var testCars = GetTestCars(); var controller = new RentCarController(testCars); var result = controller.GetCar(4) as OkNegotiatedContentResult <Car>; Assert.IsNotNull(result); Assert.AreEqual(testCars[3].Make, result.Content.Make); }
public RentCarControllerUnitTest() { //Arrange _autoMocker = new AutoMocker(); _rentCarService = _autoMocker.GetMock <IRentCarService>(); _mapper = _autoMocker.GetMock <IMapper>(); _controller = _autoMocker.CreateInstance <RentCarController>(); _rentCarService.Setup(x => x.RentCar(It.IsAny <RentCarRequestDto>(), CancellationToken.None)).ReturnsAsync(new RentCarResponseDto { Id = 1 }); _rentCarService.Setup(x => x.RentCar(null, CancellationToken.None)).ReturnsAsync((RentCarResponseDto)null); _rentCarService.Setup(x => x.CancelRentCar(1, CancellationToken.None)).ReturnsAsync(new CancelRentCarResponseDto { User = "******", Car = "passat", DateStart = new DateTime(2018, 1, 1), DateEnd = new DateTime(2018, 1, 3) }); }