public static void TestCase_SetDistributedIdWithWrongNotificationObject()
{
string testCaseDescription = "TestCase_SetDistributedIdWithWrongNotificationObject";
Trace("**** " + testCaseDescription + " ****");
AutoResetEvent pspeCompleted = new AutoResetEvent(false);
NonMSDTCPromoterEnlistment pspe = null;
Guid guidToSet = new Guid("236BC646-FE3B-41F9-99F7-08BF448D8420");
try
{
using (TransactionScope ts = new TransactionScope())
{
pspe = (NonMSDTCPromoterEnlistment)CreatePSPEEnlistment(NonMsdtcPromoterTests.PromoterType1,
NonMsdtcPromoterTests.PromotedToken1,
pspeCompleted,
/*nonMSDTC = */ true,
/*tx = */ null,
/*spcResponse=*/ TransactionStatus.Committed,
/*expectRejection=*/ false,
/*comparePromotedToken=*/ false,
/*failInitialize=*/ false,
/*failPromote=*/ false,
/*failSPC=*/ false,
/*failGetPromoterType=*/ false,
/*failGetId=*/ false,
/*incorrectNotificationObjectToSetDistributedTransactionId=*/ true
);
Promote(testCaseDescription, NonMsdtcPromoterTests.PromotedToken1);
ts.Complete();
}
}
catch (Exception ex)
{
Assert.Null(ex);
}
// The NonMSDTCPromoterEnlistment is coded to set "Promoted" at the beginning of Promote, before
// throwing.
Assert.True(pspeCompleted.WaitOne(TimeSpan.FromSeconds(5)));
Assert.True(pspe.Promoted);
TestPassed();
}