public void CreateRelayedRequestThrowsNotSupportedExceptionWhenAttributeIsAppliedToUnexpectedCodeElement()
        {
            // Arrange
            var sut       = new SubstituteAttributeRelay();
            var request   = Substitute.For <ICustomAttributeProvider>();
            var attribute = new SubstituteAttribute();

            request.GetCustomAttributes(Arg.Any <Type>(), Arg.Any <bool>()).Returns(new object[] { attribute });
            var context = Substitute.For <ISpecimenContext>();
            // Act
            var e = Assert.Throws <NotSupportedException>(() => sut.Create(request, context));

            // Assert
            Assert.Contains(attribute.ToString(), e.Message);
            Assert.Contains(request.ToString(), e.Message);
        }
        public void CreateRelayedRequestThrowsNotSupportedExceptionWhenAttributeIsAppliedToUnexpectedCodeElement()
        {
            // Fixture setup
            var sut       = new SubstituteAttributeRelay();
            var request   = Substitute.For <EventInfo>();
            var attribute = new SubstituteAttribute();

            request.GetCustomAttributes(Arg.Any <Type>(), Arg.Any <bool>()).Returns(new[] { attribute });
            var context = Substitute.For <ISpecimenContext>();
            // Exercise system
            var e = Assert.Throws <NotSupportedException>(() => sut.Create(request, context));

            // Verify outcome
            Assert.Contains(attribute.ToString(), e.Message);
            Assert.Contains(request.ToString(), e.Message);
            // Teardown
        }
 public void CreateRelayedRequestThrowsNotSupportedExceptionWhenAttributeIsAppliedToUnexpectedCodeElement()
 {
     // Fixture setup
     var sut = new SubstituteAttributeRelay();
     var request = Substitute.For<EventInfo>();
     var attribute = new SubstituteAttribute();
     request.GetCustomAttributes(Arg.Any<Type>(), Arg.Any<bool>()).Returns(new[] { attribute });
     var context = Substitute.For<ISpecimenContext>();
     // Exercise system
     var e = Assert.Throws<NotSupportedException>(() => sut.Create(request, context));
     // Verify outcome
     Assert.Contains(attribute.ToString(), e.Message);
     Assert.Contains(request.ToString(), e.Message);
     // Teardown
 }