示例#1
0
        public async void Add_LogError()
        {
            using (var context = new ErrorCentralContext(Options))
            {
                var logError = new LogErrorBuilder().Build();

                var      repository = new LogErrorRepository(context);
                LogError result     = await repository.AddAsync(logError);

                result.Should().BeEquivalentTo(logError);
            }
        }
示例#2
0
        public async void GetList_LogError()
        {
            using (var context = Seed())
            {
                LogErrorBuilder builder = new LogErrorBuilder();

                var repository          = new LogErrorRepository(context);
                IList <LogError> result = await repository.GetAllUnarchivedAsync();

                result.Should().BeEquivalentTo(_logErrors);
            }
        }
示例#3
0
        public async void GetByEnvironment_LogError()
        {
            using (var context = Seed())
            {
                var repository = new LogErrorRepository(context);

                IList <LogError> result = await repository.GetByEnvironmentAsync(EEnvironment.Production);

                foreach (LogError logError in result)
                {
                    logError.Environment.Should().Be(EEnvironment.Production);
                }
            }
        }
示例#4
0
        public async void Update_LogError()
        {
            using (var context = Seed())
            {
                var repository = new LogErrorRepository(context);

                LogError result = await repository.GetByIdAsync(1);

                result.Archive();

                repository.Update(result);

                int updated = await repository.UnitOfWork.SaveChangesAsync();

                updated.Should().BeGreaterThan(0);
            }
        }