“Hello World” - The TDD way?

前端 未结 10 859
感动是毒
感动是毒 2021-01-31 21:10

Well I have been thinking about this for a while, ever since I was introduced to TDD. Which would be the best way to build a \"Hello World\" application ? which would print \"H

10条回答
  •  一向
    一向 (楼主)
    2021-01-31 21:53

    I guess something like this:

    using NUnit.Framework;
    using System.Diagnostics;
    
    [TestFixture]
    public class MyTestClass {
        [Test]
        public void SayHello() {
            string greet = "Hello World!";
            Debug.WriteLine(greet);
            Assert.AreEqual("Hello World!", greet);
        }
    }
    

提交回复
热议问题