Exemple #1
0
        public async void Create()
        {
            Mock <ILogger <CountryRegionCurrencyRepository> > loggerMoc = CountryRegionCurrencyRepositoryMoc.GetLoggerMoc();
            ApplicationDbContext context = CountryRegionCurrencyRepositoryMoc.GetContext();
            var repository = new CountryRegionCurrencyRepository(loggerMoc.Object, context);

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

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

            record.Should().NotBeNull();
        }
Exemple #2
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();
        }
Exemple #3
0
        public async void Delete()
        {
            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();

            await repository.Delete(entity.CountryRegionCode);

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

            modifiedRecord.Should().BeNull();
        }
Exemple #4
0
        public async void Update_Entity_Is_Not_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();

            await repository.Update(new CountryRegionCurrency());

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

            modifiedRecord.Should().NotBeNull();
        }