public void Unregister_CorrectWorkflow() { var mock1 = new Mock <IUnitOfWork>(); var mock2 = new Mock <IUnitOfWork>(); var registry = new UnitOfWorkRegistry(); registry.Register(mock1.Object); registry.Register(mock2.Object); registry.Unregister(mock2.Object); registry.Unregister(mock1.Object); Assert.IsNull(registry.GetCurrent()); }
public void Unregister_UnexistingUoW_ThrowsException() { var mock1 = new Mock <IUnitOfWork>(); var registry = new UnitOfWorkRegistry(); registry.Unregister(mock1.Object); }
private Task WorkForAsyncOperations_asyncOperation(UnitOfWorkRegistry registry) { var mock2 = new Mock <IUnitOfWork>(); registry.Register(mock2.Object); Assert.AreEqual(mock2.Object, registry.GetCurrent()); registry.Unregister(mock2.Object); return(Task.FromResult(true)); }
public void Unregister_WrongOrder_ThrowsException() { var mock1 = new Mock <IUnitOfWork>(); var mock2 = new Mock <IUnitOfWork>(); var registry = new UnitOfWorkRegistry(); registry.Register(mock1.Object); registry.Register(mock2.Object); registry.Unregister(mock1.Object); }
public async Task WorkForAsyncOperations() { var mock1 = new Mock <IUnitOfWork>(); var registry = new UnitOfWorkRegistry(); registry.Register(mock1.Object); Assert.AreEqual(mock1.Object, registry.GetCurrent()); await WorkForAsyncOperations_asyncOperation(registry); Assert.AreEqual(mock1.Object, registry.GetCurrent()); registry.Unregister(mock1.Object); Assert.IsNull(registry.GetCurrent()); }