Пример #1
0
        public void GetField_FieldNull()
        {
            var test = InternalFieldFinder.Instance;

            test.Reset();
            var item = new InstanceFieldTest();

            var result = test.GetInstance <InstanceFieldTest>(item.GetMe(), item);

            Assert.That(result, new NullConstraint());
        }
Пример #2
0
        public void GetField_FieldValue()
        {
            var test = InternalFieldFinder.Instance;

            test.Reset();
            var item = new InstanceFieldTest();

            item.finder = new InstanceFieldTest();

            var result = test.GetInstance <InstanceFieldTest>(item.GetMe(), item);

            Assert.That(result, new NotConstraint(new NullConstraint()));
            Assert.That(result, new NUnit.Framework.Constraints.InstanceOfTypeConstraint(typeof(InstanceFieldTest)));
        }
Пример #3
0
 public InstanceFieldTest()
 {
     finder = null;
 }
        public void GetField_FieldNull()
        {
            var test = InternalFieldFinder.Instance;
            test.Reset();
            var item = new InstanceFieldTest();

            var result = test.GetInstance<InstanceFieldTest>(item.GetMe(), item);
            Assert.That(result, new NullConstraint());
        }
 public InstanceFieldTest()
 {
     finder = null;
 }
        public void GetField_CallTwice_DifferentInstances_FieldValues()
        {
            var test = InternalFieldFinder.Instance;
            test.Reset();
            var item = new InstanceFieldTest();
            item.finder = new InstanceFieldTest();
            var item2 = new InstanceFieldTest();
            item2.finder = new InstanceFieldTest();

            var result = test.GetInstance<InstanceFieldTest>(item.GetMe(), item);
            var result2 = test.GetInstance<InstanceFieldTest>(item.GetMe(), item2);
            Assert.That(result, new NotConstraint(new NullConstraint()));
            Assert.That(result, new NUnit.Framework.Constraints.InstanceOfTypeConstraint(typeof(InstanceFieldTest)));
            Assert.That(result2,new NotConstraint( new EqualConstraint(result)));
        }