public void Should_return_null_when_loading_policy_with_constructor_arguments() { // Arrange SecurityConfigurator.Configure(configuration => {}); var lazySecurityPolicy = new LazySecurityPolicy <PolicyWithConstructorArguments>(); // Act var policy = lazySecurityPolicy.Load(); // Assert Assert.That(policy, Is.Null); }
public void Should_handle_loading_policy_with_empty_constructor_based_on_SecurityPolicyBase() { // Arrange SecurityConfigurator.Configure(configuraiton => {}); var lazySecurityPolicy = new LazySecurityPolicy <PolicyWithBaseClass>(); // Act var policy = lazySecurityPolicy.Load(); // Assert Assert.That(policy, Is.TypeOf <PolicyWithBaseClass>()); }
public void Should_return_null_when_no_policy_is_returned_by_service_locator() { // Arrange SecurityConfigurator.Configure(configuration => configuration.ResolveServicesUsing(t => Enumerable.Empty <object>())); var lazySecurityPolicy = new LazySecurityPolicy <PolicyWithConstructorArguments>(); // Act var policy = lazySecurityPolicy.Load(); // Assert Assert.That(policy, Is.Null); }
public void Should_handle_loading_policy_from_container() { // Arrange var expectedPolicy = new PolicyWithConstructorArguments("arg1", "arg2", "arg3"); FakeIoC.GetAllInstancesProvider = () => new List <object> { expectedPolicy }; SecurityConfigurator.Configure(configuration => { configuration.GetAuthenticationStatusFrom(() => true); configuration.ResolveServicesUsing(FakeIoC.GetAllInstances); }); var lazySecurityPolicy = new LazySecurityPolicy <PolicyWithConstructorArguments>(); // Act var policy = lazySecurityPolicy.Load(); // Assert Assert.That(policy, Is.EqualTo(expectedPolicy)); }