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 async void Should_prove_host_availability_if_exists() { const string fakeHost = "fake.org"; var mock = new MockNetwork(ArbitraryNetwork.Hosts( samples: Maybe.Nothing <ushort>(), fakeHost)); var sut = new HostAvailability(mock, new Hosts().AddHost(fakeHost).Content); var outcome = await sut.VerifyAsync(); outcome.Should().NotBeNull() .And.BeOfType <Ok <Evidence, string> >() .Which.SucceededWith().Should().BeEquivalentTo(new Evidence(typeof(HostAvailability), new Hosts().AddHost(fakeHost).Content)); }
public DeviceEmulatorTests() { MqttConfiguration = new MqttConfiguration() { Host = "192.168.66.200", Port = 64220, Username = "******", Password = "******" }; Network = new MockNetwork(IPAddress.Parse("192.168.66.0"), 10, MqttConfiguration); Network.MqttServer.MessageReceived += (s, e) => { _receivedTopic = e.Message.Topic; _receivedPayload = e.Message.Payload; }; }
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)); }