public void IsSatisfiedByWithNullRequestShouldThrowArgumentNullException() { // Arrange var sut = new ParameterSpecification(typeof(object), "someName"); // Act & assert Assert.Throws <ArgumentNullException>(() => sut.IsSatisfiedBy(null)); }
public void IsSatisfiedByWithNullRequestShouldThrowArgumentNullException() { // Fixture setup var sut = new ParameterSpecification(typeof(object), "someName"); // Exercise system and verify outcome Assert.Throws <ArgumentNullException>(() => sut.IsSatisfiedBy(null)); // Teardown }
public void IsSatisfiedByWithInvalidRequestShouldReturnFalse(object request) { // Arrange var sut = new ParameterSpecification(typeof(object), "someName"); // Act var result = sut.IsSatisfiedBy(request); // Assert Assert.False(result); }
public void IsSatisfiedByWithInvalidRequestShouldReturnFalse(object request) { // Fixture setup var sut = new ParameterSpecification(typeof(object), "someName"); // Exercise system var result = sut.IsSatisfiedBy(request); // Verify outcome Assert.False(result); // Teardown }
public void IsSatisfiedByWithRequestForMemberOtherThanParameterWithSameNameShouldReturnFalse() { // Arrange var parameterName = "Parameter"; var requestedName = "Parameter"; var sut = new ParameterSpecification(typeof(object), parameterName); var request = typeof(SingleParameterType <object>).GetProperty(requestedName); // Act var result = sut.IsSatisfiedBy(request); // Assert Assert.False(result); }
public void IsSatisfiedByWithRequestForMemberOtherThanParameterWithSameNameShouldReturnFalse() { // Fixture setup var parameterName = "Parameter"; var requestedName = "Parameter"; var sut = new ParameterSpecification(typeof(object), parameterName); var request = typeof(SingleParameterType <object>).GetProperty(requestedName); // Exercise system var result = sut.IsSatisfiedBy(request); // Verify outcome Assert.False(result); // Teardown }
public void IsSatisfiedByWithRequestForParameterWithSameNameAndIncompatibleTypeShouldReturnFalse() { // Arrange var parameterName = "parameter"; var requestedName = "parameter"; var sut = new ParameterSpecification(typeof(object), parameterName); var request = typeof(SingleParameterType <int>) .GetConstructor(new[] { typeof(int) }) .GetParameters() .Single(p => p.Name == requestedName); // Act var result = sut.IsSatisfiedBy(request); // Assert Assert.False(result); }
public void IsSatisfiedByWithRequestForParameterShouldReturnCorrectResult( string parameterName, string requestedName, bool expectedResult) { // Arrange var sut = new ParameterSpecification(typeof(object), parameterName); var request = typeof(SingleParameterType <object>) .GetConstructor(new[] { typeof(object) }) .GetParameters() .Single(p => p.Name == requestedName); // Act var result = sut.IsSatisfiedBy(request); // Assert Assert.Equal(expectedResult, result); }
public void IsSatisfiedByWithRequestForParameterWithSameNameAndIncompatibleTypeShouldReturnFalse() { // Fixture setup var parameterName = "parameter"; var requestedName = "parameter"; var sut = new ParameterSpecification(typeof(object), parameterName); var request = typeof(SingleParameterType <int>) .GetConstructor(new[] { typeof(int) }) .GetParameters() .Single(p => p.Name == requestedName); // Exercise system var result = sut.IsSatisfiedBy(request); // Verify outcome Assert.False(result); // Teardown }
public void IsSatisfiedByWithRequestForParameterShouldReturnCorrectResult( string parameterName, string requestedName, bool expectedResult) { // Fixture setup var sut = new ParameterSpecification(typeof(object), parameterName); var request = typeof(SingleParameterType <object>) .GetConstructor(new[] { typeof(object) }) .GetParameters() .Single(p => p.Name == requestedName); // Exercise system var result = sut.IsSatisfiedBy(request); // Verify outcome Assert.Equal(expectedResult, result); // Teardown }
public void IsSatisfiedByReturnsCorrectResultAccordingToTarget( bool expected) { var parameter = typeof(string).GetMethod("Contains", new[] { typeof(string) }).GetParameters().First(); var target = new DelegatingCriterion <ParameterInfo> { OnEquals = f => { Assert.Equal(parameter, f); return(expected); } }; var sut = new ParameterSpecification(target); var actual = sut.IsSatisfiedBy(parameter); Assert.Equal(expected, actual); }