Exemplo n.º 1
0
        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);
        }
Exemplo n.º 2
0
        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);
        }
Exemplo n.º 3
0
        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);
        }
Exemplo n.º 4
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);
        }
Exemplo n.º 5
0
        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);
        }
Exemplo n.º 6
0
        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);
        }