public void SutIsSpecimenBuilder()
 {
     // Fixture setup
     // Exercise system
     var sut = new RegularExpressionAttributeRelay();
     // Verify outcome
     Assert.IsAssignableFrom<ISpecimenBuilder>(sut);
     // Teardown
 }
 public void CreateWithNullContextThrows()
 {
     // Fixture setup
     var sut = new RegularExpressionAttributeRelay();
     var dummyRequest = new object();
     // Exercise system and verify outcome
     Assert.Throws<ArgumentNullException>(() =>
         sut.Create(dummyRequest, null));
     // Teardown
 }
 public void CreateWithNullRequestReturnsCorrectResult()
 {
     // Fixture setup
     var sut = new RegularExpressionAttributeRelay();
     // Exercise system
     var dummyContext = new DelegatingSpecimenContext();
     var result = sut.Create(null, dummyContext);
     // Verify outcome
     Assert.Equal(new NoSpecimen(), result);
     // Teardown
 }
 public void CreateWithNonRegularExpressionAttributeRequestReturnsCorrectResult(object request)
 {
     // Fixture setup
     var sut = new RegularExpressionAttributeRelay();
     // Exercise system
     var dummyContext = new DelegatingSpecimenContext();
     var result = sut.Create(request, dummyContext);
     // Verify outcome
     var expectedResult = new NoSpecimen(request);
     Assert.Equal(expectedResult, result);
     // Teardown
 }
        public void CreateWithAnonymousRequestReturnsCorrectResult()
        {
            // Fixture setup
            var sut = new RegularExpressionAttributeRelay();
            var dummyRequest = new object();
            // Exercise system
            var dummyContainer = new DelegatingSpecimenContext();
            var result = sut.Create(dummyRequest, dummyContainer);
            // Verify outcome
#pragma warning disable 618
            var expectedResult = new NoSpecimen(dummyRequest);
#pragma warning restore 618
            Assert.Equal(expectedResult, result);
            // Teardown
        }
        public void CreateWithRegularExpressionAttributeRequestReturnsCorrectResult(string pattern)
        {
            // Fixture setup
            var regularExpressionAttribute = new RegularExpressionAttribute(pattern);
            var providedAttribute = new ProvidedAttribute(regularExpressionAttribute, true);
            ICustomAttributeProvider request = new FakeCustomAttributeProvider(providedAttribute);
            var expectedRequest = new RegularExpressionRequest(regularExpressionAttribute.Pattern);
            var expectedResult = new object();
            var context = new DelegatingSpecimenContext
            {
#pragma warning disable 618
                OnResolve = r => expectedRequest.Equals(r) ? expectedResult : new NoSpecimen(r)
#pragma warning restore 618
            };
            var sut = new RegularExpressionAttributeRelay();
            // Exercise system
            var result = sut.Create(request, context);
            // Verify outcome
            Assert.Equal(expectedResult, result);
            // Teardown
        }