public void Returns_negative_numbers_when_passed_a_negative_value() { var retriever = new IntValueRetriever(); retriever.GetValue("-1").Should().Be(-1); retriever.GetValue("-5").Should().Be(-5); }
public void Retrieve_correct_nullable_value(string value, int?expectation) { var retriever = new IntValueRetriever(); var result = (int?)retriever.Retrieve(new KeyValuePair <string, string>(IrrelevantKey, value), IrrelevantType, typeof(int?)); result.Should().Be(expectation); }
public void CanRetrieve(Type type, bool expectation) { var retriever = new IntValueRetriever(); var result = retriever.CanRetrieve(new KeyValuePair <string, string>(IrrelevantKey, IrrelevantKey), IrrelevantType, type); result.Should().Be(expectation); }
public void Returns_a_zero_when_passed_an_invalid_int_if_culture_is_fr_FR() { Thread.CurrentThread.CurrentCulture = new CultureInfo("fr-FR"); var retriever = new IntValueRetriever(); retriever.GetValue("1,234,567,890").Should().Be(0); }
public void Returns_a_zero_when_passed_an_invalid_int() { var retriever = new IntValueRetriever(); retriever.GetValue("x").Should().Be(0); retriever.GetValue("").Should().Be(0); retriever.GetValue("every good boy does fine").Should().Be(0); }
public void Returns_a_zero_when_passed_an_invalid_short_if_culture_is_fr_FR() { Thread.CurrentThread.CurrentCulture = new CultureInfo("fr-FR", false); var retriever = new IntValueRetriever(); retriever.GetValue("12,345").Should().Be(0); }
public void Returns_a_zero_when_passed_an_invalid_short() { var retriever = new IntValueRetriever(); retriever.GetValue("x").ShouldEqual(0); retriever.GetValue("").ShouldEqual(0); retriever.GetValue("1234567890123456789").ShouldEqual(0); retriever.GetValue("every good boy does fine").ShouldEqual(0); }
public void Returns_an_integer_when_passed_an_integer_value() { var retriever = new IntValueRetriever(); retriever.GetValue("1").ShouldEqual(1); retriever.GetValue("3").ShouldEqual(3); retriever.GetValue("30").ShouldEqual(30); retriever.GetValue("1234567890").ShouldEqual(1234567890); }
public void Retrieve_a_int_when_passed_a_int_value_if_culture_is_fr_Fr() { Thread.CurrentThread.CurrentCulture = new CultureInfo("fr-FR", false); var retriever = new IntValueRetriever(); var result = (int?)retriever.Retrieve(new KeyValuePair <string, string>(IrrelevantKey, "1234567890,0"), IrrelevantType, typeof(int?)); result.Should().Be(1234567890); }
public void Returns_an_integer_when_passed_an_integer_value_if_culture_if_fr_FR() { Thread.CurrentThread.CurrentCulture = new CultureInfo("fr-FR"); var retriever = new IntValueRetriever(); retriever.GetValue("1").Should().Be(1); retriever.GetValue("3").Should().Be(3); retriever.GetValue("30").Should().Be(30); retriever.GetValue("1234567890").Should().Be(1234567890); }
public void Returns_a_short_when_passed_a_short_value_if_culture_is_fr_FR() { Thread.CurrentThread.CurrentCulture = new CultureInfo("fr-FR", false); var retriever = new IntValueRetriever(); retriever.GetValue("1").Should().Be(1); retriever.GetValue("3").Should().Be(3); retriever.GetValue("30").Should().Be(30); retriever.GetValue("12345").Should().Be(12345); }