public async virtual Task <PipelineStepStatus> Create(PipelineStepStatus item)
        {
            this.Context.Set <PipelineStepStatus>().Add(item);
            await this.Context.SaveChangesAsync();

            this.Context.Entry(item).State = EntityState.Detached;
            return(item);
        }
Exemple #2
0
        public async void Create()
        {
            Mock <ILogger <PipelineStepStatusRepository> > loggerMoc = PipelineStepStatusRepositoryMoc.GetLoggerMoc();
            ApplicationDbContext context = PipelineStepStatusRepositoryMoc.GetContext();
            var repository = new PipelineStepStatusRepository(loggerMoc.Object, context);

            var entity = new PipelineStepStatus();
            await repository.Create(entity);

            var record = await context.Set <PipelineStepStatus>().FirstOrDefaultAsync();

            record.Should().NotBeNull();
        }
        public async virtual Task Delete(
            int id)
        {
            PipelineStepStatus record = await this.GetById(id);

            if (record == null)
            {
                return;
            }
            else
            {
                this.Context.Set <PipelineStepStatus>().Remove(record);
                await this.Context.SaveChangesAsync();
            }
        }
        public async virtual Task Update(PipelineStepStatus item)
        {
            var entity = this.Context.Set <PipelineStepStatus>().Local.FirstOrDefault(x => x.Id == item.Id);

            if (entity == null)
            {
                this.Context.Set <PipelineStepStatus>().Attach(item);
            }
            else
            {
                this.Context.Entry(entity).CurrentValues.SetValues(item);
            }

            await this.Context.SaveChangesAsync();
        }
        public async void Create()
        {
            Mock <ILogger <PipelineStepStatusRepository> > loggerMoc = PipelineStepStatusRepositoryMoc.GetLoggerMoc();
            ApplicationDbContext context = PipelineStepStatusRepositoryMoc.GetContext();
            var repository = new PipelineStepStatusRepository(loggerMoc.Object, context);

            var entity = new PipelineStepStatus();

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

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

            records.Count.Should().Be(2);
        }
Exemple #6
0
        public async void Get()
        {
            Mock <ILogger <PipelineStepStatusRepository> > loggerMoc = PipelineStepStatusRepositoryMoc.GetLoggerMoc();
            ApplicationDbContext context = PipelineStepStatusRepositoryMoc.GetContext();
            var repository = new PipelineStepStatusRepository(loggerMoc.Object, context);

            PipelineStepStatus entity = new PipelineStepStatus();

            context.Set <PipelineStepStatus>().Add(entity);
            await context.SaveChangesAsync();

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

            record.Should().NotBeNull();
        }
Exemple #7
0
        public async void Delete()
        {
            Mock <ILogger <PipelineStepStatusRepository> > loggerMoc = PipelineStepStatusRepositoryMoc.GetLoggerMoc();
            ApplicationDbContext context = PipelineStepStatusRepositoryMoc.GetContext();
            var repository            = new PipelineStepStatusRepository(loggerMoc.Object, context);
            PipelineStepStatus entity = new PipelineStepStatus();

            context.Set <PipelineStepStatus>().Add(entity);
            await context.SaveChangesAsync();

            await repository.Delete(entity.Id);

            PipelineStepStatus modifiedRecord = await context.Set <PipelineStepStatus>().FirstOrDefaultAsync();

            modifiedRecord.Should().BeNull();
        }
Exemple #8
0
        public async void Update_Entity_Is_Not_Tracked()
        {
            Mock <ILogger <PipelineStepStatusRepository> > loggerMoc = PipelineStepStatusRepositoryMoc.GetLoggerMoc();
            ApplicationDbContext context = PipelineStepStatusRepositoryMoc.GetContext();
            var repository            = new PipelineStepStatusRepository(loggerMoc.Object, context);
            PipelineStepStatus entity = new PipelineStepStatus();

            context.Set <PipelineStepStatus>().Add(entity);
            await context.SaveChangesAsync();

            await repository.Update(new PipelineStepStatus());

            var modifiedRecord = context.Set <PipelineStepStatus>().FirstOrDefaultAsync();

            modifiedRecord.Should().NotBeNull();
        }
        public async void Update_Entity_Is_Not_Tracked()
        {
            Mock <ILogger <PipelineStepStatusRepository> > loggerMoc = PipelineStepStatusRepositoryMoc.GetLoggerMoc();
            ApplicationDbContext context = PipelineStepStatusRepositoryMoc.GetContext();
            var repository            = new PipelineStepStatusRepository(loggerMoc.Object, context);
            PipelineStepStatus entity = new PipelineStepStatus();

            entity.SetProperties(default(int), "B");
            context.Set <PipelineStepStatus>().Add(entity);
            await context.SaveChangesAsync();

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

            await repository.Update(entity);

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

            records.Count.Should().Be(2);
        }
Exemple #10
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();
        }
Exemple #11
0
 public void SetPipelineStepStatusIdNavigation(PipelineStepStatus item)
 {
     this.PipelineStepStatusIdNavigation = item;
 }