コード例 #1
0
        public void BuildFrom_does_not_throw_for_valid_type_implementing_IInjectionFactory()
        {
            var attr = new DependencyInjectingTestFixtureAttribute(typeof(ValidInjectionFactory), typeof(ValidTypeDiscoverer));

            Assert.That(
                () => attr.BuildFrom(new TypeWrapper(typeof(ValidInjectionFactory))),
                Throws.Nothing
                );
        }
コード例 #2
0
        public void BuildFrom_throws_an_ArgumentOutOfRangeException_if_factoryType_does_not_implement_IInjectionFactory()
        {
            var attr = new DependencyInjectingTestFixtureAttribute(typeof(IEnumerable), typeof(ValidTypeDiscoverer));

            Assert.That(
                () => attr.BuildFrom(new TypeWrapper(typeof(IEnumerable))),
                Throws.InstanceOf <ArgumentOutOfRangeException>()
                );
        }
コード例 #3
0
        public void BuildFrom_returns_a_single_TestSuite_named_after_the_test_class(Type type)
        {
            ValidInjectionFactory.FactoryFunc = t => new object();
            var attr  = new DependencyInjectingTestFixtureAttribute(typeof(ValidInjectionFactory), typeof(ValidTypeDiscoverer));
            var suite = attr.BuildFrom(new TypeWrapper(type)).ToList();

            Assert.That(suite, Is.Not.Null);
            Assert.That(suite.Count, Is.EqualTo(1));
            Assert.That(suite.First().Name, Is.EqualTo(type.Name));
        }