https://github.com/yanndr/thermometer
A Temperature Library in C# .net Core
https://github.com/yanndr/thermometer
alert converter csharp dotnet-core grpc temperature thermometer threshold
Last synced: about 1 year ago
JSON representation
A Temperature Library in C# .net Core
- Host: GitHub
- URL: https://github.com/yanndr/thermometer
- Owner: yanndr
- License: mit
- Created: 2017-07-09T02:18:48.000Z (over 8 years ago)
- Default Branch: master
- Last Pushed: 2023-07-06T01:25:00.000Z (almost 3 years ago)
- Last Synced: 2025-01-10T10:58:28.301Z (about 1 year ago)
- Topics: alert, converter, csharp, dotnet-core, grpc, temperature, thermometer, threshold
- Language: C#
- Homepage:
- Size: 80.1 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
[](https://travis-ci.org/yanndr/Thermometer)
# Introduction
This is a C# .net core Temperature/Thermometer Library.
This library allows you to convert temperature units, so far Kelvin, Celsius and Fahrenheit.
There are three thermometers: Basic Thermometer, MultiUnit Thermometer and an AlerterThermometer.
The Alerter Thermometer allows you to set up temperature thresholds to receive an alert when the temperature reaches your chosen threshold.
# Usage
```
var converter = new TemperatureConverter(new ConverterFactory(
new List
{
new CelsiusConverter(),
new FahrenheitConverter()
}));
var alerters = new List
{
new DropAlert("Freezing alert", 0.0m, 0.5m,()=>Console.WriteLine("----Freezing Alert------s")),
new RaiseAlert("Boiling alert", 100, 0.5m,()=>Console.WriteLine("----Boiling Alert----")),
new BidirectionalAlert("Nice temperature alert", 28.0m, 1m,()=>Console.WriteLine("----Other Alert------s"))
};
thermometer = new AlerterThermometer(Unit.Celsius,converter, alerters);
```
In the solution you will find an example console project that shows how to use the library: thermometer-console .
# Prerequistes
```
- .net Core or Docker
```
# Build and Test
Build the solution:
```
> dotnet restore
> dotnet build
```
Run the tests:
```
> dotnet test ./ThermometerLibrary.Tests/ThermometerLibrary.Tests.csproj
```
# Run the examples
Run the example with dotnet:
```
> dotnet run -p ThermometerConsole/ThermometerConsole.csproj
```
Run the server example with dotnet:
```
> dotnet run -p ThermometerSercice/ThermometerService.csproj
```
Run the Temperature updater example to feed the Termomether servie with dotnet:
```
> dotnet run -p TemperatureUpdater/TemperatureUpdater.csproj
```
Run the example with Docker:
```
- build the image:
> docker build -t thermometer-console .
```
- Run the container
```
> docker run -it --rm thermometer-console
```