Exemplo n.º 1
0
        public void AsType_ContainingWrongType_ThrowsInvalidCastException()
        {
            var blist = new BList {
                1, "2", 3
            };
            Action action = () => blist.AsType <BNumber>();

            action.ShouldThrow <InvalidCastException>();
        }
Exemplo n.º 2
0
        public void AsType_ConvertsToListOfType()
        {
            var blist = new BList {
                1, 2, 3
            };
            var bnumbers = blist.AsType <BNumber>();

            bnumbers.Should()
            .HaveCount(3)
            .And.ContainItemsAssignableTo <BNumber>()
            .And.ContainInOrder(blist);
        }