public void Test_Temperature_Mapper_Directly() { var sut = ServiceBuilder.Get(); var converterMapper = sut.GetRequiredService <KelvinConverterMapper>(); var mappings = _testCases.Select(tc => (tc.Input, tc.ExpectedResult, ActualResult: converterMapper(tc.TempScale, tc.Input))); var tolerance = new Func <decimal, decimal>(d => Math.Round(d, 2, MidpointRounding.ToEven)); foreach (var(_, expectedResult, actualResult) in mappings) { Assert.Equal(tolerance(expectedResult), tolerance(actualResult)); } }