public void ShouldReturnTrueIfRulesAreMet(IDictionary <Dress, bool> rules, dynamic state1, dynamic state2)
        {
            //given
            _rulesEngine.GetRule(Dress.JacketOn).Returns(rules);

            _stateManager.isStateVisited((Dress)state1.State).Returns((bool)state1.flag);
            _stateManager.isStateVisited((Dress)state2.State).Returns((bool)state2.flag);

            Assert.True(_dressValidator.isValid(Dress.JacketOn));
        }
Beispiel #2
0
 public HotWeatherTests()
 {
     _writerMock     = Substitute.For <IWriter>();
     _dressValidator = Substitute.For <IDressValidator>();
     _hotWeather     = new HotWeatherDressing(_writerMock, _dressValidator);
     _dressValidator.isValid(Dress.PantsOn).ReturnsForAnyArgs(true);
 }
 public ColdWeatherTests()
 {
     _writerMock     = Substitute.For <IWriter>();
     _dressValidator = Substitute.For <IDressValidator>();
     _coldWeather    = new ColdWeatherDressing(_writerMock, _dressValidator);
     _dressValidator.isValid(Dress.Pajamas_Off).ReturnsForAnyArgs(true);
 }
        protected internal void validateDress(Dress dressCommand, Action callback)
        {
            if (!_dressValidator.isValid(dressCommand))
            {
                throw new WeatherDressRuleViolatedException(string.Format("Voilated the rule for {0}", dressCommand));
            }

            callback();
        }
Beispiel #5
0
 public void ShouldThrowInvalidDressInstructionException()
 {
     _dressValidator.isValid(Dress.FootwearOn).ReturnsForAnyArgs(false);
     Assert.Throws(typeof(WeatherDressRuleViolatedException), () => _hotWeather.PutOnFootwear());
 }