public void Test_GetAppOs()
 {
     _targetObj.GetAppOs("");
 }
Exemplo n.º 2
0
        public void Get_Available_App_Description()
        {
            //Arrange
            string appID   = "4beedc78-0d31-496e-bb9c-81a79c9c6bc6";
            int    appOsID = 2;
            byte   osType  = 1;

            TResult <AppOsDetailsViewModel> expectedResponse = new TResult <AppOsDetailsViewModel>
            {
                data = new AppOsDetailsViewModel
                {
                    Description = new AppDescription
                    {
                        AppID         = "4beedc78-0d31-496e-bb9c-81a79c9c6bc6",
                        AppName       = "Test AppName",
                        AppNameEn     = "Test AppName",
                        Category      = "wistron App",
                        Email         = "*****@*****.**",
                        CompanyApp    = true,
                        Development   = "MCP.Devloper",
                        DescriptionCh = "App說明-中文",
                        DescriptionEn = "App說明-英文",
                        LastUpdateDT  = DateTime.Now
                    },
                    AppNowVersion = new AppOsInfo
                    {
                        AppOSID       = 2,
                        AppID         = "4beedc78-0d31-496e-bb9c-81a79c9c6bc6",
                        OSType        = 1,
                        AppName       = "Test AppName",
                        AppNameEn     = "Test AppName",
                        PackageName   = "com.wistron.portalapp.dev",
                        Version       = "1.0.0",
                        FileName      = "PortalApp2.0/IOS/Install/0.2.1-ef04db152ccd4d1893998ec1f07fcc06.ipa",
                        FilePath      = "PortalApp2.0/IOS/Install/b2fcbfb55f5e4aa4a75a40e5ea09b514.plist",
                        Status        = true,
                        WebDownFlag   = true,
                        DescriptionCh = "版本更新 1.0.0",
                        DescriptionEn = "The version is update 1.0.0",
                        CreateDT      = DateTime.Now,
                        LastUpdateDT  = DateTime.Now,
                        AppOsHistory  = new List <AppOsInfo>(),
                        Photo         = new List <AppPhotoContent>()
                    },
                    AppOsHistory = new List <AppOsInfo>(),
                    Photo        = new List <AppPhotoContent>()
                },
                Rtncode = FaultInfoRcConstants.OK,
                RtnMsg  = "OK"
            };

            _appListService.GetAppName(appID).Returns(_wisAppList);
            _appListService.GetAppOs(appID).Returns(_wisAppOs);
            _uploadFileService.GetPhotos(appID).Returns(_wisAppPhoto);
            _uploadFileService.GetWisAppOsOther(appID, appOsID.ToString()).Returns(new List <WisAppOsOther>());
            //Act
            TResult <AppOsDetailsViewModel> actualResponse = _targetObj.GetAvailbleAppDescription(appID, appOsID, osType);

            //Assert
            Assert.AreEqual(expectedResponse.Rtncode, actualResponse.Rtncode);
            Assert.AreEqual(expectedResponse.RtnMsg, actualResponse.RtnMsg);
            Assert.AreEqual(expectedResponse.data.AppNowVersion.AppID, actualResponse.data.AppNowVersion.AppID);
            //會超過5筆 需驗證 是否 最多只取5筆
            Assert.AreEqual(5, actualResponse.data.AppOsHistory.Count);
        }
Exemplo n.º 3
0
        public void First_Create_AppName_Ios_Android_Is_Default_Value()
        {
            //Arrange
            _appListService.GetAppName(_appID).Returns(_wisAppList);
            _appListService.GetAppOs(_appID).Returns(_wisAppOs);
            _uploadFileService.GetPhotos(_appID).Returns(_wisAppPhoto);
            _appListService.GetDefineGroup(Arg.Any <List <string> >()).Returns(_wisDefineGroup);

            TResult <AppEditViewModel> expectedResponse = new TResult <AppEditViewModel>
            {
                Data = new AppEditViewModel
                {
                    AppName = new AppNameCreate
                    {
                        AppID            = "4beedc78-0d31-496e-bb9c-81a79c9c6bc6",
                        IsTop            = true,
                        CompanyApp       = true,
                        AppName          = "Test AppName",
                        AppNameEn        = "Test AppName",
                        Development      = "MCP.Devloper",
                        Email            = "*****@*****.**",
                        Category         = "wistron App",
                        DescriptionCh    = "App說明-中文",
                        DescriptionEn    = "App說明-英文",
                        AppOpen          = true,
                        AppUserGroup     = "1,2",
                        AppUserGroupName = "WZS All users,ML10-Dept"
                    },
                    AppIos = new AppOsInfo
                    {
                        AppID        = "4beedc78-0d31-496e-bb9c-81a79c9c6bc6",
                        AppOSID      = 3,
                        OSType       = DeviceType.Ios,
                        AppName      = "Test AppName",
                        AppNameEn    = "Test AppName",
                        Status       = true,
                        AppOsHistory = new List <AppOsInfo>(),
                        Photo        = new List <AppPhotoContent>()
                    },
                    AppAndroid = new AppOsInfo
                    {
                        AppID        = "4beedc78-0d31-496e-bb9c-81a79c9c6bc6",
                        AppOSID      = 4,
                        OSType       = DeviceType.Android,
                        AppName      = "Test AppName",
                        AppNameEn    = "Test AppName",
                        Status       = true,
                        AppOsHistory = new List <AppOsInfo>(),
                        Photo        = new List <AppPhotoContent>()
                    }
                },
                Rtncode = FaultInfoRcConstants.OK,
                RtnMsg  = "OK"
            };

            //Act
            TResult <AppEditViewModel> actualResponse = _targetObj.GetCreateAndEditApp(_appID, _appOsID, _appOsType);

            //Assert
            Assert.AreEqual(expectedResponse.Rtncode, actualResponse.Rtncode);
            Assert.AreEqual(expectedResponse.RtnMsg, actualResponse.RtnMsg);
            Assert.AreEqual(expectedResponse.Data.AppName.AppID, actualResponse.Data.AppName.AppID);
            // check the user group
            Assert.AreEqual(expectedResponse.Data.AppName.AppUserGroupName, actualResponse.Data.AppName.AppUserGroupName);
        }