public void Retrieve_correct_nullable_value(string value, ushort?expectation)
        {
            var retriever = new UShortValueRetriever();
            var result    = (ushort?)retriever.Retrieve(new KeyValuePair <string, string>(IrrelevantKey, value), IrrelevantType, typeof(ushort?));

            result.Should().Be(expectation);
        }
        public void CanRetrieve(Type type, bool expectation)
        {
            var retriever = new UShortValueRetriever();
            var result    = retriever.CanRetrieve(new KeyValuePair <string, string>(IrrelevantKey, IrrelevantKey), IrrelevantType, type);

            result.Should().Be(expectation);
        }
        public void Retrieve_a_ushort_when_passed_a_ushort_value_if_culture_is_fr_Fr()
        {
            Thread.CurrentThread.CurrentCulture = new CultureInfo("fr-FR", false);

            var retriever = new UShortValueRetriever();
            var result    = (ushort?)retriever.Retrieve(new KeyValuePair <string, string>(IrrelevantKey, "305,0"), IrrelevantType, typeof(ushort?));

            result.Should().Be(305);
        }
        public void Returns_an_unsigned_short_when_passed_an_unsigned_short_value()
        {
            var retriever = new UShortValueRetriever();

            retriever.GetValue("1").Should().Be(1);
            retriever.GetValue("3").Should().Be(3);
            retriever.GetValue("30").Should().Be(30);
            retriever.GetValue("12345").Should().Be(12345);
        }
        public void Returns_a_zero_when_passed_an_invalid_unsigned_short()
        {
            var retriever = new UShortValueRetriever();

            retriever.GetValue("x").Should().Be(0);
            retriever.GetValue("-1").Should().Be(0);
            retriever.GetValue("").Should().Be(0);
            retriever.GetValue("1234567890").Should().Be(0);
            retriever.GetValue("every good boy does fine").Should().Be(0);
        }
        public void Returns_an_unsigned_short_when_passed_an_unsigned_short_value_if_culture_is_fr_FR()
        {
            Thread.CurrentThread.CurrentCulture = new CultureInfo("fr-FR");

            var retriever = new UShortValueRetriever();

            retriever.GetValue("1").Should().Be(1);
            retriever.GetValue("3").Should().Be(3);
            retriever.GetValue("30").Should().Be(30);
            retriever.GetValue("12345").Should().Be(12345);
        }