public async void Update_Exist_Version() { //arrange var record = new PayloadModel { Key = "customer.1", FirstName = "new name", LastName = "manea", Address = "earth" }; var options = new DbContextOptionsBuilder <HistoryContext>() .UseInMemoryDatabase(databaseName: "MyData2").Options; // Seed Data using (var context = new HistoryContext(options)) { context.HistoryData.Add(new PayloadModel { Key = "customer.1", FirstName = "siaf", LastName = "manea", Address = "berlin", CreatedDate = DateTime.UtcNow }); _ = context.AddAsync(record); _ = context.SaveChangesAsync(); } // Act using (var context = new HistoryContext(options)) { RegistrationHistoryService historyRepository = new RegistrationHistoryService(context); // Assert Assert.True(await historyRepository.Create(record)); } }
public async void Add_New_Version() { //arrange var record = new PayloadModel { Key = "customer.1", FirstName = "saif", LastName = "manea", Address = "earth" }; var options = new DbContextOptionsBuilder <HistoryContext>() .UseInMemoryDatabase(databaseName: "MyData1").Options; // Act using (var context = new HistoryContext(options)) { RegistrationHistoryService historyRepository = new RegistrationHistoryService(context); bool result = await historyRepository.Create(record); // Assert Assert.True(result); } }