Ejemplo n.º 1
0
        public async void Get()
        {
            Mock <ILogger <BillOfMaterialRepository> > loggerMoc = BillOfMaterialRepositoryMoc.GetLoggerMoc();
            ApplicationDbContext context = BillOfMaterialRepositoryMoc.GetContext();
            var repository = new BillOfMaterialRepository(loggerMoc.Object, context);

            BillOfMaterial entity = new BillOfMaterial();

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

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

            record.Should().NotBeNull();
        }
Ejemplo n.º 2
0
        public async void Update_Entity_Is_Tracked()
        {
            Mock <ILogger <BillOfMaterialRepository> > loggerMoc = BillOfMaterialRepositoryMoc.GetLoggerMoc();
            ApplicationDbContext context = BillOfMaterialRepositoryMoc.GetContext();
            var            repository    = new BillOfMaterialRepository(loggerMoc.Object, context);
            BillOfMaterial entity        = new BillOfMaterial();

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

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

            await repository.Update(record);

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

            modifiedRecord.Should().NotBeNull();
        }