public void Test_that_specified_in_the_metamodel_strategy_is_used_if_any()
        {
            // Arrange
            var strategiesFactory = new ValueTypeMergingStrategiesFactory();
            var manager           = new EntityValueTypeMergingStrategiesManager(_metamodel, strategiesFactory);

            // Act
            var strategy = manager.GetStrategy(TestEntityWithValueTypeMergingStrategyType);

            // Assert
            Assert.IsNotNull(strategy);
            Assert.IsInstanceOfType(strategy, typeof(UpdateIfDirtyValueTypeMergingStrategy));
        }
        public void Test_that_strategy_types_are_cached()
        {
            // Arrange
            var strategiesFactory = new ValueTypeMergingStrategiesFactory();
            var manager           = new EntityValueTypeMergingStrategiesManager(_metamodel, strategiesFactory);

            // Act
            manager.GetStrategy(TestEntityWithValueTypeMergingStrategyType);
            manager.GetStrategy(TestEntityWithValueTypeMergingStrategyType);

            // Assert
            Assert.AreEqual(1, _metamodel.GetCreatedTimes(TestEntityWithValueTypeMergingStrategyType));
        }
        public void Test_that_default_strategy_is_forbid_value_type_merging()
        {
            // Arrange
            var strategiesFactory = new ValueTypeMergingStrategiesFactory();
            var manager           = new EntityValueTypeMergingStrategiesManager(_metamodel, strategiesFactory);

            // Act
            var strategy = manager.GetStrategy(TestEntityWithoutValueTypeMergingStrategyType);

            // Assert
            Assert.IsNotNull(strategy);
            Assert.IsInstanceOfType(strategy, typeof(ForbidValueTypeMergingStrategy));
        }
        public void Test_that_strategy_instances_are_always_different()
        {
            // Arrange
            var strategiesFactory = new ValueTypeMergingStrategiesFactory();
            var manager           = new EntityValueTypeMergingStrategiesManager(_metamodel, strategiesFactory);

            // Act
            var strategy1 = manager.GetStrategy(TestEntityWithValueTypeMergingStrategyType);
            var strategy2 = manager.GetStrategy(TestEntityWithValueTypeMergingStrategyType);

            // Assert
            Assert.IsNotNull(strategy1);
            Assert.AreNotSame(strategy1, strategy2);
            Assert.AreEqual(strategy1.GetType(), strategy2.GetType());
        }