public void Retrieve_correct_nullable_value(string value, ulong?expectation) { var retriever = new ULongValueRetriever(); var result = (ulong?)retriever.Retrieve(new KeyValuePair <string, string>(IrrelevantKey, value), IrrelevantType, typeof(ulong?)); result.Should().Be(expectation); }
public void CanRetrieve(Type type, bool expectation) { var retriever = new ULongValueRetriever(); 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_unsigned_long() { var retriever = new ULongValueRetriever(); retriever.GetValue("x").Should().Be(0); retriever.GetValue("-1").Should().Be(0); retriever.GetValue("").Should().Be(0); retriever.GetValue("every good boy does fine").Should().Be(0); }
public void Retrieve_a_ulong_when_passed_a_ulong_value_if_culture_is_fr_Fr() { Thread.CurrentThread.CurrentCulture = new CultureInfo("fr-FR", false); var retriever = new ULongValueRetriever(); var result = (ulong?)retriever.Retrieve(new KeyValuePair <string, string>(IrrelevantKey, "1234567890123456789,0"), IrrelevantType, typeof(ulong?)); result.Should().Be(1234567890123456789UL); }
public void Returns_an_unsigned_long_when_passed_an_unsigned_long_value() { var retriever = new ULongValueRetriever(); retriever.GetValue("1").ShouldEqual <ulong>(1); retriever.GetValue("3").ShouldEqual <ulong>(3); retriever.GetValue("30").ShouldEqual <ulong>(30); retriever.GetValue("12345678901234567890").ShouldEqual <ulong>(12345678901234567890); }
public void Returns_an_unsigned_long_when_passed_an_unsigned_long_value() { Thread.CurrentThread.CurrentCulture = new CultureInfo("en-US"); var retriever = new ULongValueRetriever(); retriever.GetValue("1").Should().Be(1); retriever.GetValue("3").Should().Be(3); retriever.GetValue("30").Should().Be(30); retriever.GetValue("12345678901234567890").Should().Be(12345678901234567890); retriever.GetValue("12,345,678,901,234,567,890").Should().Be(12345678901234567890); }