public void Gets_DelegatingWrappingType(Type declaredEnumerableOfT, Type expectedType)
    {
        // Arrange
        var wrapperProvider = new EnumerableWrapperProvider(
            declaredEnumerableOfT,
            new SerializableErrorWrapperProvider());

        // Act
        var wrappingType = wrapperProvider.WrappingType;

        // Assert
        Assert.NotNull(wrappingType);
        Assert.Equal(expectedType, wrappingType);
    }
예제 #2
0
        public void Gets_DelegatingWrappingType(Type declaredEnumerableOfT, Type expectedType)
        {
            // Arrange
            var wrapperProvider = new EnumerableWrapperProvider(
                                                            declaredEnumerableOfT,
                                                            new SerializableErrorWrapperProvider());

            // Act
            var wrappingType = wrapperProvider.WrappingType;

            // Assert
            Assert.NotNull(wrappingType);
            Assert.Equal(expectedType, wrappingType);
        }
    public void Ignores_NullInstances()
    {
        // Arrange
        var declaredEnumerableOfT = typeof(IEnumerable <int>);
        var wrapperProvider       = new EnumerableWrapperProvider(
            declaredEnumerableOfT,
            elementWrapperProvider: null);

        // Act
        var wrapped = wrapperProvider.Wrap(null);

        // Assert
        Assert.Equal(typeof(DelegatingEnumerable <int, int>), wrapperProvider.WrappingType);
        Assert.Null(wrapped);
    }
예제 #4
0
        public void Ignores_NullInstances()
        {
            // Arrange
            var declaredEnumerableOfT = typeof(IEnumerable<int>);
            var wrapperProvider = new EnumerableWrapperProvider(
                                        declaredEnumerableOfT,
                                        elementWrapperProvider: null);

            // Act
            var wrapped = wrapperProvider.Wrap(null);

            // Assert
            Assert.Equal(typeof(DelegatingEnumerable<int, int>), wrapperProvider.WrappingType);
            Assert.Null(wrapped);
        }
        public void Wraps_EmptyCollections()
        {
            // Arrange
            var declaredEnumerableOfT = typeof(IEnumerable<int>);
            var wrapperProvider = new EnumerableWrapperProvider(
                                                declaredEnumerableOfT,
                                                elementWrapperProvider: null);

            // Act
            var wrapped = wrapperProvider.Wrap(new int[] { });

            // Assert
            Assert.Equal(typeof(DelegatingEnumerable<int, int>), wrapperProvider.WrappingType);
            Assert.NotNull(wrapped);
            var delegatingEnumerable = wrapped as DelegatingEnumerable<int, int>;
            Assert.NotNull(delegatingEnumerable);
            Assert.Equal(0, delegatingEnumerable.Count());
        }
    public void Wraps_EmptyCollections()
    {
        // Arrange
        var declaredEnumerableOfT = typeof(IEnumerable <int>);
        var wrapperProvider       = new EnumerableWrapperProvider(
            declaredEnumerableOfT,
            elementWrapperProvider: null);

        // Act
        var wrapped = wrapperProvider.Wrap(new int[] { });

        // Assert
        Assert.Equal(typeof(DelegatingEnumerable <int, int>), wrapperProvider.WrappingType);
        Assert.NotNull(wrapped);
        var delegatingEnumerable = wrapped as DelegatingEnumerable <int, int>;

        Assert.NotNull(delegatingEnumerable);
        Assert.Empty(delegatingEnumerable);
    }