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

            ProductModelIllustration entity = new ProductModelIllustration();

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

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

            record.Should().NotBeNull();
        }
Exemple #2
0
        public async void Update_Entity_Is_Tracked()
        {
            Mock <ILogger <ProductModelIllustrationRepository> > loggerMoc = ProductModelIllustrationRepositoryMoc.GetLoggerMoc();
            ApplicationDbContext context = ProductModelIllustrationRepositoryMoc.GetContext();
            var repository = new ProductModelIllustrationRepository(loggerMoc.Object, context);
            ProductModelIllustration entity = new ProductModelIllustration();

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

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

            await repository.Update(record);

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

            modifiedRecord.Should().NotBeNull();
        }