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

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

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

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

            var entity = new Follower();

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

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

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