示例#1
0
        public void NextIsRaining()
        {
            IMock         random  = new DynamicMock(typeof(System.Random));
            WeatherRandom weather = new DefaultWeatherRandom((System.Random)random.MockInstance);

            random.SetupResult("NextDouble", 0.0);
            Assertion.Assert("is raining", weather.NextIsRaining());

            random.SetupResult("NextDouble", DefaultWeatherRandom.CHANCE_OF_RAIN);
            Assertion.Assert("is not raining", !weather.NextIsRaining());

            random.SetupResult("NextDouble", 1.0);
            Assertion.Assert("is not raining", !weather.NextIsRaining());
        }
示例#2
0
		public void NextIsRaining()
		{
			IMock random = new DynamicMock(typeof(System.Random));
			WeatherRandom weather = new DefaultWeatherRandom((System.Random)random.MockInstance);

			random.SetupResult("NextDouble", 0.0);
			Assertion.Assert("is raining", weather.NextIsRaining());

			random.SetupResult("NextDouble", DefaultWeatherRandom.CHANCE_OF_RAIN);
			Assertion.Assert("is not raining", !weather.NextIsRaining());

			random.SetupResult("NextDouble", 1.0);
			Assertion.Assert("is not raining", !weather.NextIsRaining());
		}