public void FailOnDuplicate() { PadInt pad = proxy.CreatePadInt(PAD_ID); Assert.IsNotNull(pad, "Failed to create first padInt"); pad = proxy.CreatePadInt(PAD_ID); Assert.IsNull(pad, "Duplicated padint created"); }
public void TestFailOnWrite() { bool canBegin1 = proxy1.TxBegin(); bool canBegin2 = proxy2.TxBegin(); Assert.IsTrue(canBegin1, "Could not begin transaction1"); Assert.IsTrue(canBegin2, "Could nout begin transaction2"); PadInt padInt1 = proxy1.CreatePadInt(PAD_ID1);//os objectos criados e acedidos teem handlers para read/write. ou seja, abrem transaccao à primeira escrita. PadInt padInt2 = proxy2.CreatePadInt(PAD_ID2); Assert.IsNotNull(padInt1, "Could not create padint1 on transaction1"); Assert.IsNotNull(padInt2, "Could not create padint2 on transaction1"); int padint1Read = padInt1.Read(); Thread.Sleep(2000); int padint2Read = padInt2.Read(); Assert.IsNotNull(padint1Read, "Could not read padint1 on transaction1"); Assert.IsNotNull(padint2Read, "Could not read padint2 on transaction1"); Console.WriteLine("========================proxy1 accessing padint 2: ====================" + PAD_ID2); padInt1 = proxy1.AccessPadInt(PAD_ID2); Assert.IsNotNull(padInt1, "Could not access padint2 on transaction1"); Console.WriteLine("========================Write===================="); proxy1.Status(); padInt1.Write(20); }