Exemple #1
0
        public void FindIndex_GuardClauses()
        {
            // Arrange
            var config          = new HttpConfiguration();
            var defaultServices = new DefaultServices(config);

            // Act & assert
            Assert.ThrowsArgumentNull(() => defaultServices.FindIndex(serviceType: null, match: _ => true), "serviceType");
            Assert.ThrowsArgumentNull(() => defaultServices.FindIndex(typeof(object), match: null), "match");
            Assert.ThrowsArgument(
                () => defaultServices.FindIndex(typeof(object), _ => true),
                "serviceType",
                "The service type Object is not supported.");
        }
Exemple #2
0
        public void FindIndex_FailedFind()
        {
            // Arrange
            var config          = new HttpConfiguration();
            var defaultServices = new DefaultServices(config);

            // Act
            int index = defaultServices.FindIndex(typeof(IFilterProvider), _ => false);

            // Assert
            Assert.Equal(-1, index);
        }
Exemple #3
0
        public void FindIndex_EmptyServiceListAlwaysReturnsFailure()
        {
            // Arrange
            var config          = new HttpConfiguration();
            var defaultServices = new DefaultServices(config);

            defaultServices.Clear(typeof(IFilterProvider));

            // Act
            int index = defaultServices.FindIndex(typeof(IFilterProvider), _ => true);

            // Assert
            Assert.Equal(-1, index);
        }
        public void FindIndex_EmptyServiceListAlwaysReturnsFailure()
        {
            // Arrange
            var config = new HttpConfiguration();
            var defaultServices = new DefaultServices(config);
            defaultServices.Clear(typeof(IFilterProvider));

            // Act
            int index = defaultServices.FindIndex(typeof(IFilterProvider), _ => true);

            // Assert
            Assert.Equal(-1, index);
        }
        public void FindIndex_FailedFind()
        {
            // Arrange
            var config = new HttpConfiguration();
            var defaultServices = new DefaultServices(config);

            // Act
            int index = defaultServices.FindIndex(typeof(IFilterProvider), _ => false);

            // Assert
            Assert.Equal(-1, index);
        }
        public void FindIndex_GuardClauses()
        {
            // Arrange
            var config = new HttpConfiguration();
            var defaultServices = new DefaultServices(config);

            // Act & assert
            Assert.ThrowsArgumentNull(() => defaultServices.FindIndex(serviceType: null, match: _ => true), "serviceType");
            Assert.ThrowsArgumentNull(() => defaultServices.FindIndex(typeof(object), match: null), "match");
            Assert.ThrowsArgument(
                () => defaultServices.FindIndex(typeof(object), _ => true),
                "serviceType",
                "The service type Object is not supported.");
        }