public void ShouldReturnActionWhenApplicable() { _shouldResolve = true; var localTestResource = new LocalTestResource(1); var action = _resolutionStepUnderTest.Resolve(localTestResource); Assert.IsNotNull(action); action.Execute(); Assert.IsTrue(_isResolved); }
public void ShouldWrapExceptionIntoChangeResolutionException() { var exception = new Exception("Whatever resolution error"); _testSynchronizationResolver = new SynchronizationResolver <LocalTestResource, string>( "bogus config", (item, cfg) => { throw exception; }, (item, cfg) => { _isResolved = true; return(new SynchronizationResult(true)); }); var changeResolvers = new List <ISynchronizationResolver <LocalTestResource> > { _testSynchronizationResolver }; _resolutionStepUnderTest = new ChangeResolutionStepOld <LocalTestResource, string>( changeResolvers, "bogus config"); var localTestResource = new LocalTestResource(1); try { _resolutionStepUnderTest.Resolve(localTestResource); Assert.Fail("Expecting ChangeResolutionException"); } catch (ChangeResolutionException ex) { Assert.AreEqual(string.Format("Failed to resolve change for {0}", ex.Item), ex.Message); Assert.AreEqual(exception, ex.InnerException); Assert.AreEqual(localTestResource, ex.Item); } }
public void ShouldWrapExceptionIntoChangeResolutionException() { var exception = new Exception("Whatever resolution error"); _testSynchronizationResolver = new SynchronizationResolver<LocalTestResource, string>( "bogus config", (item, cfg) => { throw exception; }, (item, cfg) => { _isResolved = true; return new SynchronizationResult(true); }); var changeResolvers = new List<ISynchronizationResolver<LocalTestResource>> { _testSynchronizationResolver }; _resolutionStepUnderTest = new ChangeResolutionStepOld<LocalTestResource, string>( changeResolvers, "bogus config"); var localTestResource = new LocalTestResource(1); try { _resolutionStepUnderTest.Resolve(localTestResource); Assert.Fail("Expecting ChangeResolutionException"); } catch (ChangeResolutionException ex) { Assert.AreEqual(string.Format("Failed to resolve change for {0}", ex.Item), ex.Message); Assert.AreEqual(exception, ex.InnerException); Assert.AreEqual(localTestResource, ex.Item); } }