示例#1
0
        public void GetOfferAfterFirstTimeNotification_Test()
        {
            PersistantDevice persistantDevice = new PersistantDevice()
            {
                Clubcard = "222222222",
                EmailId = "*****@*****.**",
                GcmToken = "TR000001",
                Id = "1234555",
                Mobile = "9999999999",
                Name = "Test"
            };

            PersistantOffer offer = new PersistantOffer()
            {
                Name = "test Offer",
                Description = "Test Offer Description",
                ImagePath = "Image test path",
                OfferCode = "Offer Code"
            };
            List<PersistantOffer> lstPersistantOffer = new List<PersistantOffer>();
            lstPersistantOffer.Add(offer);

            _persist.Setup(r => r.GetDeviceDetailsByDeviceId(It.IsAny<string>())).Returns(persistantDevice);
            _persist.Setup(r => r.GetOffers(It.IsAny<string>(), It.IsAny<string>())).Returns(lstPersistantOffer);
            _persist.Setup(r => r.NotificationStatusForDevice(It.IsAny<string>())).Returns(true);
            _persist.Setup(r => r.UpdateNotificationStatus(It.IsAny<string>(), It.IsAny<DateTime>()));
            IP2PBusinessLogic business = new P2PBusinessLogic(_persist.Object);
            var result = business.GetOffers("test device id", "test store id", false);
            Assert.IsNotNull(result);
        }
示例#2
0
        public void UpdateDevice_Test()
        {
            Device _device = new Device()
            {
                Name = "Test Name",
                Id = "Device ID",
                GcmToken = "Test GCM Token",
                Mobile = "9999999999",
                EmailId = "*****@*****.**",
                Clubcard = "2345677765"
            };

            PersistantDevice persistantDevice = new PersistantDevice()
            {
                Clubcard = "222222222",
                EmailId = "*****@*****.**",
                GcmToken = "TR000001",
                Id = "1234555",
                Mobile = "9999999999",
                Name = "Test"
            };

            _persist.Setup(r => r.GetDeviceDetailsByDeviceId(It.IsAny<string>())).Returns(persistantDevice);
            _persist.Setup(r => r.RegisterDevice(It.IsAny<PersistantDevice>())).Returns(true);
            IP2PBusinessLogic business = new P2PBusinessLogic(_persist.Object);
            var result = business.RegisterDevice(_device);
            Assert.IsTrue(result);
        }