Example #1
0
        public async void Create()
        {
            Mock <ILogger <DeploymentRelatedMachineRepository> > loggerMoc = DeploymentRelatedMachineRepositoryMoc.GetLoggerMoc();
            ApplicationDbContext context = DeploymentRelatedMachineRepositoryMoc.GetContext();
            var repository = new DeploymentRelatedMachineRepository(loggerMoc.Object, context);

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

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

            record.Should().NotBeNull();
        }
Example #2
0
        public async void Get()
        {
            Mock <ILogger <DeploymentRelatedMachineRepository> > loggerMoc = DeploymentRelatedMachineRepositoryMoc.GetLoggerMoc();
            ApplicationDbContext context = DeploymentRelatedMachineRepositoryMoc.GetContext();
            var repository = new DeploymentRelatedMachineRepository(loggerMoc.Object, context);

            DeploymentRelatedMachine entity = new DeploymentRelatedMachine();

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

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

            record.Should().NotBeNull();
        }
Example #3
0
        public async void Delete()
        {
            Mock <ILogger <DeploymentRelatedMachineRepository> > loggerMoc = DeploymentRelatedMachineRepositoryMoc.GetLoggerMoc();
            ApplicationDbContext context = DeploymentRelatedMachineRepositoryMoc.GetContext();
            var repository = new DeploymentRelatedMachineRepository(loggerMoc.Object, context);
            DeploymentRelatedMachine entity = new DeploymentRelatedMachine();

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

            await repository.Delete(entity.Id);

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

            modifiedRecord.Should().BeNull();
        }