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 ChangeResolutionStep <LocalTestResource, string>(
                changeResolvers, "bogus config");

            var localTestResource = new LocalTestResource(1);

            try
            {
                _resolutionStepUnderTest.Resolve(localTestResource);
                Assert.Fail("Expecting ChangeResolutionException");
            }
            catch (ChangeResolutionException ex)
            {
                Assert.AreEqual("Failed to resolve change for LocalTestResource - 1", 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 ChangeResolutionStep<LocalTestResource, string>(
                changeResolvers, "bogus config");

            var localTestResource = new LocalTestResource(1);
            try
            {
                _resolutionStepUnderTest.Resolve(localTestResource);
                Assert.Fail("Expecting ChangeResolutionException");
            }
            catch(ChangeResolutionException ex)
            {
                Assert.AreEqual("Failed to resolve change for LocalTestResource - 1", ex.Message);
                Assert.AreEqual(exception, ex.InnerException);
                Assert.AreEqual(localTestResource, ex.Item);
            }
        }