Пример #1
0
        public async void TestUpdateAsync()
        {
            var options = new DbContextOptionsBuilder <ApplicationDbContext>()
                          .UseInMemoryDatabase(databaseName: "SchemaDatabase")
                          .Options;

            var dbContext = new ApplicationDbContext(options);
            var repo      = new SchemaRepository(dbContext);
            var newJson   = "{id: 234}";
            // Act
            var newSchema = await repo.CreateAsync(new Schema()
            {
                SavedDate = DateTime.Now, SchemaJson = "{id: 123}"
            });

            var id = newSchema.Id;

            newSchema.SchemaJson = newJson;
            var result = await repo.UpdateAsync(id, newSchema);

            // Assert
            Assert.True(result.SchemaJson == newJson);
        }