Skip to content

API Unit Test Template

JainalGandhi edited this page May 19, 2020 · 2 revisions
namespace WediumTestSuite
{
    public class TestClassName // Should end with word "Test"
    {
        private TestServerHandler _testServer;
        private DbContextOptions<WediumContext> _wediumContextOptions;
        private string _apiEndpoint;

        [OneTimeSetUp]
        public void OneTimeSetup()
        {
            _apiEndpoint = AppSettingsResolver.GetSetting<string>("APIEndpointURI");
        }

        [SetUp]
        public void SetUp()
        {
            _testServer = new TestServerHandler();

            _wediumContextOptions = server.getWediumContextOptions();
        }

        [Test]
        public void TestOne()
        {
            HttpClient client = _testServer.CreateClient();

            // This is a test fixture. Please give this method a descriptive name regarding what is being tested 
        }

        ...

    }
}