Exemplo n.º 1
0
        public async void Get()
        {
            Mock <ILogger <BucketRepository> > loggerMoc = BucketRepositoryMoc.GetLoggerMoc();
            ApplicationDbContext context = BucketRepositoryMoc.GetContext();
            var repository = new BucketRepository(loggerMoc.Object, context);

            Bucket entity = new Bucket();

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

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

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

            Bucket entity = new Bucket();

            entity.SetProperties(default(int), Guid.Parse("3842cac4-b9a0-8223-0dcc-509a6f75849b"), "B");
            context.Set <Bucket>().Add(entity);
            await context.SaveChangesAsync();

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

            record.Should().NotBeNull();
        }
Exemplo n.º 3
0
        public async void Update_Entity_Is_Tracked()
        {
            Mock <ILogger <BucketRepository> > loggerMoc = BucketRepositoryMoc.GetLoggerMoc();
            ApplicationDbContext context = BucketRepositoryMoc.GetContext();
            var    repository            = new BucketRepository(loggerMoc.Object, context);
            Bucket entity = new Bucket();

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

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

            await repository.Update(record);

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

            modifiedRecord.Should().NotBeNull();
        }