public void NotThrowOnInRole()
        {
            //Given
            var claimsPrincipal = GetClaimPrincipalMockForRoles();
            var userContext     = new GraphQLUserContext(claimsPrincipal.Object);

            //When
            userContext.EnsureIsInRole("GrantedRole");
        }
        public void ThrowOnNotInRole()
        {
            //Given
            var claimsPrincipal = GetClaimPrincipalMockForRoles();
            var userContext     = new GraphQLUserContext(claimsPrincipal.Object);

            //Then
            var exception = Assert.Throws <ExecutionError>(() =>
            {
                //When
                userContext.EnsureIsInRole("NotGrantedRole");
            });

            Assert.Equal("Unauthorized. You have to be a member of NotGrantedRole role.", exception.Message);
        }