private static void VerifySoftDependencies()
{
// Call test methods here if you need to run them without the TestHost/MsTest harness.
// First, let's get the MethodInfo objects for the methods we are going to invoke thru reflection.
// We can use this array for both EnlistPromotableSinglePhase and SetDistributedTransactionIdentifier
if (s_enlistPromotableSinglePhaseMethodInfo == null)
{
Type[] parameterTypes = new Type[] { typeof(IPromotableSinglePhaseNotification), typeof(Guid) };
s_enlistPromotableSinglePhaseMethodInfo = typeof(Transaction).GetTypeInfo().GetMethod("EnlistPromotableSinglePhase", parameterTypes);
s_setDistributedTransactionIdentifierMethodInfo = typeof(Transaction).GetTypeInfo().GetMethod("SetDistributedTransactionIdentifier", parameterTypes);
s_getPromotedTokenMethodInfo = typeof(Transaction).GetTypeInfo().GetMethod("GetPromotedToken");
// And the PropertyInfo objects for PromoterType
s_promoterTypePropertyInfo = typeof(Transaction).GetTypeInfo().GetProperty("PromoterType", typeof(Guid));
// And the FieldInfo for TransactionInterop.PromoterTypeDtc
s_promoterTypeDtcFieldInfo = typeof(TransactionInterop).GetTypeInfo().GetField("PromoterTypeDtc", BindingFlags.Public | BindingFlags.Static);
}
bool allMethodsAreThere = ((s_enlistPromotableSinglePhaseMethodInfo != null) &&
(s_setDistributedTransactionIdentifierMethodInfo != null) &&
(s_getPromotedTokenMethodInfo != null) &&
(s_promoterTypePropertyInfo != null) &&
(s_promoterTypeDtcFieldInfo != null)
);
Assert.True(allMethodsAreThere, "At least one of the expected new methods or properties is not implemented by the available System.Transactions.");
}