Ejemplo n.º 1
0
 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();
 }
Ejemplo n.º 2
0
        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);
        }
Ejemplo n.º 3
0
        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);
        }
Ejemplo n.º 4
0
        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);
        }
Ejemplo n.º 6
0
        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();
        }
Ejemplo n.º 9
0
        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);
        }
Ejemplo n.º 10
0
        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());
        }
Ejemplo n.º 12
0
        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);
        }
Ejemplo n.º 14
0
        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);
        }
Ejemplo n.º 16
0
        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);
        }
Ejemplo n.º 17
0
        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();
        }
Ejemplo n.º 18
0
        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);
        }
Ejemplo n.º 19
0
        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);
        }
Ejemplo n.º 20
0
        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.");
        }
Ejemplo n.º 21
0
 public SystemUnderTest(IFakeRepository repository)
 {
     _repository = repository;
 }
Ejemplo n.º 22
0
 public RepositoryProxyTest()
 {
     customImplementationMock = new Mock <IFakeRepository>();
     repositoryFactory        = new FakeRepositoryFactory(customImplementationMock.Object);
     fakeRepository           = repositoryFactory.GetRepository <IFakeRepository>();
 }
Ejemplo n.º 23
0
 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);
 }