Ejemplo n.º 1
0
        public void Returns_the_object_passed_in()
        {
            var fruit = new Fruit();
            fruit.CastTo<Fruit>().ShouldBeSameAs(fruit);

            var apple = new Apple();
            apple.CastTo<Fruit>().ShouldBeSameAs(apple);
        }
Ejemplo n.º 2
0
 public void Throws_exception_if_type_does_not_match()
 {
     var fruit = new Fruit();
     var exceptionHit = false;
     try
     {
         fruit.CastTo<Vegetable>();
     }
     catch
     {
         exceptionHit = true;
     }
     exceptionHit.ShouldBeTrue();
 }