public PerformanceInterceptionAspect(int interval, Type loggerType) { if (loggerType.BaseType != typeof(FakeLoggerService)) { throw new Exception("Logger Type Mismatch."); } _interval = interval; _stopwatch = Activator.CreateInstance <Stopwatch>(); _loggerService = ServiceTool.ServiceProvider.GetService <FakeLoggerService>(); }
public CategoryControllerTests() { var inMemorySettings = new Dictionary <string, string> { { "ServicesUrl:User", "https://localhost:44200/api/user" }, { "ServicesUrl:Logger", "https://localhost:44200/api/logger" }, }; IConfiguration configuration = new ConfigurationBuilder() .AddInMemoryCollection(inMemorySettings) .Build(); var httpContextAccessorMock = new Mock <IHttpContextAccessor>(); httpContextAccessorMock.Setup(c => c.HttpContext.TraceIdentifier).Returns("1234"); var categoryRepository = new FakeCategoryRepository(); var logger = new FakeLoggerService(configuration); categoryController = new CategoryController(categoryRepository, logger, httpContextAccessorMock.Object); }