public ApiFakeStartup(IConfiguration configuration) { Configuration = configuration; _loggerMock = new LoggerMock(); _defaultHassClientMock = HassClientMock.DefaultMock; _defaultDataRepositoryMock = new Mock <IDataRepository>(); _defaultHttpHandlerMock = new HttpHandlerMock(); var hassClientFactoryMock = new HassClientFactoryMock(_defaultHassClientMock); _defaultDaemonHost = new NetDaemonHost( hassClientFactoryMock.Object, _defaultDataRepositoryMock.Object, _loggerMock.LoggerFactory, _defaultHttpHandlerMock.Object); _defaultDaemonApp = new BaseTestApp { Id = "app_id", IsEnabled = true }; _defaultDaemonHost.AddRunningApp(_defaultDaemonApp); _defaultDaemonApp2 = new BaseTestApp { Id = "app_id2" }; _defaultDaemonApp2.RuntimeInfo.NextScheduledEvent = DateTime.Now; _defaultDaemonApp2.IsEnabled = false; _defaultDaemonHost.AddRunningApp(_defaultDaemonApp2); _defaultDaemonRxApp = new BaseTestRxApp { Id = "app_rx_id", IsEnabled = true }; _defaultDaemonRxApp.RuntimeInfo.NextScheduledEvent = DateTime.Now; _defaultDaemonHost.AddRunningApp(_defaultDaemonRxApp); _defaultMockedRxApp = new Mock <NetDaemonRxApp>() { CallBase = true }; _defaultMockedRxApp.Object.Id = "app_rx_mock_id"; _defaultMockedRxApp.Object.IsEnabled = true; _defaultMockedRxApp.Setup(n => n.CreateObservableIntervall(It.IsAny <TimeSpan>(), It.IsAny <Action>())).Returns(new Mock <IDisposable>().Object); _defaultDaemonHost.AddRunningApp(_defaultMockedRxApp.Object); }
public ApiFakeStartup(IConfiguration configuration) { Configuration = configuration; _loggerMock = new LoggerMock(); _defaultHassClientMock = HassClientMock.DefaultMock; _defaultDataRepositoryMock = new Mock <IDataRepository>(); _defaultHttpHandlerMock = new HttpHandlerMock(); _defaultDaemonHost = new NetDaemonHost( _defaultHassClientMock.Object, _defaultDataRepositoryMock.Object, _loggerMock.LoggerFactory, _defaultHttpHandlerMock.Object); _defaultDaemonApp = new BaseTestApp(); _defaultDaemonApp.Id = "app_id"; _defaultDaemonApp.IsEnabled = true; _defaultDaemonHost.InternalRunningAppInstances[_defaultDaemonApp.Id !] = _defaultDaemonApp;
public void Bla() { HttpHandlerMock .Setup(s => s.GetAsync(_urlToScrape)) .ReturnsAsync(_responseMessage) .Verifiable(); HttpHandlerMock .Setup(s => s.ReadAsStringAsync(_responseMessage.Content)) .ReturnsAsync(_pageContent) .Verifiable(); UtilsMock .Setup(s => s.Sleep(1)) .Verifiable(); var sut = CreateWhiskyScraper(); // Act // TODO: FIX (ConfigurationManager) var result = await sut.GetScrapedWhiskies(_random, _converter, "GG"); // Assert }