示例#1
0
        public void TestAddNotification()
        {
            var contextMock = new Mock <HttpContext>();

            contextMock.Setup(x => x.User).Returns(new ClaimsPrincipal(claims));
            mockNotificationService.Setup(x => x.Add(It.IsAny <Notification>())).Returns(notification);
            var _notificationController = new NotificationController(mockNotificationService.Object);

            _notificationController.ControllerContext.HttpContext = contextMock.Object;
            var accountReturn = _notificationController.AddNotification(notification);
            var type          = accountReturn.GetType();

            Assert.AreEqual(type.Name, "OkObjectResult");
        }