public void SelectValue_TestFile1_ValueIsTheSame()
        {
            XPathComposer composer = new XPathComposer();
            string value = composer.FileName(testFile1).
                                    RootNode("catalog").
                                    Select("cd").
                                    Where("country").
                                    Equals("UK").
                                    GetValueOf<string>("title");

            Assert.AreEqual("Hide your heart", value);
        }
        public void SelectValue_TestFile2_StochasticRecalibrationMaximumMaturity_ValueIsTheSame()
        {
            XPathComposer composer = new XPathComposer();
            int value = composer.FileName(testfile2).
                                    RootNode("simulation").
                                    Select("model").
                                    Select("model").
                                    Where("id").
                                    Equals("Economies").
                                    Select("parameter").
                                    Where("id").
                                    Equals("StochasticRecalibrationMaximumMaturity").
                                    GetValueOf<int>("value");

            Assert.AreEqual(30, value);
        }
        public void SelectValuesList_TestFile2_ZCBP_Maturity_ValuesAreTheSame()
        {
            XPathComposer composer = new XPathComposer();
            IList<KeyValuePair<string, string>> valueList = composer.FileName(testfile2).
                                                                     RootNode("simulation").
                                                                     Select("model").
                                                                     Select("model").
                                                                     Where("id").
                                                                     Equals("Economies").
                                                                     Select("parameter").
                                                                     Where("id").
                                                                     Equals("ZCBP").
                                                                     Select("input").
                                                                     Where("id").
                                                                     Equals("CreditClass").
                                                                     SelectAllChildNodes("control").
                                                                     GetList<string, string>("item");

            Assert.IsTrue(valueList.Count != 0);

            for (int i = 0; i < valueList.Count; i++)
            {
                Assert.AreEqual(stubCreditClassList[i], valueList[i].Value);
            }
        }
        public void SelectValuesList_TestFile1__ValuesAreTheSame()
        {
            XPathComposer composer = new XPathComposer();
            IList<KeyValuePair<string,string>> valueList = composer.FileName(testFile1).
                                                                 RootNode("catalog").
                                                                 Select("cd").
                                                                 Where("country").
                                                                 Equals("UK").
                                                                 SelectAllChildNodes().
                                                                 GetList<string,string>();

            Assert.IsTrue(valueList.Count != 0);

            Assert.AreEqual("Hide your heart", valueList[0].Value);
            Assert.AreEqual("Bonnie Tyler", valueList[1].Value);
            Assert.AreEqual("10.0", valueList[2].Value);
        }
        public void SelectLastNode_SelectAllChildNodes_TestFile1_ValuesAreTheSame()
        {
            XPathComposer composer = new XPathComposer();
            IList<KeyValuePair<string, string>> valueList = composer.FileName(testFile1).
                                                                     RootNode("catalog").
                                                                     Select("cd").
                                                                     Last<string,string>();

            Assert.IsTrue(valueList.Count != 0);

            Assert.AreEqual("Greatest Hits", valueList[0].Value);
            Assert.AreEqual("Dolly Parton", valueList[1].Value);
            Assert.AreEqual("9.90", valueList[2].Value);
        }
        public void SelectFirstNode_SelectAllChildNodes_TestFile1_ValuesAreTheSame()
        {
            XPathComposer composer = new XPathComposer();
            IList<KeyValuePair<string, string>> valueList = composer.FileName(testFile1).
                                                                     RootNode("catalog").
                                                                     Select("cd").
                                                                     First<string,string>();

            Assert.IsTrue(valueList.Count != 0);

            Assert.AreEqual("Empire Burlesque", valueList[0].Value);
            Assert.AreEqual("Bob Dylan", valueList[1].Value);
            Assert.AreEqual("10.90", valueList[2].Value);
        }
        public void CreateFile_AddAttributeToNode_NodeHasBeenFoundByAttribute()
        {
            XPathComposer composer = new XPathComposer();
            string xmlPath = TestContext.DeploymentDirectory + "\\temp\\" + "test.xml";

            IList<KeyValuePair<string, string>> nodeList = new List<KeyValuePair<string, string>>();

            KeyValuePair<string, string> node1 = new KeyValuePair<string, string>("title", "LifeForms");
            KeyValuePair<string, string> node2 = new KeyValuePair<string, string>("artist", "Future Sound Of London");
            KeyValuePair<string, string> node3 = new KeyValuePair<string, string>("year", "1995");
            nodeList.Add(node1);
            nodeList.Add(node2);
            nodeList.Add(node3);

            composer.CreateXmlFile(xmlPath, "root").AddNodeList<string, string>(nodeList);

            composer.FileName(xmlPath).RootNode("root").AddAttribute("id", "bestprice");

            File.Exists(xmlPath);

            string title = composer.RootNode("root").Where("id").Equals("bestprice").GetValueOf<string>("title");

            Assert.AreEqual("LifeForms", title);
        }