Ejemplo n.º 1
0
        public void ByDefaultCanGenerateWillReturnFalseIfParentCannotGenerate()
        {
            // Fixture setup
            var parent = new MockInstanceGenerator { CanGenerateCallback = ap => false };
            var dummyMemberInfo = typeof(object);

            var sut = new InstanceGenerator(parent);
            // Exercise system
            var result = sut.CanGenerate(dummyMemberInfo);
            // Verify outcome
            Assert.IsFalse(result, "CanGenerate");
            // Teardown
        }
Ejemplo n.º 2
0
        public void ByDefaultGenerateWillReturnResultFromParent()
        {
            // Fixture setup
            var expectedResult = new object();
            var parent = new MockInstanceGenerator
            {
                CanGenerateCallback = ap => true,
                GenerateCallback = ap => expectedResult
            };
            var dummyMemberInfo = typeof(object);

            var sut = new InstanceGenerator(parent);
            // Exercise system
            var result = sut.Generate(dummyMemberInfo);
            // Verify outcome
            Assert.AreEqual(expectedResult, result, "Generate");
            // Teardown
        }