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

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

            var carOffer = new CarOffer();
            var guid     = Guid.NewGuid();

            var userServiceMock      = new Mock <IUserService>();
            var carOffersServiceMock = new Mock <ICarOffersService>();

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

            carOffersServiceMock.Setup(x => x.Delete(carOffer));

            OffersController offersController = new OffersController(carOffersServiceMock.Object, userServiceMock.Object);

            // Act
            ViewResult result = offersController.DeleteOffer(guid) as ViewResult;

            // Assert
            Assert.IsNull(result);
        }