コード例 #1
0
        public void StringMatchesLightningParserTest()
        {
            const string data = "Rails for Python Developers lightning";

            var exp    = new LightningParser();
            var result = exp.Time(data);

            var wrongparser = new MinuteParser();
            var wrongResult = wrongparser.Time(data);

            Assert.IsFalse(wrongparser.Success);
            Assert.AreEqual(0, wrongResult.TotalMinutes);

            Assert.IsTrue(exp.Success);
            Assert.AreEqual(5, result.TotalMinutes);
        }
コード例 #2
0
        public void StringMatchesGetMinutesParseTest()
        {
            const string data = "Writing Fast Tests Against Enterprise Rails 45min";

            var exp    = new MinuteParser();
            var result = exp.Time(data);

            var wrongparser = new LightningParser();
            var wrongResult = wrongparser.Time(data);

            Assert.IsFalse(wrongparser.Success);
            Assert.AreEqual(0, wrongResult.TotalMinutes);

            Assert.IsTrue(exp.Success);
            Assert.AreEqual(45, result.TotalMinutes);
        }