public void Clear() { var people = Enumerable.Range(1, 100).Select(i => new PersonObs("Name" + i, i)).ToArray(); using var stub = new FilterPropertyStub(); stub.Source.AddRange(people); stub.Source.Clear(); stub.Results.Data.Count.Should().Be(0); }
public void ChangeAValueSoItIsStillInTheFilter() { var people = Enumerable.Range(1, 100).Select(i => new Person("Name" + i, i)).ToArray(); using var stub = new FilterPropertyStub(); stub.Source.AddRange(people); people[50].Age = 100; stub.Results.Messages.Count.Should().Be(2); stub.Results.Data.Count.Should().Be(82); }
public void RemoveRange() { var people = Enumerable.Range(1, 100).Select(i => new Person("Name" + i, i)).ToArray(); using (var stub = new FilterPropertyStub()) { stub.Source.AddRange(people); stub.Source.RemoveRange(89, 10); stub.Results.Data.Count.Should().Be(72); } }
public void RemoveRange() { var people = Enumerable.Range(1, 100).Select(i => new PersonObs("Name" + i, i)).ToArray(); using var stub = new FilterPropertyStub(); stub.Source.AddRange(people); stub.Source.RemoveRange(89, 10); stub.Results.Data.Count.Should().Be(72); // initial addrange, refreshes to filter out < 18 and then removerange // stub.Results.Messages.Count.Should().Be(1+18+1); }
public void ChangeAValueSoItIsStillInTheFilter() { var people = Enumerable.Range(1, 100).Select(i => new PersonObs("Name" + i, i)).ToArray(); using var stub = new FilterPropertyStub(); stub.Source.AddRange(people); people[50].SetAge(100); stub.Results.Data.Count.Should().Be(82); // initial add range, refreshes to filter out < 18 and then no refresh for the no-op filter change // stub.Results.Messages.Count.Should().Be(102); }
public void InitialValues() { var people = Enumerable.Range(1, 100).Select(i => new Person("Name" + i, i)).ToArray(); using var stub = new FilterPropertyStub(); stub.Source.AddRange(people); 1.Should().Be(stub.Results.Messages.Count); 82.Should().Be(stub.Results.Data.Count); stub.Results.Data.Items.Should().BeEquivalentTo(people.Skip(18)); }
public void ChangeAValueToNoLongerMatchFilter() { var people = Enumerable.Range(1, 100).Select(i => new Person("Name" + i, i)).ToArray(); using var stub = new FilterPropertyStub(); stub.Source.AddRange(people); people[10].Age = 20; 2.Should().Be(stub.Results.Messages.Count); 83.Should().Be(stub.Results.Data.Count); }
public void ChangeAValueToMatchFilter() { var people = Enumerable.Range(1, 100).Select(i => new Person("Name" + i, i)).ToArray(); using (var stub = new FilterPropertyStub()) { stub.Source.AddOrUpdate(people); people[20].Age = 10; 2.Should().Be(stub.Results.Messages.Count); 81.Should().Be(stub.Results.Data.Count); } }
public void ChangeAValueSoItIsStillInTheFilter() { var people = Enumerable.Range(1, 100).Select(i => new Person("Name" + i, i)).ToArray(); using (var stub = new FilterPropertyStub()) { stub.Source.AddRange(people); people[50].Age = 100; Assert.That(stub.Results.Messages.Count, Is.EqualTo(1)); Assert.That(stub.Results.Data.Count, Is.EqualTo(82)); } }
public void ChangeAValueToNoLongerMatchFilter() { var people = Enumerable.Range(1, 100).Select(i => new Person("Name" + i, i)).ToArray(); using (var stub = new FilterPropertyStub()) { stub.Source.AddRange(people); people[10].Age = 20; Assert.That(stub.Results.Messages.Count, Is.EqualTo(2)); Assert.That(stub.Results.Data.Count, Is.EqualTo(83)); } }
public void InitialValues() { var people = Enumerable.Range(1, 100).Select(i => new Person("Name" + i, i)).ToArray(); using (var stub = new FilterPropertyStub()) { stub.Source.AddRange(people); Assert.That(stub.Results.Messages.Count, Is.EqualTo(1)); Assert.That(stub.Results.Data.Count, Is.EqualTo(82)); CollectionAssert.AreEquivalent(people.Skip(18), stub.Results.Data.Items); } }
public void InitialValues() { var people = Enumerable.Range(1, 100).Select(i => new PersonObs("Name" + i, i)).ToArray(); using var stub = new FilterPropertyStub(); stub.Source.AddRange(people); // should have 100-18 left stub.Results.Data.Count.Should().Be(82); // initial addrange, refreshes to filter out < 18 // stub.Results.Messages.Count.Should().Be(1+18); stub.Results.Data.Items.Should().BeEquivalentTo(people.Skip(18)); }
public void ChangeAValueToMatchFilter() { var people = Enumerable.Range(1, 100).Select(i => new PersonObs("Name" + i, i)).ToArray(); using var stub = new FilterPropertyStub(); stub.Source.AddRange(people); people[20].SetAge(10); // should have 100-18-1 left stub.Results.Data.Count.Should().Be(81); // initial addrange, refreshes to filter out < 18 and then refresh for the filter change // stub.Results.Messages.Count.Should().Be(1+18+1); }