public async Task ThrowException_WhenNotificationIsNull()
        {
            var options = TestUtils.GetOptions(nameof(ThrowException_WhenNotificationIsNull));

            using (var assertContext = new CMContext(options))
            {
                var sut = new NotificationServices(assertContext, _userServices.Object,
                                                   _iNotificationManager.Object);
                var ex = await Assert.ThrowsExceptionAsync <MagicException>(
                    async() => await sut.MarkAsSeenAsync("15"));
            }
        }
        public async Task ThrowCorrectMessage_WhenPassedNotificationIdIsNull()
        {
            var options = TestUtils.GetOptions(nameof(ThrowCorrectMessage_WhenPassedNotificationIdIsNull));

            using (var assertContext = new CMContext(options))
            {
                var sut = new NotificationServices(assertContext, _userServices.Object,
                                                   _iNotificationManager.Object);
                var ex = await Assert.ThrowsExceptionAsync <MagicException>(
                    async() => await sut.MarkAsSeenAsync(null));

                Assert.AreEqual(ExceptionMessages.NotificationIdNull, ex.Message);
            }
        }
        public async Task MarkNotificationASeen_WhenCalledWithCorrectId()
        {
            var options        = TestUtils.GetOptions(nameof(MarkNotificationASeen_WhenCalledWithCorrectId));
            var notificationID = "15";
            var adminName      = "pesho";
            var id             = "1";
            var description    = "new";
            var userName       = "******";
            var notification   = new Notification
            {
                Id          = notificationID,
                Description = description,
                Username    = userName,
                UserId      = "1",
                IsSeen      = false
            };

            var admin = new AppUser
            {
                Id       = id,
                UserName = adminName
            };

            _userServices.Setup(x => x.GetAdmin())
            .ReturnsAsync(admin);

            using (var arrangeContext = new CMContext(options))
            {
                arrangeContext.Add(admin);
                arrangeContext.Add(notification);
                await arrangeContext.SaveChangesAsync();

                Assert.AreEqual(false, arrangeContext.Notifications.First().IsSeen);
                var sut = new NotificationServices(arrangeContext, _userServices.Object,
                                                   _iNotificationManager.Object);
                var result = await sut.MarkAsSeenAsync(notificationID);

                Assert.AreEqual(true, result.IsSeen);
            }
        }
        public async Task ReturnCorrectObjectType_WhenCalledWithCorrectId()
        {
            var options = TestUtils.GetOptions(nameof(ReturnCorrectObjectType_WhenCalledWithCorrectId));

            var adminName      = "pesho";
            var id             = "1";
            var description    = "new";
            var userName       = "******";
            var notificationID = "15";
            var notification   = new Notification
            {
                Id          = notificationID,
                Description = description,
                Username    = userName,
                UserId      = "1"
            };

            var admin = new AppUser
            {
                Id       = id,
                UserName = adminName
            };

            _userServices.Setup(x => x.GetAdmin())
            .ReturnsAsync(admin);

            using (var arrangeContext = new CMContext(options))
            {
                arrangeContext.Add(admin);
                arrangeContext.Add(notification);
                await arrangeContext.SaveChangesAsync();

                var sut = new NotificationServices(arrangeContext, _userServices.Object,
                                                   _iNotificationManager.Object);
                var result = await sut.MarkAsSeenAsync(notificationID);

                Assert.IsInstanceOfType(result, typeof(NotificationDTO));
            }
        }