public void It_Should_Calculate_Zero() { var memoryCache = GetMemoryCache(); var thermo = new TemperatureCalculations(memoryCache); var calc = thermo.GetCalculations(); Assert.True(calc.Min == 0 && calc.Max == 0 && calc.Average == 0); }
public void It_Should_Calculate_Correct() { var memoryCache = GetMemoryCache(); var thermo = new TemperatureCalculations(memoryCache); thermo.AddMeasure(10); thermo.AddMeasure(20); var calc = thermo.GetCalculations(); Assert.True(calc.Min == 10); Assert.True(calc.Max == 20); Assert.True(calc.Average == 15); }
public async Task It_Should_NOT_Append_Calculations() { var temperatureCalculation = new TemperatureCalculations(GetMemoryCache()); var thermometerMiddleware = new ThermometerMiddleware(next: (innerHttpContext) => Task.FromResult(0), temperatureCalculation: temperatureCalculation); Mock <HttpContext> httpContextMoq = GetHttpContext("text"); await thermometerMiddleware.Invoke(httpContextMoq.Object); httpContextMoq.Object.Response.Body.Seek(0, SeekOrigin.Begin); var reader = new StreamReader(httpContextMoq.Object.Response.Body); var streamText = reader.ReadToEnd(); Assert.True(string.IsNullOrWhiteSpace(streamText)); }