예제 #1
0
        public async void NotificationsController_MarkNotificationAsRead_ShouldCallServiceToMarkNotificationAsRead()
        {
            // Arrange
            _mockNotificationService.Setup(_ => _.MarkNotificationAsRead(It.IsAny <string>(), It.IsAny <int>())).Returns(Task.Delay(0));

            var principal = new ClaimsPrincipal(new ClaimsIdentity(new List <Claim>
            {
                new Claim(ClaimTypes.NameIdentifier, "UserId")
            }));

            _mockAuthenticationManager.SetupGet(_ => _.User).Returns(principal);

            // Act
            await _controller.MarkNotificationAsRead(1);

            // Assert
            Mock.VerifyAll();
        }