public void CreateaSeededAnonymousOnSpecimenBuilderComposerReturnsCorrectResult()
        {
            // Arrange
            var seed            = new Version(1, 1);
            var expectedResult  = new Version(2, 0);
            var specimenBuilder = new DelegatingSpecimenBuilder();

            specimenBuilder.OnCreate = (r, c) =>
            {
                Assert.NotNull(c);
                Assert.Equal(new SeededRequest(typeof(Version), seed), r);
                return(expectedResult);
            };

            // Act
            var result = specimenBuilder.Create(seed);

            // Assert
            Assert.Equal(expectedResult, result);
        }
示例#2
0
        public void CreateaSeededAnonymousOnSpecimenBuilderComposerReturnsCorrectResult()
        {
            // Fixture setup
            var seed            = new Version(1, 1);
            var expectedResult  = new Version(2, 0);
            var specimenBuilder = new DelegatingSpecimenBuilder();

            specimenBuilder.OnCreate = (r, c) =>
            {
                Assert.NotNull(c);
                Assert.Equal(new SeededRequest(typeof(Version), seed), r);
                return(expectedResult);
            };

            // Exercise system
            var result = specimenBuilder.Create(seed);

            // Verify outcome
            Assert.Equal(expectedResult, result);
            // Teardown
        }
        public void CreateWithSeedOnSpecimenBuilderReturnsCorrectResult()
        {
            // Arrange
            var seed     = new Version(2, 15);
            var expected = new Version(3, 0);
            var builder  = new DelegatingSpecimenBuilder();

            builder.OnCreate = (r, c) =>
            {
                Assert.NotNull(c);
                Assert.Equal(
                    new SeededRequest(typeof(Version), seed),
                    r);
                return(expected);
            };
            // Act
            Version actual = builder.Create <Version>(seed);

            // Assert
            Assert.Equal(expected, actual);
        }
示例#4
0
        public void CreateWithSeedOnSpecimenBuilderReturnsCorrectResult()
        {
            // Fixture setup
            var seed     = new Version(2, 15);
            var expected = new Version(3, 0);
            var builder  = new DelegatingSpecimenBuilder();

            builder.OnCreate = (r, c) =>
            {
                Assert.NotNull(c);
                Assert.Equal(
                    new SeededRequest(typeof(Version), seed),
                    r);
                return(expected);
            };
            // Exercise system
            Version actual = builder.Create <Version>(seed);

            // Verify outcome
            Assert.Equal(expected, actual);
            // Teardown
        }