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

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

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

            record.Should().NotBeNull();
        }
Exemple #2
0
        public async void Create()
        {
            Mock <ILogger <BucketRepository> > loggerMoc = BucketRepositoryMoc.GetLoggerMoc();
            ApplicationDbContext context = BucketRepositoryMoc.GetContext();
            var repository = new BucketRepository(loggerMoc.Object, context);

            var entity = new Bucket();

            entity.SetProperties(default(int), Guid.Parse("3842cac4-b9a0-8223-0dcc-509a6f75849b"), "B");
            await repository.Create(entity);

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

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