public void InitialiseProperties( Type classUnderTest, object instanceUnderTest, MethodBase methodUnderTest, object[] parameters, string nullParameter, int nullIndex, IExecutionSetup executionSetup) { // Act var sut = new MethodData( classUnderTest, instanceUnderTest, methodUnderTest, parameters, nullParameter, nullIndex, executionSetup); // Assert Assert.Same(classUnderTest, sut.ClassUnderTest); Assert.Equal(instanceUnderTest, sut.InstanceUnderTest); Assert.Same(methodUnderTest, sut.MethodUnderTest); Assert.Same(parameters, sut.Parameters); Assert.Same(nullParameter, sut.NullParameter); Assert.Equal(nullIndex, sut.NullIndex); Assert.Same(executionSetup, sut.ExecutionSetup); }
/// <summary> /// Initializes a new instance of the <see cref="MethodData"/> class. /// </summary> /// <param name="classUnderTest">The type of the class under test.</param> /// <param name="instanceUnderTest">The instance of the class under test if the /// <paramref name="methodUnderTest"/> is not static.</param> /// <param name="methodUnderTest">The method under test.</param> /// <param name="parameters">The parameters to the <paramref name="methodUnderTest"/>.</param> /// <param name="nullParameter">The name of the null parameter in the <paramref name="parameters"/>.</param> /// <param name="nullIndex">The index of the null parameter in the <paramref name="parameters"/>.</param> /// <param name="executionSetup">The setup for the <see cref="ExecuteAction"/>.</param> /// <exception cref="ArgumentNullException">The <paramref name="classUnderTest"/>, /// <paramref name="methodUnderTest"/>, <paramref name="parameters"/>, <paramref name="nullParameter"/> or /// <paramref name="executionSetup"/> parameters are <see langword="null"/>.</exception> public MethodData( Type classUnderTest, object instanceUnderTest, MethodBase methodUnderTest, object[] parameters, string nullParameter, int nullIndex, IExecutionSetup executionSetup) { if (classUnderTest == null) throw new ArgumentNullException("classUnderTest"); if (methodUnderTest == null) throw new ArgumentNullException("methodUnderTest"); if (parameters == null) throw new ArgumentNullException("parameters"); if (nullParameter == null) throw new ArgumentNullException("nullParameter"); if (executionSetup == null) throw new ArgumentNullException("executionSetup"); ClassUnderTest = classUnderTest; InstanceUnderTest = instanceUnderTest; MethodUnderTest = methodUnderTest; Parameters = parameters; NullParameter = nullParameter; NullIndex = nullIndex; ExecutionSetup = executionSetup; }
public void InitialiseProperties( Type classUnderTest, object instanceUnderTest, MethodBase methodUnderTest, object[] parameters, string nullParameter, int nullIndex, IExecutionSetup executionSetup) { // Act var sut = new MethodData( classUnderTest, instanceUnderTest, methodUnderTest, parameters, nullParameter, nullIndex, executionSetup); // Assert Assert.Same(classUnderTest, sut.ClassUnderTest); Assert.Equal(instanceUnderTest, sut.InstanceUnderTest); Assert.Same(methodUnderTest, sut.MethodUnderTest); Assert.Same(parameters, sut.Parameters); Assert.Same(nullParameter, sut.NullParameter); Assert.Equal(nullIndex, sut.NullIndex); Assert.Same(executionSetup, sut.ExecutionSetup); }
private static MethodData GetMethodData( MethodBase methodUnderTest, IExecutionSetup sut, object instanceUnderTest = null) { return(new MethodData( typeof(DefaultExecutionSetupShould), instanceUnderTest, methodUnderTest, new object[] {}, Guid.NewGuid().ToString(), 0, sut)); }
/// <summary> /// Initializes a new instance of the <see cref="MethodData"/> class. /// </summary> /// <param name="classUnderTest">The type of the class under test.</param> /// <param name="instanceUnderTest">The instance of the class under test if the /// <paramref name="methodUnderTest"/> is not static.</param> /// <param name="methodUnderTest">The method under test.</param> /// <param name="parameters">The parameters to the <paramref name="methodUnderTest"/>.</param> /// <param name="nullParameter">The name of the null parameter in the <paramref name="parameters"/>.</param> /// <param name="nullIndex">The index of the null parameter in the <paramref name="parameters"/>.</param> /// <param name="executionSetup">The setup for the <see cref="ExecuteAction"/>.</param> /// <exception cref="ArgumentNullException">The <paramref name="classUnderTest"/>, /// <paramref name="methodUnderTest"/>, <paramref name="parameters"/>, <paramref name="nullParameter"/> or /// <paramref name="executionSetup"/> parameters are <see langword="null"/>.</exception> public MethodData( Type classUnderTest, object instanceUnderTest, MethodBase methodUnderTest, object[] parameters, string nullParameter, int nullIndex, IExecutionSetup executionSetup) { if (classUnderTest == null) { throw new ArgumentNullException(nameof(classUnderTest)); } if (methodUnderTest == null) { throw new ArgumentNullException(nameof(methodUnderTest)); } if (parameters == null) { throw new ArgumentNullException(nameof(parameters)); } if (nullParameter == null) { throw new ArgumentNullException(nameof(nullParameter)); } if (executionSetup == null) { throw new ArgumentNullException(nameof(executionSetup)); } ClassUnderTest = classUnderTest; InstanceUnderTest = instanceUnderTest; MethodUnderTest = methodUnderTest; Parameters = parameters; NullParameter = nullParameter; NullIndex = nullIndex; ExecutionSetup = executionSetup; }