public async Task Get_All_versionsAsync() { //arrange var options = new DbContextOptionsBuilder <HistoryContext>() .UseInMemoryDatabase(databaseName: "MyData5").Options; // Seed Data using (var context = new HistoryContext(options)) { context.HistoryData.Add(new PayloadModel { Id = Guid.NewGuid(), Key = "customer.2", FirstName = "siaf", LastName = "manea", Address = "berlin", CreatedDate = DateTime.UtcNow }); context.HistoryData.Add(new PayloadModel { Id = Guid.NewGuid(), Key = "customer.1", FirstName = "siaf", LastName = "manea", Address = "berlin", CreatedDate = DateTime.UtcNow }); context.SaveChanges(); } // Act using (var context = new HistoryContext(options)) { SearchHistoryService historyRepository = new SearchHistoryService(context); var result = await historyRepository.GetAll(); // Assert Assert.True(result.Count == 2); } }
public async Task No_Version_Exist() { //arrange var options = new DbContextOptionsBuilder <HistoryContext>() .UseInMemoryDatabase(databaseName: "MyData6").Options; // Act using (var context = new HistoryContext(options)) { SearchHistoryService historyRepository = new SearchHistoryService(context); var result = await historyRepository.GetAll(); // Assert Assert.True(result.Count().Equals(0)); } }