Пример #1
0
        public static TaxStrategyFactory GetInstance(ITaxConfigurationRepository configurationRepository)
        {
            if(_instance == null)
            {
                if (configurationRepository == null) configurationRepository = new TaxConfigurationRepository();

                _instance = new TaxStrategyFactory(configurationRepository);
            }

            return _instance;
        }
        public void GetInstanceTest_with_custom_repository()
        {
            // Arrange
            ITaxConfigurationRepository configurationRepository = new TaxConfigurationRepository();

            // Act
            TaxStrategyFactory actual = TaxStrategyFactory.GetInstance(configurationRepository);
            TaxStrategyFactory actual2 = TaxStrategyFactory.GetInstance();

            // Assert
            Assert.AreSame(actual, actual2);
        }