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)))); }
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); }
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); }
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); }
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); }
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); }