Example #1
0
        //TEST:  SPGETUSER_TEST
        //Test that a specific user can be retrieved from the database
        public void spGetUser_Test()
        {
            //ARRANGE
            string         testUserName = "******";
            MyDataEntities db           = new MyDataEntities();
            //Grab a specific user based on their UserName to ensure that we can retreieve them from the DB
            var array = db.Users.Where(x => x.UserName == testUserName).ToList();
            ObjectResult <Store.Data.spGetUser_Result> result;
            //ACT
            int initialUserID = 0; int afterUserID = 0;

            foreach (var item in array)
            {
                //Grab our User's ID
                initialUserID = item.UserID;
                //Then call our stored procedure
                result = db.spGetUser(item.UserID);
                foreach (var input in result)
                {
                    //Store the returned User ID to compare later
                    afterUserID = input.UserID;
                }
            }
            //ASSERT
            //Check to see that our resulting User is the same as the User we were intending to grab
            Assert.AreEqual(initialUserID, afterUserID);
        }