Quantcast
Channel: .NET Framework Class Libraries forum
Viewing all articles
Browse latest Browse all 8156

Data Driven Unit Tests for Azure Cloud Service Web API methods

$
0
0

Hi,

I created an Azure Cloud Service project and selected "unit tests" as part of the options. It created me a default ValuesController

which has a Get method that accepts a integer parameter. It also created me a GetById test method with the attribute [TestMethod]. The test method for Get only checks for the value 5 and asserts if the expected result equals "value".

How do I simulate different combinations of data inputs to this method using a data driven unit test approach in Azure Cloud Service. Is there something that is available as an extension to the unit tests framework? Any other alternatives / suggestions would be appreciated. 

// GET api/values/5        public string Get(int id)        {                       return "value";        }
        [TestMethod]public void GetById()
{    // Arrange    ValuesController controller = new ValuesController();    // Act    string result = controller.Get(5);    // Assert    Assert.AreEqual("value", result);
}




Viewing all articles
Browse latest Browse all 8156

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>