Exemplo n.º 1
0
        public void FunctionGetParentDataTest()
        {
            #region arrange

            List <KeyValuePairVO> reKeyValuePairVO = new List <KeyValuePairVO>()
            {
                new KeyValuePairVO()
                {
                    Key = 1, Value = "角色管理"
                },
                new KeyValuePairVO()
                {
                    Key = 2, Value = "編輯角色"
                },
                new KeyValuePairVO()
                {
                    Key = 3, Value = "新增"
                },
            };

            _functionService.Stub(o => o.GetParentKeyValue()).Return(reKeyValuePairVO);

            #endregion

            #region act

            var resultData = _target.FunctionGetParentData();

            var result = (List <KeyValuePairVO>)(((JsonResult)resultData).Data);

            #endregion

            #region assert

            for (int i = 0; i < result.Count; i++)
            {
                Assert.AreEqual(result[i].Key, reKeyValuePairVO[i].Key);
                Assert.AreEqual(result[i].Value, reKeyValuePairVO[i].Value);
            }

            #endregion
        }