예제 #1
0
        public void ExecutesFallbackActionAssignedInConstructorWhenExecutedTypeNotFoundOrNull()
        {
            var swithWithFallback = new TypeSwitch<int>( () => 0 );
            swithWithFallback.Set( typeof(int), () => 1 );

            var result = swithWithFallback.Execute( typeof(bool) );

            Assert.AreEqual( 0, result );
        }
예제 #2
0
        public void ExecutesFallbackActionAssignedInConstructorWhenExecutedTypeNotFoundOrNull()
        {
            var swithWithFallback = new TypeSwitch( StringAction );
            swithWithFallback.Set( typeof(int), IntegerAction );

            swithWithFallback.Execute( typeof(bool) );

            Assert.IsTrue( _stringActionInvoked );
        }