public async Task Shouldnot_CreateGroupUseCase_WithRequestNull()
        {
            ArgumentNullException ex = await Assert.ThrowsAsync <ArgumentNullException>(() => _createGroupUseCase.Execute(null));

            ex.Should().NotBeNull();
            ex.Message.Should().Be("Value cannot be null. (Parameter 'CreateGroupRequest')");
        }
        public async Task UpdateRuleAsync_GivenNullRule_ThrowsArgumentNullException()
        {
            // Arrange
            Rule <ContentType, ConditionType> rule = null;

            IInMemoryRulesStorage <ContentType, ConditionType> inMemoryRulesStorage = Mock.Of <IInMemoryRulesStorage <ContentType, ConditionType> >();
            IRuleFactory <ContentType, ConditionType>          ruleFactory          = Mock.Of <IRuleFactory <ContentType, ConditionType> >();

            Mock.Get(ruleFactory)
            .Setup(x => x.CreateRule(rule))
            .Verifiable();

            Mock.Get(inMemoryRulesStorage)
            .Setup(x => x.UpdateRule(It.IsAny <RuleDataModel <ContentType, ConditionType> >()))
            .Verifiable();

            InMemoryProviderRulesDataSource <ContentType, ConditionType> inMemoryProviderRulesDataSource
                = new InMemoryProviderRulesDataSource <ContentType, ConditionType>(inMemoryRulesStorage, ruleFactory);

            // Act
            ArgumentNullException argumentNullException = await Assert.ThrowsAsync <ArgumentNullException>(async() =>
                                                                                                           await inMemoryProviderRulesDataSource.UpdateRuleAsync(rule).ConfigureAwait(false)
                                                                                                           ).ConfigureAwait(false);

            // Assert
            argumentNullException.Should().NotBeNull();
            argumentNullException.ParamName.Should().Be(nameof(rule));
        }
        public void Ctor_ArgumentNull()
        {
            // arrange, act
            ArgumentNullException ex = Capture <ArgumentNullException>(
                () => new TaskHubBackgroundService(null, null, null));

            // assert
            ex.Should().NotBeNull();
        }
Exemplo n.º 4
0
        public void Ctor_ArgumentNull()
        {
            // arrange, act
            ArgumentNullException ex = Capture <ArgumentNullException>(
                () => new ServiceProviderActivityMiddleware(null));

            // assert
            ex.Should().NotBeNull();
        }
Exemplo n.º 5
0
        public void CtorArgumentNull1()
        {
            // arrange, act
            ArgumentNullException ex = Capture <ArgumentNullException>(
                () => new WrapperObjectManager <object>(null, _ => null));

            // assert
            ex.Should().NotBeNull();
        }
Exemplo n.º 6
0
        public void CreateScope_ArgumentNullServiceProvider()
        {
            // arrange, act
            ArgumentNullException ex = Capture <ArgumentNullException>(
                () => OrchestrationScope.CreateScope(Guid.NewGuid().ToString(), null));

            // assert
            ex.Should().NotBeNull();
        }
Exemplo n.º 7
0
        public void CreateScope_ArgumentNullInstance()
        {
            // arrange, act
            ArgumentNullException ex = Capture <ArgumentNullException>(
                () => OrchestrationScope.CreateScope(null, GetServiceProvider()));

            // assert
            ex.Should().NotBeNull();
        }
Exemplo n.º 8
0
        public void CtorArgumentNull2()
        {
            // arrange, act
            ArgumentNullException ex = Capture <ArgumentNullException>(
                () => new WrapperObjectManager <object>(
                    Mock.Of <ITaskObjectCollection <object> >(), null));

            // assert
            ex.Should().NotBeNull();
        }
Exemplo n.º 9
0
        public void Error_GivenNullCollectionOfErrors_ThrowsArgumentNullException()
        {
            // Arrange
            IEnumerable <string> errors = null;

            // Act
            ArgumentNullException argumentNullException = Assert.Throws <ArgumentNullException>(() => RuleOperationResult.Error(errors));

            // Assert
            argumentNullException.Should().NotBeNull();
            argumentNullException.ParamName.Should().Be(nameof(errors));
        }
        public async Task InvokeAsync_ArgumentNullContext()
        {
            // arrange
            var middleware = new ServiceProviderOrchestrationMiddleware(Mock.Of <IServiceProvider>());

            // act
            ArgumentNullException ex = await Capture <ArgumentNullException>(
                () => middleware.InvokeAsync(null, () => Task.CompletedTask));

            // assert
            ex.Should().NotBeNull();
        }
        public void Failure_GivenNullErrorsCollection_ThrowsArgumentNullException()
        {
            // Arrange
            IEnumerable <string> expectedErrors = null;

            // Act
            ArgumentNullException argumentNullException = Assert.Throws <ArgumentNullException>(() => RuleBuilderResult.Failure <ContentType, ConditionType>(expectedErrors));

            // Arrange
            argumentNullException.Should().NotBeNull();
            argumentNullException.ParamName.Should().Be("errors");
        }
Exemplo n.º 12
0
        public async Task InvokeAsync_ArgumentNullNext()
        {
            // arrange
            var middleware = new ServiceProviderActivityMiddleware(Mock.Of <IServiceProvider>());

            // act
            ArgumentNullException ex = await Capture <ArgumentNullException>(
                () => middleware.InvokeAsync(CreateContext(null), null));

            // assert
            ex.Should().NotBeNull();
        }
        public void Success_GivenNullErrorsCollection_ThrowsArgumentNullException()
        {
            // Arrange
            Rule <ContentType, ConditionType> rule = null;

            // Act
            ArgumentNullException argumentNullException = Assert.Throws <ArgumentNullException>(() => RuleBuilderResult.Success <ContentType, ConditionType>(rule));

            // Arrange
            argumentNullException.Should().NotBeNull();
            argumentNullException.ParamName.Should().Be("rule");
        }
        public void SetInMemoryDataSource_GivenNullRulesDataSourceSelector_ThrowsArgumentNullException()
        {
            // Arrange
            IRulesDataSourceSelector <ContentType, ConditionType> rulesDataSourceSelector = null;

            // Act
            ArgumentNullException actual = Assert.Throws <ArgumentNullException>(() => rulesDataSourceSelector.SetInMemoryDataSource());

            // Assert
            actual.Should().NotBeNull();
            actual.ParamName.Should().Be(nameof(rulesDataSourceSelector));
        }
        public void Ctor_GivenNullParameters_ThrowsArgumentNullException(object param1, object param2)
        {
            // Arrange
            IInMemoryRulesStorage <ContentType, ConditionType> inMemoryRulesStorage = param1 as IInMemoryRulesStorage <ContentType, ConditionType>;
            IRuleFactory <ContentType, ConditionType>          ruleFactory          = param2 as IRuleFactory <ContentType, ConditionType>;

            // Act
            ArgumentNullException argumentNullException = Assert.Throws <ArgumentNullException>(() => new InMemoryProviderRulesDataSource <ContentType, ConditionType>(inMemoryRulesStorage, ruleFactory));

            //Assert
            argumentNullException.Should().NotBeNull();
            argumentNullException.ParamName.Should().BeOneOf(nameof(inMemoryRulesStorage), nameof(ruleFactory));
        }
        public async Task GetDatasetAggregationsForSpecificationId_WhenSpeficationIdIsEmpty_ShouldThrowException()
        {
            // Arrange
            IDatasetsApiClient            datasetsApiClient             = Substitute.For <IDatasetsApiClient>();
            IMapper                       mapper                        = CreateMapper();
            DatasetAggregationsRepository datasetAggregationsRepository = new DatasetAggregationsRepository(datasetsApiClient, CreateMapper());
            ArgumentNullException         exception                     = null;

            // Act
            try
            {
                IEnumerable <DatasetAggregation> configuredTaskAwaiter = await datasetAggregationsRepository.GetDatasetAggregationsForSpecificationId(string.Empty);
            }
            catch (Exception e)
            {
                exception = e as ArgumentNullException;
            }

            // Assert
            exception.Should().NotBeNull();
            exception.Should().BeOfType <ArgumentNullException>();
            await datasetsApiClient.DidNotReceive().GetDatasetAggregationsBySpecificationId(Arg.Any <string>());
        }
        public void WithSerializedContent_GivenNullContentSerializationProvider_ThrowsArgumentNullException()
        {
            // Assert
            IRuleBuilder <ContentType, ConditionType>   ruleBuilder = Mock.Of <IRuleBuilder <ContentType, ConditionType> >();
            IContentSerializationProvider <ContentType> contentSerializationProvider = null;

            // Act
            ArgumentNullException argumentNullException = Assert
                                                          .Throws <ArgumentNullException>(() => ruleBuilder.WithSerializedContent(ContentType.Type1, "TEST", contentSerializationProvider));

            // Assert
            argumentNullException.Should().NotBeNull();
            argumentNullException.ParamName.Should().Be(nameof(contentSerializationProvider));
        }
        public void GetBuildProjectBySpecificationId_WhenSpeficationIdIsEmpty_ShouldThrowException()
        {
            // Arrange
            ICalcsApiClientProxy   apiClientProxy         = Substitute.For <ICalcsApiClientProxy>();
            CalculationsRepository calculationsRepository = new CalculationsRepository(apiClientProxy);
            ArgumentNullException  exception = null;

            // Act
            try
            {
                var configuredTaskAwaiter = calculationsRepository.GetBuildProjectBySpecificationId(string.Empty).ConfigureAwait(false).GetAwaiter();
                configuredTaskAwaiter.GetResult();
            }
            catch (Exception e)
            {
                exception = e as ArgumentNullException;
            }

            // Assert
            exception.Should().NotBeNull();
            exception.Should().BeOfType <ArgumentNullException>();
            apiClientProxy.DidNotReceive().GetAsync <BuildProject>(Arg.Any <string>());
        }
Exemplo n.º 19
0
        public async Task GetTestScenariosBySpecificationId_WhenSpeficationIdIsEmpty_ShouldThrowException()
        {
            // Arrange
            IScenariosApiClient   scenariosApiClient  = Substitute.For <IScenariosApiClient>();
            ICacheProvider        cacheProvider       = CreateCacheProvider();
            ScenariosRepository   scenariosRepository = new ScenariosRepository(scenariosApiClient, cacheProvider, CreateMapper());
            ArgumentNullException exception           = null;

            // Act
            try
            {
                IEnumerable <TestScenario> configuredTaskAwaiter = await scenariosRepository.GetTestScenariosBySpecificationId(string.Empty);
            }
            catch (Exception e)
            {
                exception = e as ArgumentNullException;
            }

            // Assert
            exception.Should().NotBeNull();
            exception.Should().BeOfType <ArgumentNullException>();
            await scenariosApiClient.DidNotReceive().GetTestScenariosBySpecificationId(Arg.Any <string>());
        }
Exemplo n.º 20
0
        public void CreateRule_GivenNullRuleDataModel_ThrowsArgumentNullException()
        {
            // Arrange
            RuleDataModel <ContentType, ConditionType> ruleDataModel = null;

            RuleFactory <ContentType, ConditionType> ruleFactory = new RuleFactory <ContentType, ConditionType>();

            // Act
            ArgumentNullException argumentNullException = Assert.Throws <ArgumentNullException>(() => ruleFactory.CreateRule(ruleDataModel));

            // Assert
            argumentNullException.Should().NotBeNull();
            argumentNullException.ParamName.Should().Be(nameof(ruleDataModel));
        }
Exemplo n.º 21
0
        public void it_should_throw_when_no_provider_type_provided()
        {
            ArgumentNullException exception = null;

            try
            {
                ((UrsaConfigurationSection)ConfigurationManager.GetSection(UrsaConfigurationSection.ConfigurationSectionGroupName)).GetProvider <IConverterProvider>(null);
            }
            catch (ArgumentNullException error)
            {
                exception = error;
            }

            exception.Should().NotBeNull();
        }
Exemplo n.º 22
0
        public void it_should_throw_when_initializing_without_converters()
        {
            ArgumentNullException exception = null;

            try
            {
                new DefaultConverterProvider().Initialize(null);
            }
            catch (ArgumentNullException error)
            {
                exception = error;
            }

            exception.Should().NotBeNull();
        }
        public void CreateRule_GivenNullRule_ThrowsArgumentNullException()
        {
            // Arrange
            Rule <ContentType, ConditionType> rule = null;

            IContentSerializationProvider <ContentType> contentSerializationProvider = Mock.Of <IContentSerializationProvider <ContentType> >();

            RuleFactory <ContentType, ConditionType> ruleFactory = new RuleFactory <ContentType, ConditionType>(contentSerializationProvider);

            // Act
            ArgumentNullException argumentNullException = Assert.Throws <ArgumentNullException>(() => ruleFactory.CreateRule(rule));

            // Assert
            argumentNullException.Should().NotBeNull();
            argumentNullException.ParamName.Should().Be(nameof(rule));
        }
    public void Should_Throw_For_Null_TableName()
    {
        //Arrange
        var subject = new SubjectUnderTest(null);
        ArgumentNullException exception = null;
        var expected = "tableName";

        //Act
        try {
            subject.BatchSave <object>(null, null);
        } catch (ArgumentNullException e) {
            exception = e;
        }
        //Assert
        exception.Should().NotBeNull();
        exception.ParamName.Should().Be(expected);
    }
        public void ToValue_Throws_ArgumentNullException_If_Type_Is_Null()
        {
            // arrange
            ArgumentNullException exceptionThrown = null;

            // act
            try
            {
                this.CreateConverter()
                .ToValue("identifier", null);
            }
            catch (ArgumentNullException exception)
            {
                exceptionThrown = exception;
            }

            // assert
            exceptionThrown.Should().NotBeNull();
            exceptionThrown.ParamName.Should().Be("type");
        }
Exemplo n.º 26
0
        public void CompareWithNull(object o1, object o2, string paramName)
        {
            //Arrange.
            ObjectComparer comparer = ObjectComparer.Create <Person>();

            //Act.
            Action act = () => comparer.Compare(o1, o2);
            ArgumentNullException ex = null;

            try
            {
                act();
            }
            catch (ArgumentNullException aex)
            {
                ex = aex;
            }

            //Assert.
            act.Should().Throw <ArgumentNullException>();
            ex.Should().NotBeNull();
            ex.ParamName.Should().Be(paramName);
        }
        public void TestsExcepcionArgumentoNuloHeredaDeExcepcion()
        {
            var ex = new ArgumentNullException();

            ex.Should().BeAssignableTo <Exception>("tampoco vamos a inventar la polvora...");
        }
Exemplo n.º 28
0
 public void Then_It_Should_Throw_An_ArgumentNullException()
 {
     _exception.Should().NotBeNull();
 }