public void TestGetUserIdForLoggedUser(string expectedUserId) { // Arrange var claimMock = new Mock <Claim>("id", expectedUserId); _httpContextAccessorMock.Setup(x => x.HttpContext.User.FindFirst(It.IsAny <string>())).Returns(claimMock.Object); // Act var userId = _authorizedUserHelper.GetAuthorizedUserId(); // Assert _httpContextAccessorMock.Verify(x => x.HttpContext.User.FindFirst(It.IsAny <string>()), Times.Once()); userId.Should().NotBe(Guid.Empty); userId.ShouldBeEquivalentTo(new Guid(expectedUserId)); }
public IEnumerable <Event> GetAllForAuthorizedUser() { var authorizedUserId = _authorizedUserHelper.GetAuthorizedUserId(); return(_eventStore.GetAllForUserId(authorizedUserId)); }