Example #1
0
        public void TestConverter(string sourceXmlFile, string expectedXmlFile, string rellocation)
        {
            var source = File.ReadAllText(GetTestDataFilePath(sourceXmlFile));

            var expected = XDocument.Load(GetTestDataFilePath(expectedXmlFile));

            var betOnlineXmlToIPokerConverter = new BetOnlineXmlToIPokerXmlConverter();

            betOnlineXmlToIPokerConverter.Initialize(source);

            if (!string.IsNullOrEmpty(rellocation))
            {
                var rellocationXml = XDocument.Parse(rellocation);
                betOnlineXmlToIPokerConverter.AddRelocationData(rellocationXml.Root);
            }

            var convertedResult = betOnlineXmlToIPokerConverter.Convert();

            Assert.IsNotNull(convertedResult);

            var actual = XDocument.Parse(convertedResult.ConvertedXml);

            var result = XNode.DeepEquals(expected, actual);

            Assert.IsTrue(result);
        }
Example #2
0
        public IEnumerable <ParsingResult> Import(IFileImporter fileImporter, string handHistoryFileContent, GameInfo gameInfo)
        {
            var progress = Substitute.For <IDHProgress>();

            var xDocument = XDocument.Parse(handHistoryFileContent);

            var handHistoryNodes = xDocument.Descendants("HandHistory");

            var result = new List <ParsingResult>();

            foreach (var handHistoryNode in handHistoryNodes)
            {
                var xml = handHistoryNode.ToString();
                var betOnlineXmlConverter = new BetOnlineXmlToIPokerXmlConverter();
                betOnlineXmlConverter.Initialize(xml);

                var convertedResult = betOnlineXmlConverter.Convert();

                result.AddRange(fileImporter.Import(convertedResult.ConvertedXml, progress, convertedResult.GameInfo));
            }

            return(result);
        }