public void execution_is_denied() { var context = new InMemoryCommunicationContext(); var authenticationInterceptor = new RequiresAuthenticationInterceptor(context); authenticationInterceptor.BeforeExecute(new Mock<IOperation>().Object) .ShouldBeFalse(); context.OperationResult.ShouldBeOfType<OperationResult.Unauthorized>(); }
public void execution_is_allowed() { var context = new InMemoryCommunicationContext(); context.User = new GenericPrincipal(new GenericIdentity("name"), null); var authenticationInterceptor = new RequiresAuthenticationInterceptor(context); authenticationInterceptor.BeforeExecute(new Mock<IOperation>().Object) .ShouldBeTrue(); }