public void Should_remove_convention() { // Arrange var model = new SecurityRuntime(); var advancedConfiguration = new AdvancedConfiguration(model); var convention = new MockConvention(); advancedConfiguration.Conventions(conventions => conventions.Add(convention)); Assert.That(model.Conventions.Contains(convention), Is.True); // Act advancedConfiguration.Conventions(conventions => conventions.Remove(convention)); // Assert Assert.That(model.Conventions.Contains(convention), Is.False); }
public void Should_throw_when_action_is_null() { // Arrange var model = new SecurityRuntime(); var advancedConfiguration = new AdvancedConfiguration(model); // Act & Assert Assert.Throws <ArgumentNullException>(() => advancedConfiguration.Conventions(null)); }
public void Should_add_convention() { // Arrange var model = new SecurityRuntime(); var advancedConfiguration = new AdvancedConfiguration(model); var expectedConvention = new MockConvention(); // Act advancedConfiguration.Conventions(conventions => conventions.Add(expectedConvention)); // Assert Assert.That(model.Conventions.Contains(expectedConvention), Is.True); }
public void Should_remove_matching_convention() { // Arrange var model = new SecurityRuntime(); var advancedConfiguration = new AdvancedConfiguration(model); Assert.That(model.Conventions.Any(c => c is FindByPolicyNameConvention), Is.True); // Act advancedConfiguration.Conventions(conventions => conventions.RemoveAll(c => c is FindByPolicyNameConvention)); // Assert Assert.That(model.Conventions.Any(c => c is FindByPolicyNameConvention), Is.False); }