Esempio n. 1
0
        public void IHaveA_Accepts_All_Types(Type type)
        {
            var abstractClass = new GivensTests();

            var item = abstractClass.given.IHaveA <HumanTestPoco>();

            Assert.IsType(type, item.Instance);
        }
Esempio n. 2
0
        public void TypeCollection_Can_Be_Saved_And_Retrieved(Type type)
        {
            var abstractClass = new GivensTests();

            abstractClass.given.IHaveA <HumanTestPoco>();
            abstractClass.given.IHaveA <HumanTestPoco>();

            var collection = typeof(BehaviorDriven)
                             .GetMethod("MyGivenItems")
                             .MakeGenericMethod(type)
                             .Invoke(abstractClass, null);

            Assert.True(collection is IEnumerable);

            var enumerable = ((IEnumerable)collection).Cast <object>();
            var array      = enumerable.ToArray();

            Assert.IsType(type, array[0]);
            Assert.NotNull(array[1]);
        }