Ejemplo n.º 1
0
        public async void Create()
        {
            Mock <ILogger <DeploymentProcessRepository> > loggerMoc = DeploymentProcessRepositoryMoc.GetLoggerMoc();
            ApplicationDbContext context = DeploymentProcessRepositoryMoc.GetContext();
            var repository = new DeploymentProcessRepository(loggerMoc.Object, context);

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

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

            record.Should().NotBeNull();
        }
Ejemplo n.º 2
0
        public async void Get()
        {
            Mock <ILogger <DeploymentProcessRepository> > loggerMoc = DeploymentProcessRepositoryMoc.GetLoggerMoc();
            ApplicationDbContext context = DeploymentProcessRepositoryMoc.GetContext();
            var repository = new DeploymentProcessRepository(loggerMoc.Object, context);

            DeploymentProcess entity = new DeploymentProcess();

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

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

            record.Should().NotBeNull();
        }
Ejemplo n.º 3
0
        public async void Delete()
        {
            Mock <ILogger <DeploymentProcessRepository> > loggerMoc = DeploymentProcessRepositoryMoc.GetLoggerMoc();
            ApplicationDbContext context = DeploymentProcessRepositoryMoc.GetContext();
            var repository           = new DeploymentProcessRepository(loggerMoc.Object, context);
            DeploymentProcess entity = new DeploymentProcess();

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

            await repository.Delete(entity.Id);

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

            modifiedRecord.Should().BeNull();
        }
Ejemplo n.º 4
0
        public async void Update_Entity_Is_Not_Tracked()
        {
            Mock <ILogger <DeploymentProcessRepository> > loggerMoc = DeploymentProcessRepositoryMoc.GetLoggerMoc();
            ApplicationDbContext context = DeploymentProcessRepositoryMoc.GetContext();
            var repository           = new DeploymentProcessRepository(loggerMoc.Object, context);
            DeploymentProcess entity = new DeploymentProcess();

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

            await repository.Update(new DeploymentProcess());

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

            modifiedRecord.Should().NotBeNull();
        }