private async Task <IActionResult> GetOperativeSystemById(GetOperativeSystemByIdRequest getOperativeSystemRequest) { var options = new DbContextOptionsBuilder <Context>() .UseInMemoryDatabase(databaseName: "OperativeSystem") .Options; // Run the test against one instance of the context using (var context = new Context(options)) { var repository = new OperativeSystemRepository(context, AutomapperSingleton.Mapper); var service = new OperativeSystemService(repository, AutomapperSingleton.Mapper); var controller = new OperativeSystemController(service); Mock <HttpRequest> mockGetRequest = MockHttpRequest.CreateMockQuery(getOperativeSystemRequest.Id); return(await controller.GetOperativeSystemByIdAsync(mockGetRequest.Object, _logger)); //as GridController; } }
public OperativeSystemService() { operativeSystemRepository = new OperativeSystemRepository(); }