Example #1
0
        public void AllCars_WhenValidParametersArePased_ShouldReturnCorerectViewResultName()
        {
            // Arrange
            var autoMapperConfig = new AutoMapperConfig();

            autoMapperConfig.Execute(typeof(OffersController).Assembly);

            var carOffer = new CarOffer();

            var carOffersServiceMock = new Mock <ICarOffersService>();

            carOffersServiceMock.Setup(x => x.GetAll())
            .Returns(() => new List <CarOffer> {
                carOffer
            }.AsQueryable());

            var userServiceMock = new Mock <IUserService>();
            OffersController offersController = new OffersController(carOffersServiceMock.Object, userServiceMock.Object);

            // Act
            ViewResult result = offersController.AllCars() as ViewResult;

            // Assert
            Assert.AreEqual(string.Empty, result.ViewName);
        }