Esempio n. 1
0
        public void SendAddToCartNotification()
        {
            _notificationSubscrubedUserMock.Setup(r => r.GetUserDeviceTokens(It.IsAny <long>())).Returns(_testTokens);
            _notificationRepoMock.Setup(r => r.Find(It.IsAny <Expression <Func <Notification, bool> > >()))
            .Returns(new List <Notification>());

            _notificationRepoMock.Setup(r => r.Add(It.IsAny <Notification>()))
            .Returns <Notification>(n => n);
            var notificationActual = _service.AddToCartNotify(new AddToCartNotifyDto()
            {
                ReceiverId  = 1,
                ProductName = "test"
            });

            Assert.IsNotNull(notificationActual);
            Assert.AreEqual(1, notificationActual.ReceiverId);
            Assert.AreEqual(NotificationHelper.FormatAddProductToCartMessage("test"), notificationActual.Message);
            Assert.AreEqual(BLResources.DefaultNotificationTitle, notificationActual.Title);
        }