public void Test_GetDefineGroup()
        {
            List <string> groupID = new List <string> {
                ""
            };

            _targetObj.GetDefineGroup(groupID);
        }
        public void Insert_AppName_Is_Successful()
        {
            //Arrange
            TResult <ResponseAppNameCreate> expectedResponse = new TResult <ResponseAppNameCreate>
            {
                Data = new ResponseAppNameCreate
                {
                    IsSuccessful = true,
                    AppID        = "4beedc78-0d31-496e-bb9c-81a79c9c6bc6"
                },
                Rtncode = FaultInfoRcConstants.OK,
                RtnMsg  = "Test AppName"
            };

            _appListService.AppNameIsExisted(_request.AppName).Returns(false);
            _appListService.GetIsTopAppList().Returns(_inSideOrOutSideApp);
            _appListService.InsertAppName(Arg.Any <WisAppList>(), Arg.Any <List <WisAppUserList> >()).Returns(true);
            _appListService.GetDefineGroup(Arg.Any <List <string> >()).Returns(new List <WisDefineGroup>());

            //Act
            TResult <ResponseAppNameCreate> actualResponse = _targetObj.InsertAppName(_request);

            //Assert
            Assert.AreEqual(expectedResponse.Rtncode, actualResponse.Rtncode);
            Assert.AreEqual(expectedResponse.RtnMsg, actualResponse.RtnMsg);
            Assert.AreEqual(expectedResponse.Data.IsSuccessful, actualResponse.Data.IsSuccessful);
        }
示例#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);
        }