public MasterServiceTests() { MqttConfiguration = new MqttConfiguration() { Host = "192.168.66.200", Port = 64220, Username = "******", Password = "******" }; var configuration = new TasmotaConfiguration() { Subnet = IPAddress.Parse("192.168.66.0"), }; Network = new MockNetwork(configuration.Subnet, 30, MqttConfiguration); var loggerFactory = LoggerFactory.Create(builder => builder.AddConsole()); var tasmotaClient = new MockTasmotaClient(Network); var mongoClient = new MongoClient("mongodb://localhost"); Database = mongoClient.GetDatabase("tasmocc-test"); DeviceRepository = new DeviceRepository(Database); var deviceConfigurationRepository = new DeviceConfigurationRepository(Database); TasmotaService = new TasmotaService(Options.Create(configuration), loggerFactory.CreateLogger <TasmotaService>(), tasmotaClient); MasterService = new MasterService(Options.Create(MqttConfiguration), loggerFactory.CreateLogger <MasterService>(), TasmotaService, DeviceRepository, deviceConfigurationRepository) { ScanNetworkOnStart = false }; }
public TasmotaServiceTests() { MqttConfiguration = new MqttConfiguration() { Host = "192.168.66.200", Port = 64220, Username = "******", Password = "******" }; var configuration = new TasmotaConfiguration() { Subnet = IPAddress.Parse("192.168.66.0"), }; var loggerFactory = LoggerFactory.Create(builder => builder.AddConsole()); Network = new MockNetwork(configuration.Subnet, 30, MqttConfiguration); Service = new TasmotaService(Options.Create(configuration), loggerFactory.CreateLogger <TasmotaService>(), new MockTasmotaClient(Network)); }
public TasmotaService(IOptions <TasmotaConfiguration> options, ILogger <TasmotaService> logger, ITasmotaClient client) { Configuration = options.Value; _client = client; _logger = logger; }