Esempio n. 1
0
        public void Retrieve_Zero_for_illegal_values(string value)
        {
            var retriever = new TimeSpanValueRetriever();
            var result    = (TimeSpan)retriever.Retrieve(new KeyValuePair <string, string>(IrrelevantKey, value), IrrelevantType, typeof(TimeSpan));

            result.Should().Be(TimeSpan.Zero);
        }
Esempio n. 2
0
        public void Retrieve_null_for_nullable_value_when_nullable_TimeSpan(string value)
        {
            var retriever = new TimeSpanValueRetriever();
            var result    = (TimeSpan?)retriever.Retrieve(new KeyValuePair <string, string>(IrrelevantKey, value), IrrelevantType, typeof(TimeSpan?));

            result.Should().Be(null);
        }
Esempio n. 3
0
        public void Retrieve_correct_nullable_value(string value)
        {
            var retriever = new TimeSpanValueRetriever();
            var result    = (TimeSpan?)retriever.Retrieve(new KeyValuePair <string, string>(IrrelevantKey, value), IrrelevantType, typeof(TimeSpan?));

            result.Should().Be(TimeSpan.Parse(value));
        }
Esempio n. 4
0
        public void Retrieve_a_TimeSpan_when_passed_a_TimeSpan_value_if_culture_is_fr_Fr()
        {
            Thread.CurrentThread.CurrentCulture = new CultureInfo("fr-FR", false);

            var retriever = new TimeSpanValueRetriever();
            var result    = (TimeSpan?)retriever.Retrieve(new KeyValuePair <string, string>(IrrelevantKey, "6:12:14:45,3448"), IrrelevantType, typeof(TimeSpan?));

            result.Should().Be(TimeSpan.Parse("6.12:14:45.3448000"));
        }