예제 #1
0
            public void Should_guard_against_null()
            {
                // Arrange
                IErrorFromExceptionFactory     nullErrorFromExceptionFactory     = null;
                IErrorFromDictionaryFactory    nullErrorFromDictionaryFactory    = null;
                IErrorFromKeyValuePairFactory  nullErrorFromKeyValuePairFactory  = null;
                IErrorFromRawValuesFactory     nullErrorFromRawValuesFactory     = null;
                IErrorFromIdentityErrorFactory nullErrorFromIdentityErrorFactory = null;

                // Act & Assert
                Assert.Throws <ArgumentNullException>(
                    () => new DefaultErrorFactory(
                        nullErrorFromExceptionFactory,
                        _errorFromDictionaryFactoryMock.Object,
                        _errorFromKeyValuePairFactoryMock.Object,
                        _errorFromRawValuesFactoryMock.Object,
                        _errorFromIdentityErrorFactoryMock.Object
                        )
                    );
                Assert.Throws <ArgumentNullException>(
                    () => new DefaultErrorFactory(
                        _errorFromExceptionFactoryMock.Object,
                        nullErrorFromDictionaryFactory,
                        _errorFromKeyValuePairFactoryMock.Object,
                        _errorFromRawValuesFactoryMock.Object,
                        _errorFromIdentityErrorFactoryMock.Object
                        )
                    );
                Assert.Throws <ArgumentNullException>(
                    () => new DefaultErrorFactory(
                        _errorFromExceptionFactoryMock.Object,
                        _errorFromDictionaryFactoryMock.Object,
                        nullErrorFromKeyValuePairFactory,
                        _errorFromRawValuesFactoryMock.Object,
                        _errorFromIdentityErrorFactoryMock.Object
                        )
                    );
                Assert.Throws <ArgumentNullException>(
                    () => new DefaultErrorFactory(
                        _errorFromExceptionFactoryMock.Object,
                        _errorFromDictionaryFactoryMock.Object,
                        _errorFromKeyValuePairFactoryMock.Object,
                        nullErrorFromRawValuesFactory,
                        _errorFromIdentityErrorFactoryMock.Object
                        )
                    );
                Assert.Throws <ArgumentNullException>(
                    () => new DefaultErrorFactory(
                        _errorFromExceptionFactoryMock.Object,
                        _errorFromDictionaryFactoryMock.Object,
                        _errorFromKeyValuePairFactoryMock.Object,
                        _errorFromRawValuesFactoryMock.Object,
                        nullErrorFromIdentityErrorFactory
                        )
                    );
            }
예제 #2
0
            public void Should_guard_against_null()
            {
                // Arrange
                IErrorFromRawValuesFactory nullErrorFromRawValuesFactory = null;

                // Act & Assert
                var argEx = Assert.Throws <ArgumentNullException>(() => new DefaultErrorFromIdentityErrorFactory(nullErrorFromRawValuesFactory));

                Assert.Equal("errorFromRawValuesFactory", argEx.ParamName);
            }
            public void Should_guard_against_null()
            {
                // Arrange
                IErrorFromRawValuesFactory nullDependency = null;

                // Act & Assert
                var exception = Assert.Throws <ArgumentNullException>(
                    () => new DefaultErrorFromKeyValuePairFactory(nullDependency)
                    );
            }
예제 #4
0
 public DefaultErrorFactory(
     IErrorFromExceptionFactory errorFromExceptionFactory,
     IErrorFromDictionaryFactory errorFromDictionaryFactory,
     IErrorFromKeyValuePairFactory errorFromKeyValuePairFactory,
     IErrorFromRawValuesFactory errorFromRawValuesFactory,
     IErrorFromIdentityErrorFactory errorFromIdentityErrorFactory
     )
 {
     _errorFromExceptionFactory     = errorFromExceptionFactory ?? throw new ArgumentNullException(nameof(errorFromExceptionFactory));
     _errorFromDictionaryFactory    = errorFromDictionaryFactory ?? throw new ArgumentNullException(nameof(errorFromDictionaryFactory));
     _errorFromKeyValuePairFactory  = errorFromKeyValuePairFactory ?? throw new ArgumentNullException(nameof(errorFromKeyValuePairFactory));
     _errorFromRawValuesFactory     = errorFromRawValuesFactory ?? throw new ArgumentNullException(nameof(errorFromRawValuesFactory));
     _errorFromIdentityErrorFactory = errorFromIdentityErrorFactory ?? throw new ArgumentNullException(nameof(errorFromIdentityErrorFactory));
 }
            public void Should_guard_against_null()
            {
                // Arrange
                IHostingEnvironment        nullEnvironmentDependency = null;
                IErrorFromRawValuesFactory nullFactoryDependency     = null;

                // Act & Assert
                Assert.Throws <ArgumentNullException>(
                    () => new DefaultErrorFromExceptionFactory(nullEnvironmentDependency, nullFactoryDependency)
                    );
                Assert.Throws <ArgumentNullException>(
                    () => new DefaultErrorFromExceptionFactory(_hostingEnvironmentMock.Object, nullFactoryDependency)
                    );
                Assert.Throws <ArgumentNullException>(
                    () => new DefaultErrorFromExceptionFactory(nullEnvironmentDependency, _errorFromRawValuesFactoryMock.Object)
                    );
            }
 public DefaultErrorFromKeyValuePairFactory(IErrorFromRawValuesFactory errorFromRawValuesFactory)
 {
     _errorFromRawValuesFactory = errorFromRawValuesFactory ?? throw new ArgumentNullException(nameof(errorFromRawValuesFactory));
 }
예제 #7
0
 public DefaultErrorFromExceptionFactory(IHostingEnvironment hostingEnvironment, IErrorFromRawValuesFactory errorFromRawValuesFactory)
 {
     _hostingEnvironment        = hostingEnvironment ?? throw new ArgumentNullException(nameof(hostingEnvironment));
     _errorFromRawValuesFactory = errorFromRawValuesFactory ?? throw new ArgumentNullException(nameof(errorFromRawValuesFactory));
 }