Esempio n. 1
0
        public async void Create()
        {
            Mock <ILogger <PipelineStepDestinationRepository> > loggerMoc = PipelineStepDestinationRepositoryMoc.GetLoggerMoc();
            ApplicationDbContext context = PipelineStepDestinationRepositoryMoc.GetContext();
            var repository = new PipelineStepDestinationRepository(loggerMoc.Object, context);

            var entity = new PipelineStepDestination();

            entity.SetProperties(default(int), 1, 1);
            await repository.Create(entity);

            var records = await context.Set <PipelineStepDestination>().ToListAsync();

            records.Count.Should().Be(2);
        }
Esempio n. 2
0
        public async void Get()
        {
            Mock <ILogger <PipelineStepDestinationRepository> > loggerMoc = PipelineStepDestinationRepositoryMoc.GetLoggerMoc();
            ApplicationDbContext context = PipelineStepDestinationRepositoryMoc.GetContext();
            var repository = new PipelineStepDestinationRepository(loggerMoc.Object, context);

            PipelineStepDestination entity = new PipelineStepDestination();

            entity.SetProperties(default(int), 1, 1);
            context.Set <PipelineStepDestination>().Add(entity);
            await context.SaveChangesAsync();

            var record = await repository.Get(entity.Id);

            record.Should().NotBeNull();
        }
Esempio n. 3
0
        public async void Update_Entity_Is_Not_Tracked()
        {
            Mock <ILogger <PipelineStepDestinationRepository> > loggerMoc = PipelineStepDestinationRepositoryMoc.GetLoggerMoc();
            ApplicationDbContext context = PipelineStepDestinationRepositoryMoc.GetContext();
            var repository = new PipelineStepDestinationRepository(loggerMoc.Object, context);
            PipelineStepDestination entity = new PipelineStepDestination();

            entity.SetProperties(default(int), 1, 1);
            context.Set <PipelineStepDestination>().Add(entity);
            await context.SaveChangesAsync();

            context.Entry(entity).State = EntityState.Detached;

            await repository.Update(entity);

            var records = await context.Set <PipelineStepDestination>().ToListAsync();

            records.Count.Should().Be(2);
        }
Esempio n. 4
0
        public virtual async Task Migrate()
        {
            var airlineItem1 = new Airline();

            airlineItem1.SetProperties(1, "A");
            this.Context.Airlines.Add(airlineItem1);

            var airTransportItem1 = new AirTransport();

            airTransportItem1.SetProperties(1, 1, "A", 1, DateTime.Parse("1/1/1987 12:00:00 AM"), 1, DateTime.Parse("1/1/1987 12:00:00 AM"));
            this.Context.AirTransports.Add(airTransportItem1);

            var breedItem1 = new Breed();

            breedItem1.SetProperties(1, "A", 1);
            this.Context.Breeds.Add(breedItem1);

            var countryItem1 = new Country();

            countryItem1.SetProperties(1, "A");
            this.Context.Countries.Add(countryItem1);

            var countryRequirementItem1 = new CountryRequirement();

            countryRequirementItem1.SetProperties(1, 1, "A");
            this.Context.CountryRequirements.Add(countryRequirementItem1);

            var customerItem1 = new Customer();

            customerItem1.SetProperties(1, "A", "A", "A", "A", "A");
            this.Context.Customers.Add(customerItem1);

            var customerCommunicationItem1 = new CustomerCommunication();

            customerCommunicationItem1.SetProperties(1, 1, DateTime.Parse("1/1/1987 12:00:00 AM"), 1, "A");
            this.Context.CustomerCommunications.Add(customerCommunicationItem1);

            var destinationItem1 = new Destination();

            destinationItem1.SetProperties(1, 1, "A", 1);
            this.Context.Destinations.Add(destinationItem1);

            var employeeItem1 = new Employee();

            employeeItem1.SetProperties(1, "A", true, true, "A");
            this.Context.Employees.Add(employeeItem1);

            var handlerItem1 = new Handler();

            handlerItem1.SetProperties(1, 1, "A", "A", "A", "A");
            this.Context.Handlers.Add(handlerItem1);

            var handlerPipelineStepItem1 = new HandlerPipelineStep();

            handlerPipelineStepItem1.SetProperties(1, 1, 1);
            this.Context.HandlerPipelineSteps.Add(handlerPipelineStepItem1);

            var otherTransportItem1 = new OtherTransport();

            otherTransportItem1.SetProperties(1, 1, 1);
            this.Context.OtherTransports.Add(otherTransportItem1);

            var petItem1 = new Pet();

            petItem1.SetProperties(1, 1, 1, "A", 1);
            this.Context.Pets.Add(petItem1);

            var pipelineItem1 = new Pipeline();

            pipelineItem1.SetProperties(1, 1, 1);
            this.Context.Pipelines.Add(pipelineItem1);

            var pipelineStatusItem1 = new PipelineStatus();

            pipelineStatusItem1.SetProperties(1, "A");
            this.Context.PipelineStatus.Add(pipelineStatusItem1);

            var pipelineStepItem1 = new PipelineStep();

            pipelineStepItem1.SetProperties(1, "A", 1, 1);
            this.Context.PipelineSteps.Add(pipelineStepItem1);

            var pipelineStepDestinationItem1 = new PipelineStepDestination();

            pipelineStepDestinationItem1.SetProperties(1, 1, 1);
            this.Context.PipelineStepDestinations.Add(pipelineStepDestinationItem1);

            var pipelineStepNoteItem1 = new PipelineStepNote();

            pipelineStepNoteItem1.SetProperties(1, 1, "A", 1);
            this.Context.PipelineStepNotes.Add(pipelineStepNoteItem1);

            var pipelineStepStatusItem1 = new PipelineStepStatus();

            pipelineStepStatusItem1.SetProperties(1, "A");
            this.Context.PipelineStepStatus.Add(pipelineStepStatusItem1);

            var pipelineStepStepRequirementItem1 = new PipelineStepStepRequirement();

            pipelineStepStepRequirementItem1.SetProperties(1, "A", 1, true);
            this.Context.PipelineStepStepRequirements.Add(pipelineStepStepRequirementItem1);

            var saleItem1 = new Sale();

            saleItem1.SetProperties(1, 1m, 1, "A", 1, DateTime.Parse("1/1/1987 12:00:00 AM"), 1);
            this.Context.Sales.Add(saleItem1);

            var speciesItem1 = new Species();

            speciesItem1.SetProperties(1, "A");
            this.Context.Species.Add(speciesItem1);

            await this.Context.SaveChangesAsync();
        }