Skip to content

Commit

Permalink
Failing test in CompareToSet - don't know why yet...
Browse files Browse the repository at this point in the history
  • Loading branch information
marcusoftnet committed Feb 10, 2011
1 parent 0177142 commit 3c7f444
Show file tree
Hide file tree
Showing 4 changed files with 108 additions and 2 deletions.
19 changes: 18 additions & 1 deletion Specs/CompareToAssist/CompareTo.feature
Expand Up @@ -24,4 +24,21 @@ Scenario: CompareToInstance
| Field | Value |
| Name | Anders |
| Style | very cool |
| BirthDate | 10/9/1974 12:00:00 AM |
| BirthDate | 10/9/1974 12:00:00 AM |

# CompareToSet will test only the properties that you define in the table.
# CompareToSet does not test the order of the objects, only that one was found that matches
Scenario: CompareToSet
Given I have the following persons using assist
| Name | Style | Birth date |
| Marcus | Cool | 1972-10-09 |
| Anders | Butch | 1977-01-01 |
| Jocke | Soft | 1974-04-04 |
Then CompareToSet should match this
| Name | Style | BirthDate |
| Marcus | Cool | 10/9/1972 12:00:00 AM |
| Anders | Butch | 1/1/1977 12:00:00 AM |
| Jocke | Soft | 4/4/1974 12:00:00 AM |
And CompareToSet should not match this
| Name | Style | BirthDate |
| Marcus | Cool | 10/9/1972 12:00:00 AM |
60 changes: 60 additions & 0 deletions Specs/CompareToAssist/CompareTo.feature.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

26 changes: 25 additions & 1 deletion Specs/CompareToAssist/CompareToSteps.cs
@@ -1,4 +1,5 @@
using Should.Fluent;
using System.Collections.Generic;
using Should.Fluent;
using Specs.TestEntities;
using TechTalk.SpecFlow;
using TechTalk.SpecFlow.Assist;
Expand Down Expand Up @@ -35,5 +36,28 @@ public void CompareToInstanceShouldNotMatch(Table instanceTableToNotMatch)
ex.Message.Should().Not.Be.Empty();
}
}


[Then(@"CompareToSet should match this")]
public void CompareToSetShouldMatch(Table tableToMatch)
{
var persons = ScenarioContext.Current.Get<List<Person>>();
tableToMatch.CompareToSet(persons);
}

[Then(@"CompareToSet should not match this")]
public void CompareToSetShouldNotMatch(Table tableToNotMatch)
{
var persons = ScenarioContext.Current.Get<List<Person>>();

try
{
tableToNotMatch.CompareToInstance(persons);
}
catch (ComparisonException ex)
{
ex.Message.Should().Not.Be.Empty();
}
}
}
}
5 changes: 5 additions & 0 deletions Specs/TestEntities/Person.cs
Expand Up @@ -18,5 +18,10 @@ public override bool Equals(object obj)
(Style == pIn.Style) &&
(BirthDate == pIn.BirthDate);
}

public override int GetHashCode()
{
return base.GetHashCode();
}
}
}

0 comments on commit 3c7f444

Please sign in to comment.