コード例 #1
0
        public string CodeItUpTest([PexAssumeUnderTest] StatementRecordPairValues target)
        {
            var actual = target.CodeItUp().ToArray();

            Assert.AreEqual(1, actual.Length, "only xpected one line");
            return(actual[0]);
        }
コード例 #2
0
        public static void TestTryCombine([PexAssumeUnderTest] StatementRecordPairValues target, IStatement statement)
        {
            var canComb = target.TryCombineStatement(statement, null);

            Assert.IsNotNull(statement, "Second statement null should cause a failure");
            var allSame = target.CodeItUp().Zip(statement.CodeItUp(), (f, s) => f == s).All(t => t);

            Assert.AreEqual(allSame, canComb, "not expected combination!");
        }
コード例 #3
0
        public StatementRecordPairValues RenameVariableTest([PexAssumeUnderTest] StatementRecordPairValues target, string origin, string final)
        {
            target.RenameVariable(origin, final);
            var finder = new Regex(string.Format("\b{0}\b", origin));
            var hasit  = target.CodeItUp().Where(s => finder.IsMatch(s)).Any();

            Assert.IsFalse(hasit, "found some code that contained the original guy");
            return(target);
        }