Daily Usage Issues

GUI bug if test argument ToString methods return multiline strings

Started by dylanbeattie on 5,807 views

Hello there!

It looks like there's a GUI bug in NCrunch if you're using the TestCaseSource attribute and supplying test cases whose ToString() methods return multiline strings. Screenshot and sample code to reproduce is below.

Thanks!

Dylan


[img=http://i.imgur.com/oSCWawY.png]NCrunch GUI bug with multiline ToString in TestCaseSource[/img]

public class Student {
        private readonly string name;
        private readonly int age;

        public Student(string name, int age) {
            this.name = name;
            this.age = age;
        }

        public override string ToString() {
            var sb = new StringBuilder();
            sb.AppendLine("Name: " + this.name);
            sb.AppendLine("Age: " + this.age);
            return (sb.ToString());
        }
    }

    [TestFixture]
    public class MyTests {
        public static readonly Student[] Students = {
            new Student("Dylan", 35),
            new Student("Steve", 26),
            new Student("Laura", 34)
        };

        [Test]
        [TestCaseSource("Students")]
        public void MyTest(Student student) {
            Assert.IsNotNull(student);
        }
    }
Oops! You're right, that does look wrong.

Thanks for reporting this. I'll see that it gets fixed.

Post a reply

Log in to reply.