Ejemplo n.º 1
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();
        }
Ejemplo n.º 2
0
        public async void Update_Entity_Is_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();

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

            await repository.Update(record);

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

            modifiedRecord.Should().NotBeNull();
        }