public void WhenGettingUserWithNullToken_ThenThrowsArgumentNullException()
        {
            var services = new UserServices(new Mock<IUserRepository>().Object);

            var ex = Assert.Throws<BusinessServicesException>(() => services.GetUserByClaimedIdentifier(null));
            Assert.IsType<ArgumentNullException>(ex.InnerException);
        }
        public void WhenGettingUser_ThenReturnsUser()
        {
            var userRepositoryMock = new Mock<IUserRepository>();
            var dataUser = new Model.User {UserId = 1, DisplayName = "test"};

            userRepositoryMock
                .Setup(ur => ur.GetByAuthenticatedId(It.IsAny<string>()))
                .Returns(dataUser);

            var services = new UserServices(userRepositoryMock.Object);

            var returnedUser = services.GetUserByClaimedIdentifier("something");

            Assert.NotNull(returnedUser);
            Assert.Equal("test", returnedUser.DisplayName);
        }
        public void WhenGettingUserAndRepositoryThrows_ThenWrapsException()
        {
            var userRepositoryMock = new Mock<IUserRepository>();
            userRepositoryMock.Setup(u => u.GetByAuthenticatedId(It.IsAny<string>()))
                .Throws<InvalidOperationException>();

            var services = new UserServices(userRepositoryMock.Object);

            var ex = Assert.Throws<BusinessServicesException>(() => services.GetUserByClaimedIdentifier("test"));
            Assert.IsType<InvalidOperationException>(ex.InnerException);
        }