// GET: /Fundlist/Edit/5
        public ActionResult Edit(string SourceLangId, string TargetLangId)
        {
            if (SourceLangId == null) throw new ArgumentNullException("SourceLangId");
            if (TargetLangId == null) throw new ArgumentNullException("TargetLangId");
            ViewBag.Message = "Translate Shorjini Kempo Camp Stockholm 2014 for language " + SourceLangId;
            WebTextTranslationViewModel webTextTranslationviewModel = null;

            WebText webTextSource = this.WebTextRepo.GetWebTextRepo(SourceLangId);
            WebText webTextTarget = this.WebTextRepo.GetWebTextRepo(TargetLangId);
            var translateRepo = new TranslatorRepo();
            string webTranslateToken = translateRepo.GetBingToken();
            if (webTextSource != null && webTextTarget != null)
            {
                webTextTranslationviewModel = new WebTextTranslationViewModel
                {
                    SourceLang = webTextSource,
                    TargetLang = webTextTarget,
                    AccessToken = webTranslateToken
                };
            }
            else
            {
                throw new NullReferenceException("Could not get source or target language webtext from WebTextRepo.SearchWebText for translation");
            }
            return View(webTextTranslationviewModel);
        }
        //   [TestMethod]
        public void Get_ReqBody_XmlDoc()
        {
            //Arrange
            IWebTextRepo webTextRepo = new WebTextRepoMock();
            ITranslatorRepo translatorRepo = new TranslatorRepo();
            string sourceLang   = "en";
            string targetLang = "sv";
            string body = "<TranslateArrayRequest>" +
              "<AppId />" +
              "<From>{0}</From>" +
              "<Options>" +
              " <Category xmlns=\"http://schemas.datacontract.org/2004/07/Microsoft.MT.Web.Service.V2\" />" +
              "<ContentType xmlns=\"http://schemas.datacontract.org/2004/07/Microsoft.MT.Web.Service.V2\">{1}</ContentType>" +
              "<ReservedFlags xmlns=\"http://schemas.datacontract.org/2004/07/Microsoft.MT.Web.Service.V2\" />" +
              "<State xmlns=\"http://schemas.datacontract.org/2004/07/Microsoft.MT.Web.Service.V2\" />" +
              "<Uri xmlns=\"http://schemas.datacontract.org/2004/07/Microsoft.MT.Web.Service.V2\" />" +
              "<User xmlns=\"http://schemas.datacontract.org/2004/07/Microsoft.MT.Web.Service.V2\" />" +
              "</Options>" +
              "<Texts>" +
              "<string xmlns=\"http://schemas.microsoft.com/2003/10/Serialization/Arrays\">{2}</string>" +
              "<string xmlns=\"http://schemas.microsoft.com/2003/10/Serialization/Arrays\">{3}</string>" +
              "<string xmlns=\"http://schemas.microsoft.com/2003/10/Serialization/Arrays\">{4}</string>" +
              "</Texts>" +
              "<To>{5}</To>" +
              "</TranslateArrayRequest>";
            List<WebText> webTextList = webTextRepo.ListWebTextForLang(language: sourceLang);
            string reqBody = string.Format(body, sourceLang, "text/plain", webTextList[0].HtmlText, webTextList[1].HtmlText, webTextList[2].HtmlText, targetLang);

            //Act
            //XDocument xbody = new XDocument(
            //    new XElement("TranslateArrayRequest",
            //        new XElement("AppId"),
            //        new XElement("From", sourceLang),
            //        new XElement("Options",
            //            new XElement("Category",
            //                new XAttribute("xmlns",
            //                    "http://schemas.datacontract.org/2004/07/Microsoft.MT.Web.Service.V2\\")
            //                )
            //            )
            //        )
            //    );
            //XDocument xbody =
            //  new XDocument(
            //        new XElement("TranslateArrayRequest",
            //                new XElement("AppId"),
            //                new XElement("From",sourceLang),
            //                new XElement("Options",
            //                    new XElement("Category",
            //                        new XAttribute("xmlns", "foo")
            //                        )
            //                )
            //        )
            //  );
            XNamespace catNs = "http://schemas.datacontract.org/2004/07/Microsoft.MT.Web.Service.V2";
            XNamespace contNs = "http://schemas.datacontract.org/2004/07/Microsoft.MT.Web.Service.V2";
            XNamespace resNs = "http://schemas.datacontract.org/2004/07/Microsoft.MT.Web.Service.V2";
            XNamespace stateNs = "http://schemas.datacontract.org/2004/07/Microsoft.MT.Web.Service.V2";
            XNamespace uriNs = "http://schemas.datacontract.org/2004/07/Microsoft.MT.Web.Service.V2";
            XNamespace userNs = "http://schemas.datacontract.org/2004/07/Microsoft.MT.Web.Service.V2";
            XNamespace arrNs = "http://schemas.microsoft.com/2003/10/Serialization/Arrays";

            XDocument xbody =
                new XDocument(
                    new XElement("TranslateArrayRequest",
                        new XElement("AppId"),
                        new XElement("From",sourceLang),
                        new XElement("Options",
                            new XElement("Category", new XAttribute(XNamespace.Xmlns +"catNS", catNs)),
                            new XElement("ContentType", new XAttribute(XNamespace.Xmlns +"contNs", contNs)),
                            new XElement("ReservedFlags", new XAttribute(XNamespace.Xmlns +"resNs", resNs)),
                            new XElement("State", new XAttribute(XNamespace.Xmlns +"stateNs", stateNs)),
                            new XElement("Uri", new XAttribute(XNamespace.Xmlns +"uriNs", uriNs)),
                            new XElement("User", new XAttribute(XNamespace.Xmlns +"userNs", userNs)),
                            new XElement("Texts",webTextList.Select(wt =>new XElement("string", new XAttribute(XNamespace.Xmlns + "arrNs", arrNs),wt.HtmlText))
                            ))));
            string fooXml = xbody.ToString();
            var xmlReqBody = translatorRepo.ReqBody(webTextList, sourceLang, targetLang);
            //Assert
            Assert.AreEqual(xbody.ToString(), reqBody,"The xml document in the translation for array are not same as the hardcoded");
        }