Welcome Guest! To enable all features please Login or Register.

Notification

Icon
Error

GUI bug if test argument ToString methods return multiline strings
dylanbeattie
#1 Posted : Tuesday, July 1, 2014 11:49:32 AM(UTC)
Rank: Member

Groups: Registered
Joined: 8/20/2012(UTC)
Posts: 12
Location: London

Thanks: 3 times
Was thanked: 2 time(s) in 2 post(s)
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


NCrunch GUI bug with multiline ToString in TestCaseSource

Code:
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);
        }
    }
Remco
#2 Posted : Tuesday, July 1, 2014 12:04:41 PM(UTC)
Rank: NCrunch Developer

Groups: Administrators
Joined: 4/16/2011(UTC)
Posts: 7,123

Thanks: 957 times
Was thanked: 1286 time(s) in 1193 post(s)
Oops! You're right, that does look wrong.

Thanks for reporting this. I'll see that it gets fixed.
Users browsing this topic
Guest
Forum Jump  
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.

YAF | YAF © 2003-2011, Yet Another Forum.NET
This page was generated in 0.023 seconds.
Trial NCrunch
Take NCrunch for a spin
Do your fingers a favour and supercharge your testing workflow
Free Download