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

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

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

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

            SpaceXSpaceFeature entity = new SpaceXSpaceFeature();

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

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

            record.Should().NotBeNull();
        }
Exemple #3
0
        public async void Delete()
        {
            Mock <ILogger <SpaceXSpaceFeatureRepository> > loggerMoc = SpaceXSpaceFeatureRepositoryMoc.GetLoggerMoc();
            ApplicationDbContext context = SpaceXSpaceFeatureRepositoryMoc.GetContext();
            var repository            = new SpaceXSpaceFeatureRepository(loggerMoc.Object, context);
            SpaceXSpaceFeature entity = new SpaceXSpaceFeature();

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

            await repository.Delete(entity.Id);

            SpaceXSpaceFeature modifiedRecord = await context.Set <SpaceXSpaceFeature>().FirstOrDefaultAsync();

            modifiedRecord.Should().BeNull();
        }
Exemple #4
0
        public async void Update_Entity_Is_Not_Tracked()
        {
            Mock <ILogger <SpaceXSpaceFeatureRepository> > loggerMoc = SpaceXSpaceFeatureRepositoryMoc.GetLoggerMoc();
            ApplicationDbContext context = SpaceXSpaceFeatureRepositoryMoc.GetContext();
            var repository            = new SpaceXSpaceFeatureRepository(loggerMoc.Object, context);
            SpaceXSpaceFeature entity = new SpaceXSpaceFeature();

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

            await repository.Update(new SpaceXSpaceFeature());

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

            modifiedRecord.Should().NotBeNull();
        }