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

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

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

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

            DashboardConfiguration entity = new DashboardConfiguration();

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

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

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

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

            await repository.Delete(entity.Id);

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

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

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

            await repository.Update(new DashboardConfiguration());

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

            modifiedRecord.Should().NotBeNull();
        }