Esempio n. 1
0
        public async void Get()
        {
            Mock <ILogger <TestAllFieldTypeRepository> > loggerMoc = TestAllFieldTypeRepositoryMoc.GetLoggerMoc();
            ApplicationDbContext context = TestAllFieldTypeRepositoryMoc.GetContext();
            var repository = new TestAllFieldTypeRepository(loggerMoc.Object, context);

            TestAllFieldType entity = new TestAllFieldType();

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

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

            record.Should().NotBeNull();
        }
        public async void Get()
        {
            Mock <ILogger <TestAllFieldTypeRepository> > loggerMoc = TestAllFieldTypeRepositoryMoc.GetLoggerMoc();
            ApplicationDbContext context = TestAllFieldTypeRepositoryMoc.GetContext();
            var repository = new TestAllFieldTypeRepository(loggerMoc.Object, context);

            TestAllFieldType entity = new TestAllFieldType();

            entity.SetProperties(default(int), 2, BitConverter.GetBytes(2), true, "B", DateTime.Parse("1/1/1988 12:00:00 AM"), DateTime.Parse("1/1/1988 12:00:00 AM"), DateTime.Parse("1/1/1988 12:00:00 AM"), DateTimeOffset.Parse("1/1/1988 12:00:00 AM"), 2m, 2, BitConverter.GetBytes(2), 2m, "B", "B", 2m, "B", 2m, DateTime.Parse("1/1/1988 12:00:00 AM"), 2, 2m, "B", TimeSpan.Parse("02:00:00"), BitConverter.GetBytes(2), 2, Guid.Parse("3842cac4-b9a0-8223-0dcc-509a6f75849b"), BitConverter.GetBytes(2), "B", "B");
            context.Set <TestAllFieldType>().Add(entity);
            await context.SaveChangesAsync();

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

            record.Should().NotBeNull();
        }
Esempio n. 3
0
        public async void Update_Entity_Is_Tracked()
        {
            Mock <ILogger <TestAllFieldTypeRepository> > loggerMoc = TestAllFieldTypeRepositoryMoc.GetLoggerMoc();
            ApplicationDbContext context = TestAllFieldTypeRepositoryMoc.GetContext();
            var repository          = new TestAllFieldTypeRepository(loggerMoc.Object, context);
            TestAllFieldType entity = new TestAllFieldType();

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

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

            await repository.Update(record);

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

            modifiedRecord.Should().NotBeNull();
        }