Exemple #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);
        }
Exemple #2
0
 public void Ctor_Default_Value_Misconfigured_Config_Throws() => VerifyMisconfiguredVariant(
     x => new Variant <int>(x), default(int)
     , VariantConfigurationCollection.Create(VariantConfiguration.Configure <long>())
     );
Exemple #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>())
                              );
Exemple #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>())
                              );