public async Task UpdateRuleAsync_GivenRule_ConvertsToRuleDataModelAndUpdatesOnDataSource()
        {
            // Arrange
            Rule <ContentType, ConditionType>          rule          = new Rule <ContentType, ConditionType>();
            RuleDataModel <ContentType, ConditionType> ruleDataModel = new RuleDataModel <ContentType, ConditionType>();

            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))
            .Returns(ruleDataModel)
            .Verifiable();

            Mock.Get(inMemoryRulesStorage)
            .Setup(x => x.UpdateRule(ruleDataModel))
            .Verifiable();

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

            // Act
            await inMemoryProviderRulesDataSource.UpdateRuleAsync(rule).ConfigureAwait(false);

            // Assert
            Mock.VerifyAll(Mock.Get(inMemoryRulesStorage), Mock.Get(ruleFactory));
        }
        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));
        }