public void CreateMeetingLabelItem_InputValidate_Success()
        {
            var createMeetingLabelItemValidation = new CreateMeetingLabelItemValidation();
            var result = createMeetingLabelItemValidation.InputValidate("test");

            Assert.IsTrue(result.IsSuccessed);
            Assert.IsFalse(result.HasError);
        }
        public void CreateMeetingLabelItem_InputValidate_Failure_BlankItemName()
        {
            var createMeetingLabelItemValidation = new CreateMeetingLabelItemValidation();
            var result = createMeetingLabelItemValidation.InputValidate("");

            Assert.IsFalse(result.IsSuccessed);
            Assert.IsTrue(result.HasError);
            Assert.IsTrue(result.BlankItemName);
        }
Ejemplo n.º 3
0
        public MeetingLabelItemDataCreatePageViewModel(INavigationService navigationService) : base(navigationService)
        {
            _restService     = new RestService();
            _operateDateTime = new OperateDateTime();

            _createMeetingLabelItemValidation = new CreateMeetingLabelItemValidation();
            _tokenCheckValidation             = new TokenCheckValidation(_restService);
            _applicationProperties            = new ApplicationProperties();
            _meetingLabelItemDatas            = new ObservableCollection <MeetingLabelItemData>();
            _createMeetingLabelItemParam      = new CreateMeetingLabelItemParam();

            _additionalMeetingLabelItemDatas = new List <MeetingLabelItemData>();

            //会議の各ラベルに項目(Item)を追加するコマンド
            CreateMeetingLabelItemCommand = new DelegateCommand(async() =>
            {
                //項目入力値のバリデーション
                CreateMeetingLabelItemParam = _createMeetingLabelItemValidation.InputValidate(InputLabelItemName);
                if (CreateMeetingLabelItemParam.HasError == true)
                {
                    return;
                }



                //uid取得の際のtoken情報照合
                TokenCheckParam = await _tokenCheckValidation.Validate(_applicationProperties.GetFromProperties <TokenData>("token"));

                var inputUid = 0;

                if (TokenCheckParam.HasError == true)
                {
                    return;
                }
                else
                {
                    //token情報照合に成功したらuid取得
                    GetUserParam = await _restService.GetUserDataAsync(UserConstants.OpenUserEndPoint, _applicationProperties.GetFromProperties <string>("userId"));

                    if (GetUserParam.HasError == true)
                    {
                        return;
                    }
                    else
                    {
                        //userDataの取得に成功したらuidを代入
                        var userData = GetUserParam.User;
                        inputUid     = userData.Id;
                    }
                }
                var meetingLabelItemData = new MeetingLabelItemData(TargetMeetingLabel.Id, inputUid, InputLabelItemName);
                MeetingLabelItemDatas.Add(meetingLabelItemData);
                AdditionalMeetingLabelItemDatas.Add(meetingLabelItemData);

                InputLabelItemName = "";
            });
        }