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

            CommunityActionTemplate entity = new CommunityActionTemplate();

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

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

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

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

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

            await repository.Update(record);

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

            modifiedRecord.Should().NotBeNull();
        }