public void NoTransactionOneTake() { TestPart part = _container.GetExportedValue <TransactionPolicy <TestPart> >(); Assert.IsNotNull(part); Assert.AreEqual(1, _collector.PartCount); }
public void SingleTransactionOneTake() { using (new TransactionScope()) { TestPart part = _container.GetExportedValue <TransactionPolicy <TestPart> >(); } Assert.AreEqual(1, _collector.PartCount); }
public void SingleThreadTwoTakes() { TestPart part = _container.GetExportedValue <ThreadPolicy <TestPart> >(); TestPart part2 = _container.GetExportedValue <ThreadPolicy <TestPart> >(); Assert.AreSame(part, part2); Assert.AreEqual(1, _collector.PartCount); }
public void TwoThreadsTwoTakes() { TestPart part = _container.GetExportedValue <ThreadPolicy <TestPart> >(); TestPart part2 = null; Task.Run(() => part2 = _container.GetExportedValue <ThreadPolicy <TestPart> >()).Wait(); Assert.AreNotSame(part, part2); Assert.AreEqual(2, _collector.PartCount); }
public void NoTransaction_TwoTakes() { TestPart part = _container.GetExportedValue <TransactionPolicy <TestPart> >(); TestPart part2 = _container.GetExportedValue <TransactionPolicy <TestPart> >(); Assert.IsNotNull(part); Assert.IsNotNull(part2); Assert.AreNotSame(part, part2); Assert.AreEqual(2, _collector.PartCount); }
public void TwoThreadsFourTakes() { TestPart part1 = _container.GetExportedValue <ThreadPolicy <TestPart> >(); TestPart part2 = _container.GetExportedValue <ThreadPolicy <TestPart> >(); TestPart part3 = null; TestPart part4 = null; Task.Run(() => { part3 = _container.GetExportedValue <ThreadPolicy <TestPart> >(); part4 = _container.GetExportedValue <ThreadPolicy <TestPart> >(); }).Wait(); Assert.AreSame(part1, part2); Assert.AreSame(part3, part4); Assert.AreNotSame(part3, part2); Assert.AreEqual(2, _collector.PartCount); }
public void SingleThreadOneTake() { TestPart part = _container.GetExportedValue <ThreadPolicy <TestPart> >(); Assert.AreEqual(1, _collector.PartCount); }