示例#1
0
        public async void Get()
        {
            Mock <ILogger <EmployeePayHistoryRepository> > loggerMoc = EmployeePayHistoryRepositoryMoc.GetLoggerMoc();
            ApplicationDbContext context = EmployeePayHistoryRepositoryMoc.GetContext();
            var repository = new EmployeePayHistoryRepository(loggerMoc.Object, context);

            EmployeePayHistory entity = new EmployeePayHistory();

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

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

            record.Should().NotBeNull();
        }
示例#2
0
        public async void Update_Entity_Is_Tracked()
        {
            Mock <ILogger <EmployeePayHistoryRepository> > loggerMoc = EmployeePayHistoryRepositoryMoc.GetLoggerMoc();
            ApplicationDbContext context = EmployeePayHistoryRepositoryMoc.GetContext();
            var repository            = new EmployeePayHistoryRepository(loggerMoc.Object, context);
            EmployeePayHistory entity = new EmployeePayHistory();

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

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

            await repository.Update(record);

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

            modifiedRecord.Should().NotBeNull();
        }