예제 #1
0
        public void SetConversionStrategyAndConvertWithoutId_ShouldError()
        {
            var contract = new Contract {
                Name = "Hello world"
            };
            var conversionStrategy = new MockConversionStrategy();

            _converterService.ConversionStrategy = conversionStrategy;

            var conversionResult = _converterService.ConvertContract(contract);

            Assert.False(conversionResult);
            Assert.Equal("Id is not defined", _converterService.GetErrorMessage());
        }
예제 #2
0
        public void SetConversionStrategyAndConvert_ShouldConvert()
        {
            var contract = new Contract {
                Name = "Hello world", Id = "Contract1"
            };
            var conversionStrategy = new MockConversionStrategy();

            _converterService.ConversionStrategy = conversionStrategy;

            var conversionResult = _converterService.ConvertContract(contract);

            Assert.True(conversionResult);
            Assert.Equal(contract.Name, _converterService.GetConvertedCode());
        }