Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

"Scenario: DateTime Accuracy to One Second" fails sometimes #129

Closed
chrislwade opened this issue Nov 22, 2013 · 0 comments
Closed

"Scenario: DateTime Accuracy to One Second" fails sometimes #129

chrislwade opened this issue Nov 22, 2013 · 0 comments
Milestone

Comments

@chrislwade
Copy link
Contributor

When run during the last 100ms of any given second, the following scenario fails:

Scenario: DateTime Accuracy to One Second
        Given I have a DateTime value
        And I have a second DateTime value that varies from the first by 100 milliseconds
        When I adjust the accuracy of each DateTime value to one second
        And I compare the first and second DateTime values
        Then the resulting difference should be zero

This fails because of the following:

// TimeExtensionSteps.cs:47
[Given(@"I have a DateTime value")]
public void CreateFirstDateTime()
{
    _context.FirstValue = DateTime.Now;
}

[Given(@"I have a second DateTime value that varies from the first by (.*) milliseconds")]
public void CreateSecondDateTime(int millisecondAdjustment)
{
    _context.SecondValue = _context.FirstValue.AddMilliseconds(millisecondAdjustment);
}

If DateTime.now's Millisecond property is in the range (900..999) and millisecondAdjustment is 100 or more, this test will fail.

chrislwade pushed a commit to chrislwade/code-patterns that referenced this issue Nov 22, 2013
- Switch 'Scenario: DateTime Accuracy to One Second' into an outline.
- Use explicit `DateTime` values to control random failures.
chrislwade added a commit to chrislwade/code-patterns that referenced this issue Nov 22, 2013
- Switch 'Scenario: DateTime Accuracy to One Second' into an outline.
- Use explicit `DateTime` values to control random failures.
chrislwade added a commit to chrislwade/code-patterns that referenced this issue Nov 23, 2013
- Switch 'Scenario: DateTime Accuracy to One Second' into an outline.
- Use explicit `DateTime` values to control random failures.
@ghost ghost assigned chrislwade Nov 23, 2013
chrislwade added a commit to chrislwade/code-patterns that referenced this issue Nov 28, 2013
- Switch 'Scenario: DateTime Accuracy to One Second' into an outline.
- Use explicit `DateTime` values to control random failures.
jbatte47 added a commit that referenced this issue Nov 29, 2013
Issue #129 - fix TimeExtensions feature bug
@chrislwade chrislwade removed their assignment Apr 13, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants