public VehicleTests() { filePath = "C:\\Users\\Neetha\\source\\repos\\DealerTrack\\ServerApp\\wwwroot\\uploads\\Dealertrack-CSV-Example.csv"; vehicles = new List <Vehicle>(); respository = new SimpleRepository(); dataAccess = new DataAccess(); }
public async Task Update_WhenCrewNull_ThenReturnExeption() { var Crews = new IFakeRepository <Crew>(); var context = new IFakeUnitOfFactory(); CrewDto CrewDto = null; CrewService service = new CrewService(context); CrewDto CrewDtoSaved = await service.Update(CrewDto); }
public async Task Update_WhenStewardessNull_ThenReturnExeption() { var Stewardesss = new IFakeRepository <Stewardess>(); var context = new IFakeUnitOfFactory(); StewardessDto StewardessDto = null; StewardessService service = new StewardessService(context); StewardessDto StewardessDtoSaved = await service.Update(StewardessDto); }
public async Task Update_WhenPilotNull_ThenReturnExeption() { var Pilots = new IFakeRepository <Pilot>(); var context = new IFakeUnitOfFactory(); PilotDto PilotDto = null; PilotService service = new PilotService(context); PilotDto PilotDtoSaved = await service.Update(PilotDto); }
public async Task Update_WhenFlightNull_ThenReturnExeption() { var Flights = new IFakeRepository <Flight>(); var context = new IFakeUnitOfFactory(); FlightDto FlightDto = null; FlightService service = new FlightService(context); FlightDto FlightDtoSaved = await service.Update(FlightDto); }
public async Task Update_WhenTicketNull_ThenReturnExeption() { var Tickets = new IFakeRepository <Ticket>(); var context = new IFakeUnitOfFactory(); TicketDto TicketDto = null; TicketService service = new TicketService(context); TicketDto TicketDtoSaved = await service.Update(TicketDto); }
public async Task Update_WhenTypeAircraftNull_ThenReturnExeption() { var TypeAircrafts = new IFakeRepository <TypeAircraft>(); var context = new IFakeUnitOfFactory(); TypeAircraftDto TypeAircraftDto = null; TypeAircraftService service = new TypeAircraftService(context); TypeAircraftDto TypeAircraftDtoSaved = await service.Update(TypeAircraftDto); }
public EntityFrameworkRepositoryTests() { var services = new ServiceCollection(); context = services.LoadInMemoryDatabase <FakeContext>(); repository = new FakeRepository(context); SeedDatabase(); }
public async Task Create_WhenAircraftNull_ThenReturnExeption() { var aircrafts = new IFakeRepository <Aircraft>(); var context = new IFakeUnitOfFactory(); AircraftDto aircraftDto = null; AircraftService service = new AircraftService(context); AircraftDto aircraftDtoSaved = await service.Create(aircraftDto); }
public MongoTests() { var services = new ServiceCollection(); const string connectionString = "mongodb://localhost/Database"; services.AddScoped(_ => new FakeContext(connectionString)); var context = services.BuildServiceProvider().GetService <FakeContext>(); _repository = new FakeRepository(context); }
public virtual IRepository <T> RegRepository <T>(IFakeRepository <T> repositoryWizard) where T : BaseEntity { if (repositoryWizard is null) { throw new ArgumentNullException(nameof(repositoryWizard)); } if (IsExistsRepo <T>()) { throw new ArgumentException($"{nameof(IRepository<T>)} already registered"); } _store.Add(typeof(T), repositoryWizard); return(repositoryWizard.GetRepository()); }
public async Task Update_WhenValidStewardess_ThenReturnStewardess() { var Stewardesss = new IFakeRepository <Stewardess>(); var context = new IFakeUnitOfFactory(); StewardessDto StewardessDto = new StewardessDto() { Id = 154, Name = "Nataly" }; StewardessService service = new StewardessService(context); StewardessDto StewardessDtoSaved = await service.Update(StewardessDto); Assert.AreEqual(StewardessDto.Name, StewardessDtoSaved.Name); Assert.AreEqual(StewardessDto.Id, StewardessDtoSaved.Id); }
public async Task Update_WhenValidFlight_ThenReturnFlight() { var Flights = new IFakeRepository <Flight>(); var context = new IFakeUnitOfFactory(); FlightDto flightDto = new FlightDto() { Id = 154, ArrivalPoint = "TEST", }; FlightService service = new FlightService(context); FlightDto FlightDtoSaved = await service.Update(flightDto); Assert.AreEqual(flightDto.ArrivalPoint, FlightDtoSaved.ArrivalPoint); Assert.AreEqual(flightDto.Id, FlightDtoSaved.Id); }
public async Task Update_WhenValidTicket_ThenReturnTicket() { var Tickets = new IFakeRepository <Ticket>(); var context = new IFakeUnitOfFactory(); TicketDto TicketDto = new TicketDto() { Id = 154, Price = 10 }; TicketService service = new TicketService(context); TicketDto TicketDtoSaved = await service.Update(TicketDto); Assert.AreEqual(TicketDto.Price, TicketDtoSaved.Price); Assert.AreEqual(TicketDto.Id, TicketDtoSaved.Id); }
public async Task Update_WhenValidTypeAircraft_ThenReturnTypeAircraft() { var TypeAircrafts = new IFakeRepository <TypeAircraft>(); var context = new IFakeUnitOfFactory(); TypeAircraftDto TypeAircraftDto = new TypeAircraftDto() { Id = 154, NumberPlaces = 100 }; TypeAircraftService service = new TypeAircraftService(context); TypeAircraftDto TypeAircraftDtoSaved = await service.Update(TypeAircraftDto); Assert.AreEqual(TypeAircraftDto.NumberPlaces, TypeAircraftDtoSaved.NumberPlaces); Assert.AreEqual(TypeAircraftDto.Id, TypeAircraftDtoSaved.Id); }
public async Task Update_WhenValidCrew_ThenReturnCrew() { var Crews = new IFakeRepository <Crew>(); var context = new IFakeUnitOfFactory(); CrewDto CrewDto = new CrewDto() { Id = 154, PilotId = 5, }; CrewService service = new CrewService(context); CrewDto CrewDtoSaved = await service.Update(CrewDto); Assert.AreEqual(CrewDto.PilotId, CrewDtoSaved.PilotId); Assert.AreEqual(CrewDto.Id, CrewDtoSaved.Id); }
public EntityFrameworkCoreTests() { var services = new ServiceCollection(); const string connectionString = "Server=(localdb)\\MSSQLLocalDB;Database=Tests;Integrated Security=true;Connection Timeout=5;"; services.AddDbContextPool <FakeContext>(options => options.UseSqlServer(connectionString)); _context = services.BuildServiceProvider().GetService <FakeContext>(); _context.Database.EnsureDeleted(); _context.Database.EnsureCreated(); _context.Database.Migrate(); _repository = new FakeRepository(_context); SeedDatabase(); }
public async Task Update_WhenValidPilot_ThenReturnPilot() { var Pilots = new IFakeRepository <Pilot>(); var context = new IFakeUnitOfFactory(); PilotDto PilotDto = new PilotDto() { Id = 154, Name = "Nataly" }; PilotService service = new PilotService(context); PilotDto PilotDtoSaved = await service.Update(PilotDto); Assert.AreEqual(PilotDto.Name, PilotDtoSaved.Name); Assert.AreEqual(PilotDto.Id, PilotDtoSaved.Id); }
public async Task Update_WhenValidAircraft_ThenReturnAircraft() { var aircrafts = new IFakeRepository <Aircraft>(); var context = new IFakeUnitOfFactory(); AircraftDto aircraftDto = new AircraftDto() { Id = 154, AircraftName = "Test", TypeAircraftId = 165 }; AircraftService service = new AircraftService(context); AircraftDto aircraftDtoSaved = await service.Update(aircraftDto); Assert.AreEqual(aircraftDto.AircraftName, aircraftDtoSaved.AircraftName); Assert.AreEqual(aircraftDto.Id, aircraftDtoSaved.Id); Assert.AreEqual(aircraftDto.TypeAircraftId, aircraftDtoSaved.TypeAircraftId); }
public void RequestNonExistRepositoryReturnException() { var factory = RepositoryFactory.Instance; try { IFakeRepository fakeRepository = factory.Create <IFakeRepository>(); } catch (RepositoryNotExistException) { Assert.Pass(); } catch (Exception ex) { Assert.Fail("Unexpected Exception returned. Exception: {1}", ex.Message); } Assert.Fail("RepositionNotExistException was expected."); }
public SystemUnderTest(IFakeRepository repository) { _repository = repository; }
public RepositoryProxyTest() { customImplementationMock = new Mock <IFakeRepository>(); repositoryFactory = new FakeRepositoryFactory(customImplementationMock.Object); fakeRepository = repositoryFactory.GetRepository <IFakeRepository>(); }
public AccountService(IAccountCreator creator, IFakeRepository repository) { this.creator = creator ?? throw new ArgumentNullException($"Argument {nameof(creator)} is null"); this.repository = repository ?? throw new ArgumentNullException($"Argument {nameof(repository)} is null"); }
public RepositoryMetadataTest() { fakeRepositoryMock = new Mock <IFakeRepository>(); fakeRepository = RepositoryProxy.Create <IFakeRepository>(() => fakeRepositoryMock.Object); }