public void GetParameters() { // Arrange ParameterInfo pInfo = _asyncMethod.GetParameters()[0]; ReflectedAsyncActionDescriptor ad = GetActionDescriptor(_asyncMethod, _completedMethod); // Act ParameterDescriptor[] pDescsFirstCall = ad.GetParameters(); ParameterDescriptor[] pDescsSecondCall = ad.GetParameters(); // Assert Assert.AreNotSame(pDescsFirstCall, pDescsSecondCall, "GetParameters() should return a new array on each invocation."); CollectionAssert.AreEqual(pDescsFirstCall, pDescsSecondCall, "Array elements were not equal."); Assert.AreEqual(1, pDescsFirstCall.Length); ReflectedParameterDescriptor pDesc = pDescsFirstCall[0] as ReflectedParameterDescriptor; Assert.IsNotNull(pDesc, "Parameter 0 should have been of type ReflectedParameterDescriptor."); Assert.AreSame(ad, pDesc.ActionDescriptor, "Parameter 0 Action did not match."); Assert.AreSame(pInfo, pDesc.ParameterInfo, "Parameter 0 ParameterInfo did not match."); }
public void GetParameters() { // Arrange ParameterInfo pInfo = _asyncMethod.GetParameters()[0]; ReflectedAsyncActionDescriptor ad = GetActionDescriptor(_asyncMethod, _completedMethod); // Act ParameterDescriptor[] pDescsFirstCall = ad.GetParameters(); ParameterDescriptor[] pDescsSecondCall = ad.GetParameters(); // Assert Assert.NotSame(pDescsFirstCall, pDescsSecondCall); Assert.Equal(pDescsFirstCall, pDescsSecondCall); Assert.Single(pDescsFirstCall); ReflectedParameterDescriptor pDesc = pDescsFirstCall[0] as ReflectedParameterDescriptor; Assert.NotNull(pDesc); Assert.Same(ad, pDesc.ActionDescriptor); Assert.Same(pInfo, pDesc.ParameterInfo); }