コード例 #1
0
        public void CheckUpdate()
        {
            var otaUpdateInfoView = new OTAUpdateInfoView()
            {
                IsAutoDownload = false,
                NextCheckTime = DateTime.Now.AddHours(2),
                Version = "1.2.1",
                ReleaseNotes = new List<OTAVersionView> { new OTAVersionView { ReleaseNote = "release note" } },
                IsShowOTAInfo = true,
                Id = "1",
                FileSize = 334333,
                HasNewVersion = true
            };

            //this.MockOTAService.Setup(x => x.GetOTAUpdateInfo(It.IsAny<MobileParam>())).Returns(otaUpdateInfoView);

            this.MockOTAService.Setup(x => x.GetOTAUpdateInfo(It.IsAny<MobileParam>())).Returns(otaUpdateInfoView);

            //act
            var ret = this.Controller.CheckUpdate(IMSI).ContentResultData();

            var retObj = JsonConvert.DeserializeObject<JsonSingleDataResult<OTAUpdateInfoView>>(ret);

            Assert.Equal(retObj.Data.Id, otaUpdateInfoView.Id);
            Assert.Equal(retObj.Data.IsAutoDownload, otaUpdateInfoView.IsAutoDownload);
            Assert.Equal(retObj.Data.Version, otaUpdateInfoView.Version);
            Assert.Equal(retObj.Data.FileSize, otaUpdateInfoView.FileSize);
        }
コード例 #2
0
ファイル: OTAServiceFake.cs プロジェクト: itabas016/AppStores
        public OTAUpdateInfoView GetOTAUpdateInfo(MobileParam requestParams)
        {
            // get client Version and App No from MobileParam.Batch

            // Match App branch by client Version

            // Get the latest version of the app , compare it with client Version

            // return OTA update info

            OTAUpdateInfoView otaInfo = new OTAUpdateInfoView
            {
                HasNewVersion = true,
                NextCheckTime = DateTime.Now.AddDays(6).AddMilliseconds(OTARandom.Next(86300000)),
                IsShowOTAInfo = true,
                ReleaseNotes =new List<OTAVersionView>{
                    new OTAVersionView{
                        VersionName = "1.0.5",
                        PublishTime = DateTime.Now.AddDays(-10),
                        ReleaseNote = "1. 更新了经常死机的问题\r\n2. 更新了通讯录不能同步的问题"
                    }},
                PushInfo = "push information",
                FileSize = 12312,
                IsAutoDownload = true,
                Version = "v10001",
                Id = "10001"
            };

            return otaInfo;
        }
コード例 #3
0
        public void Download()
        {
            var otaUpdateInfoView = new OTAUpdateInfoView()
            {
                IsAutoDownload = false,
                NextCheckTime = DateTime.Now.AddHours(2),
                Version = "1.2.1",
                ReleaseNotes = new List<OTAVersionView> { new OTAVersionView { ReleaseNote = "release note" } },
                IsShowOTAInfo = true,
                Id = "1",
                FileSize = 334333,
                HasNewVersion = true
            };

            var id = "23343";
            var url = "http://file.kk570.com/a/b.apk";

            //this.MockOTAService.Setup(x => x.GetOTADownloadUrl(id, It.IsAny<MobileParam>())).Returns(url);

            this.MockOTAService.Setup(x => x.GetOTADownloadUrl(id, It.IsAny<MobileParam>())).Returns(url);
            //act
            var ret = this.Controller.Download(IMSI, id).RedirectedUrl();

            Assert.Equal(url, ret);
        }