public void Apply_NotNullTransformationPassed_AddPassedTransformerToTransformationsList()
        {
            var transformation = new MyAbstractTransformation();

            var builderInstance = _builder.Apply(transformation);

            Assert.AreEqual(_builder, builderInstance);
            Assert.AreEqual(1, _builder.Transformations.Count);
            Assert.AreEqual(transformation, _builder.Transformations[0]);
        }
        public void Transformations_WhenAddTransformation_ItIsAttachedToThisBuilder()
        {
            var transformer = new MyAbstractTransformation();

            _builder.Transformations.Add(transformer);

            Assert.AreEqual(1, _builder.Transformations.Count);
            Assert.AreEqual(transformer, _builder.Transformations[0]);
            Assert.AreEqual(_builder, transformer.GetBuilder());
        }
        public void ApplyIsolated_KeepInitialDestinationParameterPassed_SetItOnTransformer()
        {
            var transformation = new MyAbstractTransformation();

            Assert.IsFalse(transformation.IsIsolatedResult);

            var builderInstance = _builder.ApplyIsolated(transformation, false);

            Assert.AreEqual(_builder, builderInstance);
            Assert.IsFalse(transformation.KeepInitialDestination);
        }
        public void Apply_Generic_CreateTransformer_AndAddItToTransformationsList()
        {
            var transformation = new MyAbstractTransformation();

            A.CallTo(() => _builder.CreateInstance <MyAbstractTransformation>())
            .Returns(transformation);

            var builderInstance = _builder.Apply <MyAbstractTransformation>();

            Assert.AreEqual(_builder, builderInstance);
            Assert.AreEqual(1, _builder.Transformations.Count);
            Assert.AreEqual(transformation, _builder.Transformations[0]);
        }
        public void Transformations_WhenRemoveTransformation_ItIsDetachedFromThisBuilder()
        {
            var transformer = new MyAbstractTransformation();

            _builder.Transformations.Add(transformer);

            Assert.AreEqual(1, _builder.Transformations.Count);
            Assert.AreEqual(transformer, _builder.Transformations[0]);

            _builder.Transformations.Remove(transformer);

            Assert.AreEqual(0, _builder.Transformations.Count);
            Assert.IsNull(transformer.GetBuilder());
        }
        public void ApplyIsolated_Generic_KeepInitialDestinationParameterPassed_SetItOnTransformer()
        {
            var transformation = new MyAbstractTransformation();

            Assert.IsFalse(transformation.IsIsolatedResult);

            A.CallTo(() => _builder.CreateInstance <MyAbstractTransformation>())
            .Returns(transformation);

            var builderInstance = _builder.ApplyIsolated <MyAbstractTransformation>(false);

            Assert.AreEqual(_builder, builderInstance);
            Assert.IsFalse(transformation.KeepInitialDestination);
        }
        public void ApplyIsolated_NotNullTransformationPassed_AddPassedTransformerToTransformationsList()
        {
            var transformation = new MyAbstractTransformation();

            Assert.IsFalse(transformation.IsIsolatedResult);

            var builderInstance = _builder.ApplyIsolated(transformation);

            Assert.AreEqual(_builder, builderInstance);
            Assert.AreEqual(1, _builder.Transformations.Count);
            Assert.AreEqual(transformation, _builder.Transformations[0]);
            Assert.IsTrue(transformation.IsIsolatedResult);
            Assert.AreEqual(!TransformationConfiguration.Default.IsolateInitialDestination, transformation.KeepInitialDestination);
        }
        public void ApplyIsolated_Generic_CreateTransformer_AndAddItToTransformationsList()
        {
            var transformation = new MyAbstractTransformation();

            Assert.IsFalse(transformation.IsIsolatedResult);

            A.CallTo(() => _builder.CreateInstance <MyAbstractTransformation>())
            .Returns(transformation);

            var builderInstance = _builder.ApplyIsolated <MyAbstractTransformation>();

            Assert.AreEqual(_builder, builderInstance);
            Assert.AreEqual(1, _builder.Transformations.Count);
            Assert.AreEqual(transformation, _builder.Transformations[0]);
            Assert.IsTrue(transformation.IsIsolatedResult);
            Assert.AreEqual(!TransformationConfiguration.Default.IsolateInitialDestination, transformation.KeepInitialDestination);
        }