internal AppView AppDetailInternal(App app, AppProject appProject) { var appView = default(AppView); if (appProject != null && app != null && !app.Id.IsNullOrEmpty() && !appProject.Id.IsNullOrEmpty()) { appView = EntityMapping.Auto<App, AppView>(app); appView.ApkName = appProject.PackageName; appView.AppNo = app.AppNo; appView.Company = appProject.Creator; appView.Rate = appProject.Rate.ToString(); appView.DownloadTimes = app.DownloadTimes; //image var imgInfos = app.ScreenShot; appView.ImageCount = imgInfos.Count; appView.ImageList = new List<string>(); imgInfos.ForEach(i => appView.ImageList.Add(i.Id + i.Extension)); appView.LogoFileName = AppStoreService.GetSingleAppImageUrl(app.Logo.Id); appView.ScreenShots = new List<string>(); foreach (var i in appView.ImageList) { appView.ScreenShots.Add(AppStoreService.GetSingleAppImageUrl(i)); } var appVersion = default(AppVersion); appVersion = AppStoreUIService.GetCurrentVersionForApp(app.Id); if (appVersion != null && appView != null) { var pkgInfo = AppStoreUIService.GetApkInfoForApp(app.Id, appVersion.Id, false); if (pkgInfo != null) { appView.MinSDKVersion = SingletonBase<AndroidVersionRepository>.Instance.GetVersionByAPILevel(pkgInfo.MinSDKVersion); } appView.Version = appVersion.Id; appView.VersionName = appVersion.VersionName; appView.PublishTime = appVersion.PublishDateTime; appView.FileSize = appVersion.FileSize; appView.DownloadUrl = (FILE_PREFIX + appVersion.FileUrl).ToFileServerUrlAPP(); } } return appView; }
private string GetAppDownloadUrlInternal(App app) { var version = AppStoreUIService.GetCurrentVersionForApp(app.Id); var downUrl = FILE_PREFIX + version.FileUrl; return (FILE_PREFIX + version.FileUrl).ToFileServerUrlAPP(); }
public void get_tag_list_test_normal() { #region Generate Data string lcd = "320x480"; #region app and tags var sortedTags = new List<Tag>(); var tag1 = new Tag() { Id = "1", Name = "工具", OrderNumber = 4 }; var tag2 = new Tag() { Id = "2", Name = "娱乐", OrderNumber = 6 }; var tagIds = new List<string>{ "1", "2" }; var tagIdsSortedByOrderNumber = new List<string> { "2", "1" }; sortedTags.Add(tag2); sortedTags.Add(tag1); App app1 = new App() { AppNo = "1", AppProjectId = "1", //ClientLogos="", CurrentVer = "1", Id = "1", Name = "app1", Price = 0.0, Rank = 3, ReviewCount = 3 }; App app2 = new App() { AppNo = "2", AppProjectId = "2", //ClientLogos="", CurrentVer = "2", Id = "2", Name = "app2", Price = 0.0, Rank = 4, ReviewCount = 4 }; App app3 = new App() { AppNo = "3", AppProjectId = "3", //ClientLogos="", CurrentVer = "3", Id = "3", Name = "app3", Price = 0.0, Rank = 4, ReviewCount = 4 }; App app4 = new App() { AppNo = "4", AppProjectId = "4", //ClientLogos="", CurrentVer = "4", Id = "4", Name = "app4", Price = 0.0, Rank = 5, ReviewCount = 5 }; App app5 = new App() { AppNo = "5", AppProjectId = "5", //ClientLogos="", CurrentVer = "5", Id = "5", Name = "app5", Price = 0.0, Rank = 5, ReviewCount = 1 }; App app6 = new App() { AppNo = "6", AppProjectId = "6", //ClientLogos="", CurrentVer = "6", Id = "6", Name = "app6", Price = 0.0, Rank = 2, ReviewCount = 4 }; #endregion var AppIds = new List<string>() { "1","2","3","4","5","6" }; var topThreeAppIdsForT1 = new List<string>() { "1","2","3" }; var topThreeAppIdsForT2 = new List<string>() { "4","5","6" }; var apps = new List<App>(); apps.Add(app1); apps.Add(app2); apps.Add(app3); #region Version var version1 = new AppVersion() { Id = "1", VersionName = "v1", FileSize = 5, FileUrl = "FileUrl1", }; var version2 = new AppVersion() { Id = "2", VersionName = "v2", FileSize = 5, FileUrl = "FileUrl2", }; var version3 = new AppVersion() { Id = "3", VersionName = "v3", FileSize = 5, FileUrl = "FileUrl3", }; var version4 = new AppVersion() { Id = "4", VersionName = "v4", FileSize = 5, FileUrl = "FileUrl4", }; var version5 = new AppVersion() { Id = "5", VersionName = "v5", FileSize = 5, FileUrl = "FileUrl5", }; var version6 = new AppVersion() { Id = "6", VersionName = "v6", FileSize = 5, FileUrl = "FileUrl6", }; #endregion #region App Project var appProject1 = new AppProject() { AppNo = "1", Id = "1", LogoFile = "LogoFile1", Name = "app project1", Rate = 1, ReviewCount = 1 }; var appProject2 = new AppProject() { AppNo = "2", Id = "2", LogoFile = "LogoFile2", Name = "app project2", Rate = 2, ReviewCount = 2 }; var appProject3 = new AppProject() { AppNo = "3", Id = "3", LogoFile = "LogoFile3", Name = "app project3", Rate = 3, ReviewCount = 3 }; var appProject4 = new AppProject() { AppNo = "4", Id = "4", LogoFile = "LogoFile4", Name = "app project4", Rate = 4, ReviewCount = 4 }; var appProject5 = new AppProject() { AppNo = "5", Id = "5", LogoFile = "LogoFile5", Name = "app project5", Rate = 5, ReviewCount = 5 }; var appProject6 = new AppProject() { AppNo = "6", Id = "6", LogoFile = "LogoFile6", Name = "app project6", Rate = 6, ReviewCount = 6 }; #endregion #endregion //_appStoreUIServiceMock.Setup(s => s.GetTagsByTagCategory(It.IsAny<string>())).Returns(tags); _appStoreUIServiceMock.Setup(s => s.GetAppIdsByTag("1")).Returns(AppIds); _appStoreUIServiceMock.Setup(s => s.GetAppIdsByTag("2")).Returns(AppIds); _appStoreUIServiceMock.Setup(s => s.GetAppIdsByTag("3")).Returns(AppIds); _redisServiceMock2.Setup(s => s.GetSortedIdsByProperty<App>(It.IsAny<List<string>>(), It.IsAny<string>(), 1, 3, true)).Returns(topThreeAppIdsForT2); _redisServiceMock.Setup(s => s.GetValuesByIds<App>(It.IsAny<List<string>>(), false)).Returns(apps); _redisServiceMock.Setup(s => s.GetValuesByIds<Element>(It.IsAny<List<string>>(), false)).Returns(new List<Element>()); _redisServiceMock.Setup(s => s.Get<AppProject>("1")).Returns(appProject1); _redisServiceMock.Setup(s => s.Get<AppProject>("2")).Returns(appProject2); _redisServiceMock.Setup(s => s.Get<AppProject>("3")).Returns(appProject3); _redisServiceMock.Setup(s => s.GetAllSubModelIdsByType<TagCategory, TagInTagCategory>("2")).Returns(tagIds); _redisServiceMock2.Setup(s => s.GetSortedIdsByProperty<Tag>(tagIds, "OrderNumber", 0, 0, true)).Returns(tagIdsSortedByOrderNumber); _redisServiceMock.Setup(s => s.GetValuesByIds<Tag>(tagIdsSortedByOrderNumber, false)).Returns(sortedTags); _redisServiceMock2.Setup(s => s.GetIntersectIdsByPropertyFromSets(It.IsAny<List<string>>(), It.IsAny<List<string>>())).Returns(AppIds); _appStoreUIServiceMock.Setup(s => s.GetTagIdByName("Valid")).Returns("1"); _appStoreUIServiceMock.Setup(s => s.GetAppIdsByTag("1")).Returns(AppIds); _redisServiceMock2.Setup(s => s.GetFilteredIdsByPropertyFromSets<App>(It.IsAny<List<string>>(), It.IsAny<string>())).Returns(AppIds); _appStoreUIServiceMock.Setup(s => s.GetCurrentVersionForApp("1")).Returns(version1); _appStoreUIServiceMock.Setup(s => s.GetCurrentVersionForApp("2")).Returns(version2); _appStoreUIServiceMock.Setup(s => s.GetCurrentVersionForApp("3")).Returns(version3); _appStoreUIServiceMock.Setup(s => s.GetAppIdsByTagNames(It.IsAny<List<string>>())).Returns(topThreeAppIdsForT1); List<WapTagListItem> resultList = appStoresWapUIService.GetTagList(lcd,"2"); Assert.Equal(resultList.Count, 2); Assert.Equal(resultList[1].TagId, "1"); Assert.Equal(resultList[0].TagAppList.Count, 3); Assert.Equal(resultList[0].TagName, "娱乐"); }