public void Returns_a_negative_Float_value_when_passed_one() { var retriever = new FloatValueRetriever(); retriever.GetValue("-1").Should().Be(-1F); retriever.GetValue("-32.234").Should().Be(-32.234F); }
public void Retrieve_correct_nullable_value(string value, float?expectation) { var retriever = new FloatValueRetriever(); var result = (float?)retriever.Retrieve(new KeyValuePair <string, string>(IrrelevantKey, value), IrrelevantType, typeof(float?)); result.Should().Be(expectation); }
public void CanRetrieve(Type type, bool expectation) { var retriever = new FloatValueRetriever(); var result = retriever.CanRetrieve(new KeyValuePair <string, string>(IrrelevantKey, IrrelevantKey), IrrelevantType, type); result.Should().Be(expectation); }
public void Returns_zero_when_passed_a_non_numeric_value() { var retriever = new FloatValueRetriever(); retriever.GetValue(null).Should().Be(0F); retriever.GetValue("").Should().Be(0F); retriever.GetValue("xxxslkdfj").Should().Be(0F); }
public void Retrieve_a_float_when_passed_a_float_value_if_culture_is_fr_Fr() { Thread.CurrentThread.CurrentCulture = new CultureInfo("fr-FR", false); var retriever = new FloatValueRetriever(); var result = (float?)retriever.Retrieve(new KeyValuePair <string, string>(IrrelevantKey, "384,234879"), IrrelevantType, typeof(float?)); result.Should().Be(384.234879f); }
public void Returns_the_Float_value_when_passed_a_Float_string() { var retriever = new FloatValueRetriever(); retriever.GetValue("0").Should().Be(0F); retriever.GetValue("1").Should().Be(1F); retriever.GetValue("2").Should().Be(2F); retriever.GetValue("2.23").Should().Be(2.23F); retriever.GetValue("384.234879").Should().Be(384.234879F); }
public void Returns_the_Float_value_when_passed_a_Float_string_if_culture_if_fr_FR() { Thread.CurrentThread.CurrentCulture = new CultureInfo("fr-FR"); var retriever = new FloatValueRetriever(); retriever.GetValue("0").Should().Be(0F); retriever.GetValue("1").Should().Be(1F); retriever.GetValue("2").Should().Be(2F); retriever.GetValue("2,23").Should().Be(2.23F); retriever.GetValue("384,234879").Should().Be(384.234879F); }