Example #1
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();
        }
Example #2
0
        public async void Update_Entity_Is_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();

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

            await repository.Update(record);

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

            modifiedRecord.Should().NotBeNull();
        }