Ejemplo n.º 1
0
        public async Task Get_Version_ByKeyAsync()
        {
            //arrange
            string Key = "customer.3";

            var options = new DbContextOptionsBuilder <HistoryContext>()
                          .UseInMemoryDatabase(databaseName: "MyData3").Options;

            // Seed Data
            using (var context = new HistoryContext(options))
            {
                context.HistoryData.Add(new PayloadModel {
                    Key = "customer.3", 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.GetSingleVersion(Key);

                // Assert
                Assert.NotNull(result);
            }
        }
Ejemplo n.º 2
0
        public async Task Version_Not_Exist()
        {
            //arrange
            string Key = "customer.3";

            var options = new DbContextOptionsBuilder <HistoryContext>()
                          .UseInMemoryDatabase(databaseName: "MyData4").Options;

            // Act
            using (var context = new HistoryContext(options))
            {
                SearchHistoryService historyRepository = new SearchHistoryService(context);
                var result = await historyRepository.GetSingleVersion(Key);

                // Assert
                Assert.Null(result);
            }
        }