コード例 #1
0
        public async void Create()
        {
            Mock <ILogger <ProductModelProductDescriptionCultureRepository> > loggerMoc = ProductModelProductDescriptionCultureRepositoryMoc.GetLoggerMoc();
            ApplicationDbContext context = ProductModelProductDescriptionCultureRepositoryMoc.GetContext();
            var repository = new ProductModelProductDescriptionCultureRepository(loggerMoc.Object, context);

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

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

            record.Should().NotBeNull();
        }
コード例 #2
0
        public async void Get()
        {
            Mock <ILogger <ProductModelProductDescriptionCultureRepository> > loggerMoc = ProductModelProductDescriptionCultureRepositoryMoc.GetLoggerMoc();
            ApplicationDbContext context = ProductModelProductDescriptionCultureRepositoryMoc.GetContext();
            var repository = new ProductModelProductDescriptionCultureRepository(loggerMoc.Object, context);

            ProductModelProductDescriptionCulture entity = new ProductModelProductDescriptionCulture();

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

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

            record.Should().NotBeNull();
        }
コード例 #3
0
        public async void Update_Entity_Is_Not_Tracked()
        {
            Mock <ILogger <ProductModelProductDescriptionCultureRepository> > loggerMoc = ProductModelProductDescriptionCultureRepositoryMoc.GetLoggerMoc();
            ApplicationDbContext context = ProductModelProductDescriptionCultureRepositoryMoc.GetContext();
            var repository = new ProductModelProductDescriptionCultureRepository(loggerMoc.Object, context);
            ProductModelProductDescriptionCulture entity = new ProductModelProductDescriptionCulture();

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

            await repository.Update(new ProductModelProductDescriptionCulture());

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

            modifiedRecord.Should().NotBeNull();
        }