Ejemplo n.º 1
0
        public void GetUserCheckByRoleTest()
        {
            #region arrange

            string id = "1";

            List <UserCheckDTO> reUserCheckDTO = new List <UserCheckDTO>()
            {
                new UserCheckDTO()
                {
                    UserID = 1, UserName = "******", AccountName = "kevan", Check = true
                },
                new UserCheckDTO()
                {
                    UserID = 2, UserName = "******", AccountName = "A1", Check = true
                },
                new UserCheckDTO()
                {
                    UserID = 3, UserName = "******", AccountName = "B1", Check = false
                }
            };

            PageDataVO pageDataVO = new PageDataVO()
            {
                OrderByColumn = "UserID", OrderByType = "ASC"
            };

            _dataAccess.Stub(o => o.QueryDataTable <UserCheckDTO>(Arg <string> .Is.Anything, Arg <object[]> .Is.Anything)).Return(reUserCheckDTO);

            #endregion

            #region act

            var result = _target.GetUserCheckByRole(id, pageDataVO).ToList();

            #endregion

            #region assert

            for (int i = 0; i < result.Count; i++)
            {
                Assert.AreEqual(result[i].UserID, reUserCheckDTO[i].UserID);
                Assert.AreEqual(result[i].UserName, reUserCheckDTO[i].UserName);
                Assert.AreEqual(result[i].AccountName, reUserCheckDTO[i].AccountName);
                Assert.AreEqual(result[i].Check, reUserCheckDTO[i].Check);
            }

            #endregion
        }