[pluralsight] 플러랄사이트 C#강의 5

IT/Programming|2020. 10. 5. 12:12

 

Testing Your Code 

 

Unit Testing:    Verify the code    

                        (Testing edge conditions. ; user input wrong value ) 

   

xUnit.net :  Unit. Test library 

 

 

dotnet new xunit // create test project 



dotnet add package xunit // NuGet package website search and add here in cmd
                         // PackageReference you can check from .csproj file
                         

 

 

Template for the unit test.

 

using System;   
using Xunit;    //xunit namespaces
 
namespace GradeBook.Tests
{
    public class UnitTest1
    {
        [Fact]  //attirubute 
        public void Test1()
        {

        }
    }
}

 

test command in the vs code => built in test runner.

dotnet test  //excute test 

 

 

 

강의대로하면 뭔가 안맞는데 

 

1. 강의에서 처럼 Book.cs  에  pubulic class가 안됨 

2. dotnet.test하면 밑에처럼 알록달록하게 뜸. 

 

일단은 넘어가고 나중에 다시와서 해보는수밖에 없는것같다. 


 

 

반응형

댓글()