예제 #1
0
        public void Retrieve_correct_nullable_value(string value, Sex?expectation)
        {
            var retriever = new EnumValueRetriever();
            var result    = (Sex?)retriever.Retrieve(new KeyValuePair <string, string>(IrrelevantKey, value), IrrelevantType, typeof(Sex?));

            result.Should().Be(expectation);
        }
예제 #2
0
        public void Throws_an_exception_when_the_value_is_illegal_for_nullable(string value, string exceptionMessage)
        {
            var retriever = new EnumValueRetriever();

            Action action = () => retriever.Retrieve(new KeyValuePair <string, string>(IrrelevantKey, value), IrrelevantType, typeof(Sex?));

            action.Should().Throw <InvalidOperationException>().WithMessage(exceptionMessage);
        }