Example #1
0
        public async void All_ShouldReturnRecords()
        {
            var mock    = new ServiceMockFacade <IVehicleService, IVehicleRepository>();
            var records = new List <Vehicle>();

            records.Add(new Vehicle());
            mock.RepositoryMock.Setup(x => x.All(It.IsAny <int>(), It.IsAny <int>(), It.IsAny <string>())).Returns(Task.FromResult(records));
            var service = new VehicleService(mock.LoggerMock.Object,
                                             mock.MediatorMock.Object,
                                             mock.RepositoryMock.Object,
                                             mock.ModelValidatorMockFactory.VehicleModelValidatorMock.Object,
                                             mock.DALMapperMockFactory.DALVehicleMapperMock,
                                             mock.DALMapperMockFactory.DALVehicleCapabilitiesMapperMock,
                                             mock.DALMapperMockFactory.DALVehicleOfficerMapperMock);

            List <ApiVehicleServerResponseModel> response = await service.All();

            response.Should().HaveCount(1);
            mock.RepositoryMock.Verify(x => x.All(It.IsAny <int>(), It.IsAny <int>(), It.IsAny <string>()));
        }