Esempio n. 1
0
        public async void Create()
        {
            Mock <ILogger <DirectTweetRepository> > loggerMoc = DirectTweetRepositoryMoc.GetLoggerMoc();
            ApplicationDbContext context = DirectTweetRepositoryMoc.GetContext();
            var repository = new DirectTweetRepository(loggerMoc.Object, context);

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

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

            record.Should().NotBeNull();
        }
        public async void Create()
        {
            Mock <ILogger <DirectTweetRepository> > loggerMoc = DirectTweetRepositoryMoc.GetLoggerMoc();
            ApplicationDbContext context = DirectTweetRepositoryMoc.GetContext();
            var repository = new DirectTweetRepository(loggerMoc.Object, context);

            var entity = new DirectTweet();

            entity.SetProperties(default(int), "B", DateTime.Parse("1/1/1988 12:00:00 AM"), 1, TimeSpan.Parse("02:00:00"));
            await repository.Create(entity);

            var records = await context.Set <DirectTweet>().ToListAsync();

            records.Count.Should().Be(2);
        }