Ejemplo n.º 1
0
 public IEnumerable <Task <ScenarioResult> > test_method()
 {
     return(Enumerable.Range(0, 5)
            .Select(async _ => await Scenario.For <DateTime>()
                    .Given(() => new DateTime(2000, 1, 1))
                    .When(date => date.AddDays(1))
                    .ThenShouldEqual(new DateTime(2000, 1, 1))));
 }
Ejemplo n.º 2
0
        public async Task a_value_object_with_no_when_should()
        {
            var result = await Scenario.For <DateTime>()
                         .Given(() => new DateTime(2000, 1, 1))
                         .ThenShouldEqual(new DateTime(2000, 1, 1));

            Assert.True(result.Passed);
        }
Ejemplo n.º 3
0
        public async Task a_passing_value_object_scenario_should()
        {
            var result = await Scenario.For <DateTime>()
                         .Given(() => new DateTime(2000, 1, 1))
                         .When(date => date.AddDays(1))
                         .ThenShouldEqual(new DateTime(2000, 1, 2));

            Assert.True(result.Passed);
        }
Ejemplo n.º 4
0
        public async Task a_value_object_throwing_an_expected_exception_in_given_should()
        {
            var result = await Scenario.For <DateTime>()
                         .Given(() => new DateTime(Int32.MaxValue, 1, 1))
                         .ThenShouldThrow <ArgumentOutOfRangeException>();

            Assert.True(result.Passed);
            Assert.IsType <ArgumentOutOfRangeException>(result.Results);
        }
Ejemplo n.º 5
0
        public async Task a_value_object_throwing_an_exception_in_given_should()
        {
            var result = await Scenario.For <DateTime>()
                         .Given(() => new DateTime(Int32.MinValue, 1, 1))
                         .When(date => date.AddYears(Int32.MinValue))
                         .ThenShouldThrow <ArgumentOutOfRangeException>();

            Assert.True(result.Passed);
        }
Ejemplo n.º 6
0
        public async Task a_value_object_throwing_an_exception_in_when_should()
        {
            var result = await Scenario.For <DateTime>()
                         .Given(() => new DateTime(2000, 1, 1))
                         .When(date => date.AddYears(Int32.MinValue))
                         .ThenShouldEqual(new DateTime(2000, 1, 3));

            Assert.False(result.Passed);
            Assert.IsType <ScenarioException>(result.Results);
        }