Пример #1
0
        public async void Get()
        {
            Mock <ILogger <RetweetRepository> > loggerMoc = RetweetRepositoryMoc.GetLoggerMoc();
            ApplicationDbContext context = RetweetRepositoryMoc.GetContext();
            var repository = new RetweetRepository(loggerMoc.Object, context);

            Retweet entity = new Retweet();

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

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

            record.Should().NotBeNull();
        }
Пример #2
0
        public async void Get()
        {
            Mock <ILogger <RetweetRepository> > loggerMoc = RetweetRepositoryMoc.GetLoggerMoc();
            ApplicationDbContext context = RetweetRepositoryMoc.GetContext();
            var repository = new RetweetRepository(loggerMoc.Object, context);

            Retweet entity = new Retweet();

            entity.SetProperties(default(int), DateTime.Parse("1/1/1988 12:00:00 AM"), 1, TimeSpan.Parse("02:00:00"), 1);
            context.Set <Retweet>().Add(entity);
            await context.SaveChangesAsync();

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

            record.Should().NotBeNull();
        }
Пример #3
0
        public async void Update_Entity_Is_Tracked()
        {
            Mock <ILogger <RetweetRepository> > loggerMoc = RetweetRepositoryMoc.GetLoggerMoc();
            ApplicationDbContext context = RetweetRepositoryMoc.GetContext();
            var     repository           = new RetweetRepository(loggerMoc.Object, context);
            Retweet entity = new Retweet();

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

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

            await repository.Update(record);

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

            modifiedRecord.Should().NotBeNull();
        }