public void Retrieve_correct_nullable_value(string value, uint?expectation) { var retriever = new UIntValueRetriever(); var result = (uint?)retriever.Retrieve(new KeyValuePair <string, string>(IrrelevantKey, value), IrrelevantType, typeof(uint?)); result.Should().Be(expectation); }
public void CanRetrieve(Type type, bool expectation) { var retriever = new UIntValueRetriever(); 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_int() { var retriever = new UIntValueRetriever(); 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 Returns_an_unsigned_integer_when_passed_an_unsigned_integer_value() { var retriever = new UIntValueRetriever(); retriever.GetValue("1").ShouldEqual <uint>(1); retriever.GetValue("3").ShouldEqual <uint>(3); retriever.GetValue("30").ShouldEqual <uint>(30); retriever.GetValue("1234567890").ShouldEqual <uint>(1234567890); }
public void Retrieve_a_uint_when_passed_a_uint_value_if_culture_is_fr_Fr() { Thread.CurrentThread.CurrentCulture = new CultureInfo("fr-FR", false); var retriever = new UIntValueRetriever(); var result = (uint?)retriever.Retrieve(new KeyValuePair <string, string>(IrrelevantKey, "1234567890,0"), IrrelevantType, typeof(uint?)); result.Should().Be(1234567890u); }
public void Returns_an_unsigned_integer_when_passed_an_unsigned_integer_value_if_fr_FR() { Thread.CurrentThread.CurrentCulture = new CultureInfo("fr-FR", false); var retriever = new UIntValueRetriever(); retriever.GetValue("1").Should().Be(1); retriever.GetValue("3").Should().Be(3); retriever.GetValue("30").Should().Be(30); retriever.GetValue("1234567890").Should().Be(1234567890); }