Пример #1
0
        public void StubValuesForInterface()
        {
            var value = StubValue.ForType(typeof(IMyInterface));

            Assert.That(value, Is.InstanceOf <IProxy>());
            Assert.That(((IProxy)value).BaseObject, Is.TypeOf <Mock>());
        }
Пример #2
0
        public void StubValuesForDelegate()
        {
            var value = StubValue.ForType(typeof(Action));

            Assert.That(value, Is.InstanceOf <Delegate>());
            Assert.That(((Delegate)value).Target, Is.InstanceOf <IProxy>());
            Assert.That(((IProxy)((Delegate)value).Target).BaseObject, Is.TypeOf <Mock>());
        }
Пример #3
0
 public void StubValuesForArrays()
 {
     Assert.That(StubValue.ForType(typeof(int[])), Is.Empty);
     Assert.That(StubValue.ForType(typeof(double[, ])), Is.Empty);
     Assert.That(StubValue.ForType(typeof(string[, , ])), Is.Empty);
 }
Пример #4
0
 public void StubValuesForStrings()
 {
     Assert.That(StubValue.ForType(typeof(string)), Is.EqualTo(string.Empty));
 }
Пример #5
0
 public void StubValuesForReferenceTypesWithoutDefaultConstructors()
 {
     Assert.That(StubValue.ForType(typeof(Uri)), Is.Null);
 }
Пример #6
0
 public void StubValuesForReferenceTypesWithDefaultConstructors()
 {
     Assert.That(StubValue.ForType(typeof(List <int>)), Is.Not.Null.And.TypeOf <List <int> >());
 }
Пример #7
0
 public void StubValuesForValueTypes()
 {
     Assert.AreEqual(0, StubValue.ForType(typeof(int)));
     Assert.AreEqual(0.0, StubValue.ForType(typeof(double)));
     Assert.AreEqual(0m, StubValue.ForType(typeof(decimal)));
 }