Beispiel #1
0
        public async void Get()
        {
            Mock <ILogger <CurrencyRateRepository> > loggerMoc = CurrencyRateRepositoryMoc.GetLoggerMoc();
            ApplicationDbContext context = CurrencyRateRepositoryMoc.GetContext();
            var repository = new CurrencyRateRepository(loggerMoc.Object, context);

            CurrencyRate entity = new CurrencyRate();

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

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

            record.Should().NotBeNull();
        }
Beispiel #2
0
        public async void Update_Entity_Is_Tracked()
        {
            Mock <ILogger <CurrencyRateRepository> > loggerMoc = CurrencyRateRepositoryMoc.GetLoggerMoc();
            ApplicationDbContext context = CurrencyRateRepositoryMoc.GetContext();
            var          repository      = new CurrencyRateRepository(loggerMoc.Object, context);
            CurrencyRate entity          = new CurrencyRate();

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

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

            await repository.Update(record);

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

            modifiedRecord.Should().NotBeNull();
        }