Unit Test Help. How do I test for a message output to console?

前端 未结 4 404
暖寄归人
暖寄归人 2021-01-17 21:55

I am a newbie to unit testing. How do I check the for console output? I have

namespace XXShapes
{
    public abstract class XXShape
    {
        public virt         


        
4条回答
  •  星月不相逢
    2021-01-17 22:06

    That's not at all what you'd do.

    In your test you will typically check for the state of the object, with something like:

    Assert.IsTrue(foo.Field, Equals, "hello")
    

    Depending on how your chosen framework works. So you'll need to change your approach, in general, to conform to this model.

提交回复
热议问题