Beispiel #1
0
        private static void VerifyDefaultConstructor <T>(VariantEquatableCallback equatableCallback
                                                         , VariantComparableCallback comparableCallback, Action <T> verify)
        {
            var instance = Variant.Create <T>(VariantConfigurationCollection.Create(
                                                  VariantConfiguration.Configure <T>(equatableCallback, comparableCallback)
                                                  )
                                              );

            Assert.NotNull(instance);
            verify(instance.Value);
        }
Beispiel #2
0
 public void Ctor_Default_Value_Misconfigured_Config_Throws() => VerifyMisconfiguredVariant(
     x => new Variant <int>(x), default(int)
     , VariantConfigurationCollection.Create(VariantConfiguration.Configure <long>())
     );
Beispiel #3
0
 public void Create_Incompatible_Variant_Types_Instance_Throws() => VerifyInvalidVariantCombination <
     DerivedClass, BaseClass>((type, x, cfg) => (Variant <DerivedClass>)Variant.Create(type, x, cfg)
                              , new BaseClass(), VariantConfigurationCollection.Create(VariantConfiguration.Configure <BaseClass>())
                              );
Beispiel #4
0
 public void Ctor_Incompatible_Variant_Types_Null_Value_Config_Value_Throws() => VerifyInvalidVariantCombination <
     DerivedClass, BaseClass>((type, x, cfg) => new Variant <DerivedClass>(type, x, cfg)
                              , null, VariantConfigurationCollection.Create(VariantConfiguration.Configure <BaseClass>())
                              );