I'd like to test this controller:
[HttpGet]
public IList<Notification> GetNotificationsByCustomerAndId([FromUri] string[] name, [FromUri] int[] lastNotificationID)
{
return _storage.GetNotifications(name, lastNotificationID, _topX);
}
In particular, in this method I want to test that the array passed in input to form the request Url, is the same array that goes into routeData.Values. If for single valued parameters (not arrays) it works, but not working for arrays. If I debug Values I see only controller and action.
[TestMethod]
public void GetNotificationsByCustomerAndId_ArrayOverload_Should_Match_InputParameter_name()
{
string[] _testName = new string[] { _testCustomer, _testCustomerBis };
string Url = string.Format(
"http://www.testpincopallo.it/Notifications/GetByCustomerAndLastID/customersNotificationsInfos?name={0}&name={1}&lastNotificationID={2}&lastNotificationID={3}",
_testName[0], _testName[1],
_testNotificationID, _testNotificationIDBis);
IHttpRouteData routeData = GetRouteData(Url);
routeData.Values["name"].Should().Be(_testName);
}
Is there another way to unit test while you are passing arrays?