Ejemplo n.º 1
0
        public async void Get()
        {
            Mock <ILogger <CountryRegionCurrencyRepository> > loggerMoc = CountryRegionCurrencyRepositoryMoc.GetLoggerMoc();
            ApplicationDbContext context = CountryRegionCurrencyRepositoryMoc.GetContext();
            var repository = new CountryRegionCurrencyRepository(loggerMoc.Object, context);

            CountryRegionCurrency entity = new CountryRegionCurrency();

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

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

            record.Should().NotBeNull();
        }
Ejemplo n.º 2
0
        public async void Update_Entity_Is_Tracked()
        {
            Mock <ILogger <CountryRegionCurrencyRepository> > loggerMoc = CountryRegionCurrencyRepositoryMoc.GetLoggerMoc();
            ApplicationDbContext context = CountryRegionCurrencyRepositoryMoc.GetContext();
            var repository = new CountryRegionCurrencyRepository(loggerMoc.Object, context);
            CountryRegionCurrency entity = new CountryRegionCurrency();

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

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

            await repository.Update(record);

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

            modifiedRecord.Should().NotBeNull();
        }