public void When_a_sending_a_command_to_the_processor_when_null_feature_switch_config() { _commandProcessor = new CommandProcessor(_registry, _handlerFactory, new InMemoryRequestContextFactory(), new PolicyRegistry()); _commandProcessor.Send(_myCommand); MyFeatureSwitchedConfigHandler.DidReceive(_myCommand).Should().BeTrue(); }
public void When_Sending_A_Command_To_The_Processor_When_A_Feature_Switch_Has_No_Config_And_Strategy_Is_SilentOff() { _featureSwitchRegistry.MissingConfigStrategy = MissingConfigStrategy.SilentOff; _commandProcessor = new CommandProcessor(_registry, _handlerFactory, new InMemoryRequestContextFactory(), new PolicyRegistry(), _featureSwitchRegistry); _commandProcessor.Send(_myCommand); MyFeatureSwitchedConfigHandler.DidReceive(_myCommand).Should().BeFalse(); }
public void When_Sending_A_Command_To_The_Processor_When_A_Feature_Switch_Is_Off_By_Fluent_Config() { var fluentConfig = FluentConfigRegistryBuilder .With() .StatusOf <MyFeatureSwitchedConfigHandler>().Is(FeatureSwitchStatus.Off) .Build(); _commandProcessor = new CommandProcessor(_registry, _handlerFactory, new InMemoryRequestContextFactory(), new PolicyRegistry(), fluentConfig); _commandProcessor.Send(_myCommand); MyFeatureSwitchedConfigHandler.DidReceive(_myCommand).Should().BeFalse(); }
public void When_Sending_A_Command_To_The_Processor_When_A_Feature_Switch_Has_No_Config_And_Strategy_Is_Exception() { _featureSwitchRegistry.MissingConfigStrategy = MissingConfigStrategy.Exception; _commandProcessor = new CommandProcessor(_registry, _handlerFactory, new InMemoryRequestContextFactory(), new PolicyRegistry(), _featureSwitchRegistry); _exception = Catch.Exception(() => _commandProcessor.Send(_myCommand)); _exception.Should().BeOfType <ConfigurationException>(); _exception.Should().NotBeNull(); _exception.Message.Should().Contain($"Handler of type {typeof(MyFeatureSwitchedConfigHandler).Name} does not have a Feature Switch configuration!"); MyFeatureSwitchedConfigHandler.DidReceive(_myCommand).Should().BeFalse(); }