示例#1
0
        public void TryParse()
        {
            int score1;
            int score2;

            Assert.IsTrue(ResultParser.TryParse("@playerA @playerB 1-10", out score1, out score2));
            Assert.AreEqual(1, score1);
            Assert.AreEqual(10, score2);
        }
        RestMSDomain GetDefaultDomain(ClientOptions options)
        {
            var client = CreateClient(options);

            var response = client.GetAsync(configuration.RestMS.Uri).Result;

            response.EnsureSuccessStatusCode();
            var          entityBody = response.Content.ReadAsStringAsync().Result;
            RestMSDomain domainObject;

            if (!ResultParser.TryParse(entityBody, out domainObject))
            {
                var errorString = string.Format("Could not parse entity body as a domain => {0}", entityBody);
                logger.ErrorFormat(errorString);
                throw new ResultParserException(errorString);
            }
            return(domainObject);
        }