public void ContactPersonalInfoHydrator_File_Test()
        {
            var collection = new NameValueCollection();
            var fields = new string[] {"dob", "first", "gender", "job", "middle", "nickname", "suffix", "last", "title"};
            foreach (var field in fields)
            {
                collection[field] = (string)this.TestContext.DataRow[field];
            }
            var list = new List<string>();
            foreach (string key in collection.Keys)
            {
                list.Add(string.Format("{0}={1}", HttpUtility.UrlEncode(key), HttpUtility.UrlEncode(collection[key])));
            }
            var queryString = string.Join("&", list.ToArray());
            var path = Path.GetTempFileName();
            File.WriteAllText(path, queryString);

            var mockPersonalInfo = new Mock<IContactPersonalInfo>();
            mockPersonalInfo.SetupAllProperties();
            Assert.IsNull(mockPersonalInfo.Object.BirthDate);

            var hydrator = new ContactPersonalInfoHydrator(mockPersonalInfo.Object);
            hydrator.Hydrate(File.OpenRead(path));
            ConfirmContactPersonalInfo(collection, mockPersonalInfo.Object);
        }
        public void ContactPersonalInfoHydrator_QueryString_Test()
        {
            var mockPersonalInfo = new Mock<IContactPersonalInfo>();
            mockPersonalInfo.SetupAllProperties();
            Assert.IsNull(mockPersonalInfo.Object.BirthDate);

            var queryString = (string)this.TestContext.DataRow["data"];
            HttpContext.Current = new HttpContext(new HttpRequest(null, "http://tempuri.org", queryString), new HttpResponse(new StringWriter()));

            var stream = new MemoryStream(Encoding.UTF8.GetBytes(queryString));
            var hydrator = new ContactPersonalInfoHydrator(mockPersonalInfo.Object);
            hydrator.Hydrate(stream);
            ConfirmContactPersonalInfo(HttpUtility.ParseQueryString(queryString), mockPersonalInfo.Object);
        }