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

fix order of actual and expected values in asserts #550

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 17 additions & 17 deletions src/DynamicData.Tests/Binding/NotifyPropertyChangedExFixture.cs
Original file line number Diff line number Diff line change
Expand Up @@ -25,20 +25,20 @@ public void SubscribeToPropertyChangeForAllItemsInList(bool notifyOnInitialValue
if (notifyOnInitialValue)
{
anotherPerson.Should().Be(lastChange.Sender);
10.Should().Be(lastChange.Value);
lastChange.Value.Should().Be(10);
}
else
{
lastChange.Sender.Name.Should().Be("unknown");
(-1).Should().Be(lastChange.Value);
lastChange.Value.Should().Be(-1);
}

person.Age = 12;
person.Should().Be(lastChange.Sender);
12.Should().Be(lastChange.Value);
lastChange.Sender.Should().Be(person);
lastChange.Value.Should().Be(12);
anotherPerson.Age = 13;
anotherPerson.Should().Be(lastChange.Sender);
13.Should().Be(lastChange.Value);
lastChange.Sender.Should().Be(anotherPerson);
lastChange.Value.Should().Be(13);
}

[Theory, InlineData(true), InlineData(false)]
Expand All @@ -50,21 +50,21 @@ public void SubscribeToProperyChangedOnASingleItem(bool notifyOnInitialValue)

if (notifyOnInitialValue)
{
person.Should().Be(lastChange.Sender);
10.Should().Be(lastChange.Value);
lastChange.Sender.Should().Be(person);
lastChange.Value.Should().Be(10);
}
else
{
lastChange.Sender.Name.Should().Be("unknown");
(-1).Should().Be(lastChange.Value);
lastChange.Value.Should().Be(-1);
}

person.Age = 12;
person.Should().Be(lastChange.Sender);
12.Should().Be(lastChange.Value);
lastChange.Sender.Should().Be(person);
lastChange.Value.Should().Be(12);
person.Age = 13;
person.Should().Be(lastChange.Sender);
13.Should().Be(lastChange.Value);
lastChange.Sender.Should().Be(person);
lastChange.Value.Should().Be(13);
}

[Theory, InlineData(true), InlineData(false)]
Expand All @@ -76,9 +76,9 @@ public void SubscribeToValueChangedOnASingleItem(bool notifyOnInitialValue)

(notifyOnInitialValue ? 10 : -1).Should().Be(age);
person.Age = 12;
12.Should().Be(age);
age.Should().Be(12);
person.Age = 13;
13.Should().Be(age);
age.Should().Be(13);
}

[Theory, InlineData(true), InlineData(false)]
Expand All @@ -94,9 +94,9 @@ public void SubscribeToValueChangeForAllItemsInList(bool notifyOnInitialValue)

(notifyOnInitialValue ? 10 : -1).Should().Be(lastAgeChange);
person.Age = 12;
12.Should().Be(lastAgeChange);
lastAgeChange.Should().Be(12);
anotherPerson.Age = 13;
13.Should().Be(lastAgeChange);
lastAgeChange.Should().Be(13);
}
}
}
12 changes: 6 additions & 6 deletions src/DynamicData.Tests/Cache/FilterOnPropertyFixture.cs
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,8 @@ public void ChangeAValueToMatchFilter()

people[20].Age = 10;

2.Should().Be(stub.Results.Messages.Count);
81.Should().Be(stub.Results.Data.Count);
stub.Results.Messages.Count.Should().Be(2);
stub.Results.Data.Count.Should().Be(81);
}

[Fact]
Expand All @@ -46,8 +46,8 @@ public void ChangeAValueToNoLongerMatchFilter()

people[10].Age = 20;

2.Should().Be(stub.Results.Messages.Count);
83.Should().Be(stub.Results.Data.Count);
stub.Results.Messages.Count.Should().Be(2);
stub.Results.Data.Count.Should().Be(83);
}

[Fact]
Expand All @@ -57,8 +57,8 @@ public void InitialValues()
using var stub = new FilterPropertyStub();
stub.Source.AddOrUpdate(people);

1.Should().Be(stub.Results.Messages.Count);
82.Should().Be(stub.Results.Data.Count);
stub.Results.Messages.Count.Should().Be(1);
stub.Results.Data.Count.Should().Be(82);

stub.Results.Data.Items.Should().BeEquivalentTo(people.Skip(18));
}
Expand Down
14 changes: 7 additions & 7 deletions src/DynamicData.Tests/Cache/FullJoinFixture.cs
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ public void AddLeftOnly()
innerCache.AddOrUpdate(new Device("Device3"));
});

3.Should().Be(_result.Data.Count);
_result.Data.Count.Should().Be(3);
_result.Data.Lookup("Device1").HasValue.Should().BeTrue();
_result.Data.Lookup("Device2").HasValue.Should().BeTrue();
_result.Data.Lookup("Device3").HasValue.Should().BeTrue();
Expand Down Expand Up @@ -64,7 +64,7 @@ public void AddLetThenRight()
innerCache.AddOrUpdate(new DeviceMetaData("Device3"));
});

3.Should().Be(_result.Data.Count);
_result.Data.Count.Should().Be(3);

_result.Data.Items.All(dwm => dwm.MetaData != Optional<DeviceMetaData>.None).Should().BeTrue();
}
Expand All @@ -80,7 +80,7 @@ public void AddRightOnly()
innerCache.AddOrUpdate(new DeviceMetaData("Device3"));
});

3.Should().Be(_result.Data.Count);
_result.Data.Count.Should().Be(3);
_result.Data.Lookup("Device1").HasValue.Should().BeTrue();
_result.Data.Lookup("Device2").HasValue.Should().BeTrue();
_result.Data.Lookup("Device3").HasValue.Should().BeTrue();
Expand All @@ -107,7 +107,7 @@ public void AddRightThenLeft()
innerCache.AddOrUpdate(new Device("Device3"));
});

3.Should().Be(_result.Data.Count);
_result.Data.Count.Should().Be(3);

_result.Data.Items.All(dwm => dwm.MetaData != Optional<DeviceMetaData>.None).Should().BeTrue();
}
Expand Down Expand Up @@ -143,8 +143,8 @@ public void RemoveVarious()

_right.Remove("Device3");

3.Should().Be(_result.Data.Count);
2.Should().Be(_result.Data.Items.Count(dwm => dwm.MetaData != Optional<DeviceMetaData>.None));
_result.Data.Count.Should().Be(3);
_result.Data.Items.Count(dwm => dwm.MetaData != Optional<DeviceMetaData>.None).Should().Be(2);

_left.Remove("Device1");
_result.Data.Lookup("Device1").HasValue.Should().BeTrue();
Expand All @@ -171,7 +171,7 @@ public void UpdateRight()
innerCache.AddOrUpdate(new Device("Device3"));
});

3.Should().Be(_result.Data.Count);
_result.Data.Count.Should().Be(3);

_result.Data.Items.All(dwm => dwm.MetaData != Optional<DeviceMetaData>.None).Should().BeTrue();
}
Expand Down
18 changes: 9 additions & 9 deletions src/DynamicData.Tests/Cache/InnerJoinFixture.cs
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ public void AddLeftOnly()
innerCache.AddOrUpdate(new Device("Device3"));
});

0.Should().Be(_result.Data.Count);
_result.Data.Count.Should().Be(0);
}

[Fact]
Expand All @@ -58,7 +58,7 @@ public void AddLeftThenRight()
innerCache.AddOrUpdate(new DeviceMetaData(3,"Device3"));
});

3.Should().Be(_result.Data.Count);
_result.Data.Count.Should().Be(3);
}

[Fact]
Expand All @@ -72,7 +72,7 @@ public void AddRightOnly()
innerCache.AddOrUpdate(new DeviceMetaData(3,"Device3"));
});

0.Should().Be(_result.Data.Count);
_result.Data.Count.Should().Be(0);
}

[Fact]
Expand All @@ -94,7 +94,7 @@ public void AddRightThenLeft()
innerCache.AddOrUpdate(new Device("Device3"));
});

3.Should().Be(_result.Data.Count);
_result.Data.Count.Should().Be(3);
}

public void Dispose()
Expand Down Expand Up @@ -129,10 +129,10 @@ public void RemoveVarious()

_right.Remove(3);

2.Should().Be(_result.Data.Count);
_result.Data.Count.Should().Be(2);

_left.Remove("Device1");
1.Should().Be(_result.Data.Count);
_result.Data.Count.Should().Be(1);
_result.Data.Lookup(("Device1",1)).HasValue.Should().BeFalse();
_result.Data.Lookup(("Device2",2)).HasValue.Should().BeTrue();
_result.Data.Lookup(("Device3",3)).HasValue.Should().BeFalse();
Expand All @@ -157,7 +157,7 @@ public void UpdateRight()
innerCache.AddOrUpdate(new Device("Device3"));
});

3.Should().Be(_result.Data.Count);
_result.Data.Count.Should().Be(3);
}


Expand All @@ -180,7 +180,7 @@ public void MultipleRight()
innerCache.AddOrUpdate(new DeviceMetaData(3,"Device3"));
});

3.Should().Be(_result.Data.Count);
_result.Data.Count.Should().Be(3);
}

[Fact]
Expand All @@ -203,7 +203,7 @@ public void MoreRight()
innerCache.AddOrUpdate(new DeviceMetaData(4,"Device4"));
});

3.Should().Be(_result.Data.Count);
_result.Data.Count.Should().Be(3);

_result.Data.Lookup(("Device4",4)).HasValue.Should().BeFalse();

Expand Down
14 changes: 7 additions & 7 deletions src/DynamicData.Tests/Cache/LeftJoinFixture.cs
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ public void AddLeftOnly()
innerCache.AddOrUpdate(new Device("Device3"));
});

3.Should().Be(_result.Data.Count);
_result.Data.Count.Should().Be(3);
_result.Data.Lookup("Device1").HasValue.Should().BeTrue();
_result.Data.Lookup("Device2").HasValue.Should().BeTrue();
_result.Data.Lookup("Device3").HasValue.Should().BeTrue();
Expand All @@ -63,7 +63,7 @@ public void AddLetThenRight()
innerCache.AddOrUpdate(new DeviceMetaData("Device3"));
});

3.Should().Be(_result.Data.Count);
_result.Data.Count.Should().Be(3);

_result.Data.Items.All(dwm => dwm.MetaData != Optional<DeviceMetaData>.None).Should().BeTrue();
}
Expand All @@ -79,7 +79,7 @@ public void AddRightOnly()
innerCache.AddOrUpdate(new DeviceMetaData("Device3"));
});

0.Should().Be(_result.Data.Count);
_result.Data.Count.Should().Be(0);
}

[Fact]
Expand All @@ -101,7 +101,7 @@ public void AddRightThenLeft()
innerCache.AddOrUpdate(new Device("Device3"));
});

3.Should().Be(_result.Data.Count);
_result.Data.Count.Should().Be(3);

_result.Data.Items.All(dwm => dwm.MetaData != Optional<DeviceMetaData>.None).Should().BeTrue();
}
Expand Down Expand Up @@ -134,8 +134,8 @@ public void RemoveVarious()

_right.Remove("Device3");

3.Should().Be(_result.Data.Count);
2.Should().Be(_result.Data.Items.Count(dwm => dwm.MetaData != Optional<DeviceMetaData>.None));
_result.Data.Count.Should().Be(3);
_result.Data.Items.Count(dwm => dwm.MetaData != Optional<DeviceMetaData>.None).Should().Be(2);

_left.Remove("Device1");
_result.Data.Lookup("Device1").HasValue.Should().BeFalse();
Expand All @@ -160,7 +160,7 @@ public void UpdateRight()
innerCache.AddOrUpdate(new Device("Device3"));
});

3.Should().Be(_result.Data.Count);
_result.Data.Count.Should().Be(3);

_result.Data.Items.All(dwm => dwm.MetaData != Optional<DeviceMetaData>.None).Should().BeTrue();
}
Expand Down
20 changes: 10 additions & 10 deletions src/DynamicData.Tests/Cache/RightJoinFixture.cs
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ public void AddLeftOnly()
innerCache.AddOrUpdate(new Device("Device3"));
});

0.Should().Be(_result.Data.Count);
_result.Data.Count.Should().Be(0);
}

[Fact]
Expand All @@ -58,7 +58,7 @@ public void AddLeftThenRight()
innerCache.AddOrUpdate(new DeviceMetaData(3,"Device3"));
});

3.Should().Be(_result.Data.Count);
_result.Data.Count.Should().Be(3);

_result.Data.Items.All(dwm => dwm.Device != Optional<Device>.None).Should().BeTrue();
}
Expand All @@ -74,7 +74,7 @@ public void AddRightOnly()
innerCache.AddOrUpdate(new DeviceMetaData(3,"Device3"));
});

3.Should().Be(_result.Data.Count);
_result.Data.Count.Should().Be(3);
_result.Data.Lookup(1).HasValue.Should().BeTrue();
_result.Data.Lookup(2).HasValue.Should().BeTrue();
_result.Data.Lookup(3).HasValue.Should().BeTrue();
Expand All @@ -101,7 +101,7 @@ public void AddRightThenLeft()
innerCache.AddOrUpdate(new Device("Device3"));
});

3.Should().Be(_result.Data.Count);
_result.Data.Count.Should().Be(3);

_result.Data.Items.All(dwm => dwm.Device != Optional<Device>.None).Should().BeTrue();
}
Expand Down Expand Up @@ -134,12 +134,12 @@ public void RemoveVarious()

_right.Remove(3);

2.Should().Be(_result.Data.Count);
2.Should().Be(_result.Data.Items.Count(dwm => dwm.Device != Optional<Device>.None));
_result.Data.Count.Should().Be(2);
_result.Data.Items.Count(dwm => dwm.Device != Optional<Device>.None).Should().Be(2);

_left.Remove("Device1");
_result.Data.Lookup(1).HasValue.Should().BeTrue();
1.Should().Be(_result.Data.Items.Count(dwm => dwm.Device == Optional<Device>.None));
_result.Data.Items.Count(dwm => dwm.Device == Optional<Device>.None).Should().Be(1);
}

[Fact]
Expand All @@ -161,7 +161,7 @@ public void UpdateRight()
innerCache.AddOrUpdate(new Device("Device3"));
});

3.Should().Be(_result.Data.Count);
_result.Data.Count.Should().Be(3);

_result.Data.Items.All(dwm => dwm.Device != Optional<Device>.None).Should().BeTrue();
}
Expand All @@ -185,7 +185,7 @@ public void MultipleRight()
innerCache.AddOrUpdate(new DeviceMetaData(3,"Device3"));
});

3.Should().Be(_result.Data.Count);
_result.Data.Count.Should().Be(3);

_result.Data.Items.All(dwm => dwm.Device != Optional<Device>.None).Should().BeTrue();
}
Expand All @@ -210,7 +210,7 @@ public void MoreRight()
innerCache.AddOrUpdate(new DeviceMetaData(4,"Device4"));
});

4.Should().Be(_result.Data.Count);
_result.Data.Count.Should().Be(4);

_result.Data.Lookup(4).HasValue.Should().BeTrue();
_result.Data.Items.Count(dwm => dwm.Device == Optional<Device>.None).Should().Be(1);
Expand Down
Loading