public void Test_LEDService() { var tempChannel = new TestTempChannel(); Assert.IsNotNull(tempChannel); tempChannel.Open(string.Empty); var ledService = new LEDService(tempChannel, 100); Assert.IsNotNull(ledService); ledService.Enabled = true; Thread.Sleep(2000); tempChannel.Close(); }
public void Test_TemperatureService() { float temperature = 0.0f; var tempChannel = new TestTempChannel(); tempChannel.ReceivedData += delegate(object sender, DataReceivedEventArgs e) { temperature = e.Value; }; Assert.IsNotNull(tempChannel); tempChannel.Open(string.Empty); var tempService = new TemperatureService(tempChannel, 1000); tempChannel.Services.Add(tempService); Assert.IsNotNull(tempService); tempService.Enabled = true; Thread.Sleep(2000); Assert.AreEqual(25.1111f, temperature); tempChannel.Close(); }