public AuthorizeHubMethodInvocation ( IHubIncomingInvokerContext context, bool appliesToMethod ) : bool | ||
context | IHubIncomingInvokerContext | |
appliesToMethod | bool | |
return | bool |
static void Verify_AuthorizeHubMethodInvocation(bool isAuthenticated, bool isAuthorized, string methodName = null) { //------------Setup for test-------------------------- var authorizationProvider = new Mock<IAuthorizationService>(); authorizationProvider.Setup(p => p.IsAuthorized(It.IsAny<IAuthorizationRequest>())).Returns(isAuthorized); var attribute = new AuthorizeHubAttribute(authorizationProvider.Object); //------------Execute Test--------------------------- var response = attribute.AuthorizeHubMethodInvocation(CreateHubIncomingInvokerContext(isAuthenticated, methodName), false); //------------Assert Results------------------------- Assert.AreEqual(isAuthenticated && isAuthorized, response); }
public void AuthorizeHubAttribute_AuthorizeHubMethodInvocation_HubIncomingInvokerContextIsNull_ThrowsArgumentNullException() { //------------Setup for test-------------------------- var authorizationProvider = new Mock<IAuthorizationService>(); var attribute = new AuthorizeHubAttribute(authorizationProvider.Object); //------------Execute Test--------------------------- attribute.AuthorizeHubMethodInvocation(null, false); //------------Assert Results------------------------- }