public static IEnumerable<ITestCase> CreateWithInvalidRequestReturnsNoSpecimen()
        {
            var invalidRequests = new[]
            {
                null,
                new object(),
                string.Empty,
                123,
                typeof(int),
                typeof(object[]),
                typeof(string[][])
            };
            return invalidRequests.Select(r => new TestCase(() =>
            {
                var sut = new MultidimensionalArrayRelay();
                var dummyContext = new DelegatingSpecimenContext();
#pragma warning disable 618
                var expected = new NoSpecimen(r);
#pragma warning restore 618

                var actual = sut.Create(r, dummyContext);

                Assert.Equal(expected, actual);
            }));
        }
 public void CreateWithNullRequestWillSetCorrectRequest()
 {
     // Fixture setup
     // Exercise system
     var sut = new NoSpecimen(null);
     // Verify outcome
     Assert.Null(sut.Request);
     // Teardown
 }
 public void SutIsEquatable()
 {
     // Fixture setup
     // Exercise system
     var sut = new NoSpecimen();
     // Verify outcome
     Assert.IsAssignableFrom<IEquatable<NoSpecimen>>(sut);
     // Teardown
 }
 public void DefaultConstructorWillSetRequestToNull()
 {
     // Fixture setup
     var sut = new NoSpecimen();
     // Exercise system
     var result = sut.Request;
     // Verify outcome
     Assert.Null(result);
     // Teardown
 }
        public void CreateWithNullRequestWillSetCorrectRequest()
        {
            // Fixture setup
            // Exercise system
#pragma warning disable 618
            var sut = new NoSpecimen(null);
            // Verify outcome
            Assert.Null(sut.Request);
#pragma warning restore 618
            // Teardown
        }
 public void SutDoesNotEqualNullSut()
 {
     // Fixture setup
     var sut = new NoSpecimen();
     NoSpecimen other = null;
     // Exercise system
     var result = sut.Equals(other);
     // Verify outcome
     Assert.False(result, "Equals");
     // Teardown
 }
 public void RequestWillMatchContructorArgument()
 {
     // Fixture setup
     var expectedRequest = new object();
     var sut = new NoSpecimen(expectedRequest);
     // Exercise system
     var result = sut.Request;
     // Verify outcome
     Assert.Equal(expectedRequest, result);
     // Teardown
 }
 public void SutDoesNotEqualAnonymousObject()
 {
     // Fixture setup
     var sut = new NoSpecimen();
     var anonymousObject = new object();
     // Exercise system
     var result = sut.Equals(anonymousObject);
     // Verify outcome
     Assert.False(result, "Equals");
     // Teardown
 }
Beispiel #9
0
        public void CreateWithInvalidRequestReturnsCorrectResult(object request)
        {
            // Arrange
            var sut = new StableFiniteSequenceRelay();
            // Act
            var dummyContext = new DelegatingSpecimenContext();
            var result       = sut.Create(request, dummyContext);
            // Assert
            var expectedResult = new NoSpecimen();

            Assert.Equal(expectedResult, result);
        }
Beispiel #10
0
        public void CreateWithNullRequestWillReturnNull()
        {
            // Arrange
            var sut = new MethodInvoker(new ModestConstructorQuery());
            // Act
            var dummyContainer = new DelegatingSpecimenContext();
            var result         = sut.Create(null, dummyContainer);
            // Assert
            var expectedResult = new NoSpecimen();

            Assert.Equal(expectedResult, result);
        }
Beispiel #11
0
        public void AnythingElseThanAnIntPtrRequestReturnsCorrectResult(object request)
        {
            // Arrange
            var sut = new IntPtrGuard();
            // Act
            var dummyContext = new DelegatingSpecimenContext();
            var result       = sut.Create(request, dummyContext);
            // Assert
            var expectedResult = new NoSpecimen();

            Assert.Equal(expectedResult, result);
        }
Beispiel #12
0
        public void SutDoesNotEqualAnonymousObject()
        {
            // Fixture setup
            var sut             = new NoSpecimen();
            var anonymousObject = new object();
            // Exercise system
            var result = sut.Equals(anonymousObject);

            // Verify outcome
            Assert.False(result, "Equals");
            // Teardown
        }
Beispiel #13
0
        public void SutDoesNotEqualNullSut()
        {
            // Fixture setup
            var        sut   = new NoSpecimen();
            NoSpecimen other = null;
            // Exercise system
            var result = sut.Equals(other);

            // Verify outcome
            Assert.False(result, "Equals");
            // Teardown
        }
Beispiel #14
0
        public void RequestNonEnumReturnsCorrectResult(object request)
        {
            // Arrange
            var sut = new EnumGenerator();
            // Act
            var dummyContext = new DelegatingSpecimenContext();
            var result       = sut.Create(request, dummyContext);
            // Assert
            var expectedResult = new NoSpecimen();

            Assert.Equal(expectedResult, result);
        }
        public void CreateReturnsNoSpecimenWhenRequestIsNull()
        {
            // Arrange
            var sut     = new SubstituteAttributeRelay();
            var context = Substitute.For <ISpecimenContext>();
            // Act
            object specimen = sut.Create(null, context);
            // Assert
            var expected = new NoSpecimen();

            Assert.Equal(expected, specimen);
        }
Beispiel #16
0
        public void CreateWithNonListRequestReturnsCorrectResult(object request)
        {
            // Arrange
            var sut = new ReadOnlyCollectionRelay();
            // Act
            var dummyContext = new DelegatingSpecimenContext();
            var result       = sut.Create(request, dummyContext);
            // Assert
            var expectedResult = new NoSpecimen();

            Assert.Equal(expectedResult, result);
        }
 public void CreateFromNullRequestWillReturnCorrectResult()
 {
     // Fixture setup
     var sut = new StringGenerator(() => new object());
     // Exercise system
     var dummyContainer = new DelegatingSpecimenContext();
     var result = sut.Create(null, dummyContainer);
     // Verify outcome
     var expectedResult = new NoSpecimen();
     Assert.Equal(expectedResult, result);
     // Teardown
 }
Beispiel #18
0
        public void CreateWithNonTypeRequestReturnsNoSpecimen(object request)
        {
            // Arrange
            var sut          = new LazyRelay();
            var dummyContext = new DelegatingSpecimenContext();
            // Act
            var actual = sut.Create(request, dummyContext);
            // Assert
            var expected = new NoSpecimen();

            Assert.Equal(expected, actual);
        }
        public void CreateWithNullRequestWillReturnCorrectResult()
        {
            // Arrange
            var sut = new PropertyRequestRelay();
            // Act
            var dummyContainer = new DelegatingSpecimenContext();
            var result         = sut.Create(null, dummyContainer);
            // Assert
            var expectedResult = new NoSpecimen();

            Assert.Equal(expectedResult, result);
        }
 public void CreateWithNoneEnumerableRequestReturnsCorrectResult(object request)
 {
     // Fixture setup
     var sut = new EnumerableRelay();
     // Exercise system
     var dummyContext = new DelegatingSpecimenContext { OnResolve = r => Enumerable.Empty<object>() };
     var result = sut.Create(request, dummyContext);
     // Verify outcome
     var expectedResult = new NoSpecimen(request);
     Assert.Equal(expectedResult, result);
     // Teardown
 }
        public void CreateWithNonNumericTypeRequestReturnsNoSpecimen(Type request)
        {
            // Arrange
            var sut = new NumericSequenceGenerator();
            // Act
            var dummyContainer = new DelegatingSpecimenContext();
            var result         = sut.Create(request, dummyContainer);
            // Assert
            var expectedResult = new NoSpecimen();

            Assert.Equal(expectedResult, result);
        }
Beispiel #22
0
        public void CreateWithNonAbstractionRequestReturnsCorrectResult(object request)
        {
            // Arrange
            var sut          = new MockRelay();
            var dummyContext = new Mock <ISpecimenContext>().Object;
            // Act
            var result = sut.Create(request, dummyContext);
            // Assert
            var expectedResult = new NoSpecimen();

            Assert.Equal(expectedResult, result);
        }
 public void AnythingElseThanAnIntPtrRequestReturnsCorrectResult(object request)
 {
     // Fixture setup
     var sut = new IntPtrGuard();
     // Exercise system
     var dummyContext = new DelegatingSpecimenContext();
     var result = sut.Create(request, dummyContext);
     // Verify outcome
     var expectedResult = new NoSpecimen(request);
     Assert.Equal(expectedResult, result);
     // Teardown
 }
Beispiel #24
0
        public void CreateWithNonTypeRequestReturnsCorrectResult(object request)
        {
            // Arrange
            var dummyContext = new DelegatingSpecimenContext();
            var sut          = new RandomCharSequenceGenerator();
            // Act
            var result = sut.Create(request, dummyContext);
            // Assert
            var expectedResult = new NoSpecimen();

            Assert.Equal(expectedResult, result);
        }
Beispiel #25
0
        public void SutDoesNotEqualOtherSutWhenRequestsDiffer()
        {
            // Arrange
#pragma warning disable 618
            var sut   = new NoSpecimen(new object());
            var other = new NoSpecimen(new object());
#pragma warning restore 618
            // Act
            var result = sut.Equals(other);
            // Assert
            Assert.False(result, "Equals");
        }
Beispiel #26
0
        public void SutDoesNotEqualOtherSutWhenOtherRequestIsNull()
        {
            // Fixture setup
            var sut   = new NoSpecimen(new object());
            var other = new NoSpecimen();
            // Exercise system
            var result = sut.Equals(other);

            // Verify outcome
            Assert.False(result, "Equals");
            // Teardown
        }
 public void CreateReturnsNoSpecimenWhenRequestIsNull()
 {
     // Fixture setup
     var sut = new SubstituteAttributeRelay();
     var context = Substitute.For<ISpecimenContext>();
     // Exercise system
     object specimen = sut.Create(null, context);
     // Verify outcome
     var expected = new NoSpecimen(null);
     Assert.Equal(expected, specimen);
     // Teardown
 }
 public void CreateNonTypeReturnsCorrectResult(object request)
 {
     // Fixture setup
     var sut = new TypeGenerator();
     // Exercise system
     var dummyContext = new DelegatingSpecimenContext();
     var result = sut.Create(request, dummyContext);
     // Verify outcome
     var expected = new NoSpecimen(request);
     Assert.Equal(expected, result);
     // Teardown
 }
Beispiel #29
0
        public void SutEqualsOtherSutWhenBothRequestsAreNull()
        {
            // Fixture setup
            var sut   = new NoSpecimen();
            var other = new NoSpecimen();
            // Exercise system
            var result = sut.Equals(other);

            // Verify outcome
            Assert.True(result, "Equals");
            // Teardown
        }
Beispiel #30
0
        public void SutDoesNotEqualOtherObjectWhenOtherRequestIsNull()
        {
            // Arrange
#pragma warning disable 618
            var sut = new NoSpecimen(new object());
#pragma warning restore 618
            object other = new NoSpecimen();
            // Act
            var result = sut.Equals(other);
            // Assert
            Assert.False(result, "Equals");
        }
Beispiel #31
0
        public void DefaultConstructorWillSetRequestToNull()
        {
            // Fixture setup
            var sut = new NoSpecimen();
            // Exercise system
#pragma warning disable 618
            var result = sut.Request;
#pragma warning restore 618
            // Verify outcome
            Assert.Null(result);
            // Teardown
        }
Beispiel #32
0
        public void DefaultConstructorWillSetRequestToNull()
        {
            // Arrange
            var sut = new NoSpecimen();

            // Act
#pragma warning disable 618
            var result = sut.Request;
#pragma warning restore 618
            // Assert
            Assert.Null(result);
        }
 public void CreateWithNullRequestWillReturnNull()
 {
     // Fixture setup
     var sut = new StringSeedRelay();
     // Exercise system
     var dummyContainer = new DelegatingSpecimenContext();
     var result = sut.Create(null, dummyContainer);
     // Verify outcome
     var expectedResult = new NoSpecimen();
     Assert.Equal(expectedResult, result);
     // Teardown
 }
 public void CreateWithNullRequestReturnsCorrectResult()
 {
     // Fixture setup
     var dummyContext = new DelegatingSpecimenContext();
     var sut = new RandomCharSequenceGenerator();
     // Exercise system
     var result = sut.Create(null, dummyContext);
     // Verify outcome
     var expectedResult = new NoSpecimen();
     Assert.Equal(expectedResult, result);
     // Teardown
 }
 public void CreateWithNoneArrayRequestReturnsCorrectResult(object request)
 {
     // Fixture setup
     var sut = new ArrayRelay();
     // 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 CreateWithNonNumericTypeRequestReturnsNoSpecimen(Type request)
 {
     // Fixture setup
     var sut = new NumericSequenceGenerator();
     // Exercise system
     var dummyContainer = new DelegatingSpecimenContext();
     var result = sut.Create(request, dummyContainer);
     // Verify outcome
     var expectedResult = new NoSpecimen(request);
     Assert.Equal(expectedResult, result);
     // Teardown
 }
 public void CreateWithNonAbstractionRequestReturnsCorrectResult(object request)
 {
     // Fixture setup
     var sut = new FakeItEasyRelay();
     var dummyContext = new Fake<ISpecimenContext>().FakedObject;
     // Exercise system
     var result = sut.Create(request, dummyContext);
     // Verify outcome
     var expectedResult = new NoSpecimen(request);
     Assert.Equal(expectedResult, result);
     // Teardown
 }
 public void CreateWithInvalidRequestReturnsCorrectResult(object request)
 {
     // Fixture setup
     var sut = new SeededFactory<int>(s => s);
     // Exercise system
     var dummyContainer = new DelegatingSpecimenContext();
     var result = sut.Create(request, dummyContainer);
     // Verify outcome
     var expectedResult = new NoSpecimen(request);
     Assert.Equal(expectedResult, result);
     // Teardown
 }
        public void CreateFromNonStringRequestWillReturnCorrectResult()
        {
            // Arrange
            var sut = new StringGenerator(() => string.Empty);
            var nonStringRequest = new object();
            // Act
            var dummyContainer = new DelegatingSpecimenContext();
            var result         = sut.Create(nonStringRequest, dummyContainer);
            // Assert
            var expectedResult = new NoSpecimen();

            Assert.Equal(expectedResult, result);
        }
        public void CreateFromStringRequestWhenFactoryReturnsNoSpecimenWillReturnCorrectResult()
        {
            // Arrange
            var expectedResult = new NoSpecimen();
            var sut            = new StringGenerator(() => expectedResult);
            var stringRequest  = typeof(string);
            // Act
            var dummyContainer = new DelegatingSpecimenContext();
            var result         = sut.Create(stringRequest, dummyContainer);

            // Assert
            Assert.Equal(expectedResult, result);
        }
        public void CreateWithNonStringSeedWillReturnCorrectResult()
        {
            // Arrange
            var sut           = new StringSeedRelay();
            var nonStringSeed = new SeededRequest(typeof(string), new object());
            // Act
            var dummyContainer = new DelegatingSpecimenContext();
            var result         = sut.Create(nonStringSeed, dummyContainer);
            // Assert
            var expectedResult = new NoSpecimen();

            Assert.Equal(expectedResult, result);
        }
Beispiel #42
0
        public void SutEqualsOtherObjectWhenRequestsAreEqual()
        {
            // Fixture setup
            var    request = new object();
            var    sut     = new NoSpecimen(request);
            object other   = new NoSpecimen(request);
            // Exercise system
            var result = sut.Equals(other);

            // Verify outcome
            Assert.True(result, "Equals");
            // Teardown
        }
 public void CreateWithNonMockRequestReturnsCorrectResult(object request)
 {
     // Fixture setup
     var dummyBuilder = new Mock<ISpecimenBuilder>().Object;
     var sut = new MockPostprocessor(dummyBuilder);
     // Exercise system
     var dummyContext = new Mock<ISpecimenContext>().Object;
     var result = sut.Create(request, dummyContext);
     // Verify outcome
     var expectedResult = new NoSpecimen(request);
     Assert.Equal(expectedResult, result);
     // Teardown
 }
 public void CreateWithNonUriRequestReturnsCorrectResult()
 {
     // Fixture setup
     var sut = new UriGenerator();
     var dummyRequest = new object();
     // Exercise system
     var dummyContext = new DelegatingSpecimenContext();
     var result = sut.Create(dummyRequest, dummyContext);
     // Verify outcome
     var expectedResult = new NoSpecimen(dummyRequest);
     Assert.Equal(expectedResult, result);
     // Teardown
 }
 public void CreateWithNonMockRequestReturnsCorrectResult(object request)
 {
     // Fixture setup
     var dummyBuilder = MockRepository.GenerateMock<ISpecimenBuilder>();
     var sut = new RhinoMockAroundAdvice(dummyBuilder);
     // Exercise system
     var dummyContext = MockRepository.GenerateMock<ISpecimenContext>();
     var result = sut.Create(request, dummyContext);
     // Verify outcome
     var expectedResult = new NoSpecimen(request);
     Assert.Equal(expectedResult, result);
     // Teardown
 }
        public void CreateWithNonConstrainedStringRequestReturnsCorrectResult(object request)
        {
            // Fixture setup
            var sut = new StringLengthAttributeRelay();
            // Exercise system
            var dummyContext = new DelegatingSpecimenContext();
            var result       = sut.Create(request, dummyContext);
            // Verify outcome
            var expectedResult = new NoSpecimen();

            Assert.Equal(expectedResult, result);
            // Teardown
        }
 public void CreateWithNonFakeRequestReturnsCorrectResult(object request)
 {
     // Fixture setup
     var dummyBuilder = A.Fake<ISpecimenBuilder>();
     var sut = new FakeItEasyBuilder(dummyBuilder);
     // Exercise system
     var dummyContext = A.Fake<ISpecimenContext>();
     var result = sut.Create(request, dummyContext);
     // Verify outcome
     var expectedResult = new NoSpecimen();
     Assert.Equal(expectedResult, result);
     // Teardown
 }
 public void CreateWithNonDateTimeTypeRequestReturnsNoSpecimen(Type request)
 {
     // Fixture setup
     var seed = DateTime.Now;
     var sut = new StrictlyMonotonicallyIncreasingDateTimeGenerator(seed);
     // Exercise system
     var dummyContainer = new DelegatingSpecimenContext();
     var result = sut.Create(request, dummyContainer);
     // Verify outcome
     var expectedResult = new NoSpecimen(request);
     Assert.Equal(expectedResult, result);
     // Teardown
 }
Beispiel #49
0
        public void CreateWithNullRequestWillReturnNull()
        {
            // Fixture setup
            var sut = new MethodInvoker(new ModestConstructorQuery());
            // Exercise system
            var dummyContainer = new DelegatingSpecimenContext();
            var result         = sut.Create(null, dummyContainer);
            // Verify outcome
            var expectedResult = new NoSpecimen();

            Assert.Equal(expectedResult, result);
            // Teardown
        }
        public void CreateWithNoEnumeratorRequestReturnsCorrectResult(
            object request)
        {
            var sut = new EnumeratorRelay();
            var dummyContext = new DelegatingSpecimenContext();

            var result = sut.Create(request, dummyContext);

#pragma warning disable 618
            var expectedResult = new NoSpecimen(request);
#pragma warning restore 618
            Assert.Equal(expectedResult, result);
        }
        public void CreateFromNonFieldRequestWillReturnCorrectResult()
        {
            // Arrange
            var nonFieldRequest = new object();
            var sut             = new FieldRequestRelay();
            // Act
            var dummyContainer = new DelegatingSpecimenContext();
            var result         = sut.Create(nonFieldRequest, dummyContainer);
            // Assert
            var expectedResult = new NoSpecimen();

            Assert.Equal(expectedResult, result);
        }
        public void CreateWithInvalidRequestReturnsCorrectResult(object request)
        {
            // Fixture setup
            var sut = new MultipleRelay();
            // Exercise system
            var dummyContainer = new DelegatingSpecimenContext();
            var result         = sut.Create(request, dummyContainer);
            // Verify outcome
            var expectedResult = new NoSpecimen(request);

            Assert.Equal(expectedResult, result);
            // Teardown
        }
 public void CreateWithNonUInt16RequestWillReturnCorrectResult()
 {
     // Fixture setup
     var nonUInt16Request = new object();
     var sut = new UInt16SequenceGenerator();
     // Exercise system
     var dummyContainer = new DelegatingSpecimenContext();
     var result = sut.Create(nonUInt16Request, dummyContainer);
     // Verify outcome
     var expectedResult = new NoSpecimen(nonUInt16Request);
     Assert.Equal(expectedResult, result);
     // Teardown
 }
 public void CreateWithNonStringRequestSeedWillReturnNull()
 {
     // Fixture setup
     var sut = new StringSeedRelay();
     var nonStringRequestSeed = new SeededRequest(typeof(object), "Anonymous value");
     // Exercise system
     var dummyContainer = new DelegatingSpecimenContext();
     var result = sut.Create(nonStringRequestSeed, dummyContainer);
     // Verify outcome
     var expectedResult = new NoSpecimen(nonStringRequestSeed);
     Assert.Equal(expectedResult, result);
     // Teardown
 }
Beispiel #55
0
        public void CreateWithNonGuidRequestWillReturnCorrectResult()
        {
            // Arrange
            var nonGuidRequest = new object();
            var sut            = new GuidGenerator();
            // Act
            var dummyContext = new DelegatingSpecimenContext();
            var result       = sut.Create(nonGuidRequest, dummyContext);
            // Assert
            var expectedResult = new NoSpecimen();

            Assert.Equal(expectedResult, result);
        }
 public void CreateWithAnonymousRequestReturnsCorrectResult()
 {
     // Fixture setup
     var sut = new StringLengthAttributeRelay();
     var dummyRequest = new object();
     // Exercise system
     var dummyContainer = new DelegatingSpecimenContext();
     var result = sut.Create(dummyRequest, dummyContainer);
     // Verify outcome
     var expectedResult = new NoSpecimen(dummyRequest);
     Assert.Equal(expectedResult, result);
     // Teardown
 }
Beispiel #57
0
        public void CreateWithNullRequestWillReturnNull()
        {
            // Fixture setup
            var sut = new SeedIgnoringRelay();
            // Exercise system
            var dummyContainer = new DelegatingSpecimenContext();
            var result         = sut.Create(null, dummyContainer);
            // Verify outcome
            var expectedResult = new NoSpecimen();

            Assert.Equal(expectedResult, result);
            // Teardown
        }
        public void CreateWithNonStringRequestSeedWillReturnNull()
        {
            // Arrange
            var sut = new StringSeedRelay();
            var nonStringRequestSeed = new SeededRequest(typeof(object), "Anonymous value");
            // Act
            var dummyContainer = new DelegatingSpecimenContext();
            var result         = sut.Create(nonStringRequestSeed, dummyContainer);
            // Assert
            var expectedResult = new NoSpecimen();

            Assert.Equal(expectedResult, result);
        }
Beispiel #59
0
        public void GetHashCodeWhenRequestIsNotNullWillReturnCorrectResult()
        {
            // Fixture setup
            var request = new object();
            var sut     = new NoSpecimen(request);
            // Exercise system
            var result = sut.GetHashCode();
            // Verify outcome
            var expectedHashCode = request.GetHashCode();

            Assert.Equal(expectedHashCode, result);
            // Teardown
        }
 public void CreateReturnsNoSpecimenWhenRequestedTypeIsNotAbstract()
 {
     // Fixture setup
     var sut = new SubstituteRelay();
     object request = typeof(string);
     var context = Substitute.For<ISpecimenContext>();
     // Exercise system
     object result = sut.Create(request, context);
     // Verify outcome
     var expected = new NoSpecimen(request);
     Assert.Equal(expected, result);
     // Teardown
 }