public void ExceptionOnEndWithTwoDatabases() { RootService2 service = container.Resolve <RootService2>(); OrderDao2 orderDao = container.Resolve <OrderDao2>("myorderdao"); try { service.DoTwoDBOperation_Create(true); } catch (InvalidOperationException) { // Expected } catch (RollbackResourceException e) { foreach (var resource in e.FailedResources) { Console.WriteLine(resource.Second); } throw; } Array blogs = service.FindAll(typeof(Blog)); Array blogitems = service.FindAll(typeof(BlogItem)); Array orders = orderDao.FindAll(typeof(Order)); Assert.IsNotNull(blogs); Assert.IsNotNull(blogitems); Assert.IsNotNull(orders); Assert.AreEqual(0, blogs.Length); Assert.AreEqual(0, blogitems.Length); Assert.AreEqual(0, orders.Length); }
public void SuccessfulSituationWithTwoDatabases() { RootService2 service = container.Resolve <RootService2>(); OrderDao2 orderDao = container.Resolve <OrderDao2>("myorderdao"); try { service.DoTwoDBOperation_Create(false); } catch (Exception ex) { if (ex.InnerException != null && ex.InnerException.GetType().Name == "TransactionManagerCommunicationException") { Assert.Ignore("MTS is not available"); } throw; } Array blogs = service.FindAll(typeof(Blog)); Array blogitems = service.FindAll(typeof(BlogItem)); Array orders = orderDao.FindAll(typeof(Order)); Assert.IsNotNull(blogs); Assert.IsNotNull(blogitems); Assert.IsNotNull(orders); Assert.AreEqual(1, blogs.Length); Assert.AreEqual(1, blogitems.Length); Assert.AreEqual(1, orders.Length); }