Ejemplo n.º 1
0
        public void Create_with_type_parameter_should_return_object_from_Create()
        {
            var factory = new TestableFakeFactory() as IDummyFactory;
            var created = factory.Create(typeof(SomeType));

            created.Should().BeOfType <SomeType>();
        }
Ejemplo n.º 2
0
        public void Create_with_type_parameter_should_return_object_from_Create()
        {
            var factory = new TestableFakeFactory() as IDummyFactory;
            var created = factory.Create(typeof(SomeType));

            Assert.That(created, Is.InstanceOf <SomeType>());
        }
Ejemplo n.º 3
0
        public void Create_should_guard_against_bad_type_argument()
        {
            string expectedMessage = string.Format(
                "The {0} can only create dummies of type {1}.*",
                typeof(TestableFakeFactory),
                typeof(SomeType));

            var factory = new TestableFakeFactory() as IDummyFactory;

            var exception = Record.Exception(() => factory.Create(typeof(DummyFactoryTests)));

            exception.Should()
            .BeAnExceptionOfType <ArgumentException>()
            .WithMessage(expectedMessage)
            .And.ParamName.Should().Be("type");
        }