Ejemplo n.º 1
0
 public void TestIsMaybeTypeGenericFalse()
 {
     Assert.IsFalse(MaybeUtils.IsMaybeType <object>(typeof(object)));
     Assert.IsFalse(MaybeUtils.IsMaybeType <object>(typeof(Maybe <>)));
     Assert.IsFalse(MaybeUtils.IsMaybeType <int>(typeof(Maybe <double>)));
     Assert.IsFalse(MaybeUtils.IsMaybeType <object>(typeof(Maybe <Type>)));
 }
 /// <inheritdoc />
 public void CreateValidationMetadata(ValidationMetadataProviderContext context)
 {
     if (MaybeUtils.IsMaybeType(context.Key.ModelType))
     {
         // Maybe<T> should be considered as a whole during validation. Prevent ASP.NET Core from validating
         // the children of a Maybe<T> instance.
         context.ValidationMetadata.ValidateChildren = false;
     }
 }
Ejemplo n.º 3
0
 /// <inheritdoc />
 public override bool CanConvert(Type objectType)
 {
     return(MaybeUtils.IsMaybeType(objectType));
 }
Ejemplo n.º 4
0
 public void TestIsMaybeTypeGenericTrue()
 {
     Assert.IsTrue(MaybeUtils.IsMaybeType <int>(typeof(Maybe <int>)));
     Assert.IsTrue(MaybeUtils.IsMaybeType <DateTime>(typeof(Maybe <DateTime>)));
 }
Ejemplo n.º 5
0
 public void TestIsMaybeTypeGenericNull()
 {
     Assert.Throws <ArgumentNullException>(() => MaybeUtils.IsMaybeType <object>(null));
 }
Ejemplo n.º 6
0
 public void TestIsMaybeTypeFalse()
 {
     Assert.IsFalse(MaybeUtils.IsMaybeType(typeof(object)));
     Assert.IsFalse(MaybeUtils.IsMaybeType(typeof(Maybe <>)));
 }
Ejemplo n.º 7
0
 public void TestIsMaybeTypeTrue()
 {
     Assert.IsTrue(MaybeUtils.IsMaybeType(typeof(Maybe <object>)));
     Assert.IsTrue(MaybeUtils.IsMaybeType(typeof(Maybe <int>)));
 }
Ejemplo n.º 8
0
 public void TestIsMaybeTypeNull()
 {
     Assert.Throws <ArgumentNullException>(() => MaybeUtils.IsMaybeType(null));
 }