-
-
Notifications
You must be signed in to change notification settings - Fork 191
Expand file tree
/
Copy pathOnItemFixture.cs
More file actions
38 lines (28 loc) · 774 Bytes
/
OnItemFixture.cs
File metadata and controls
38 lines (28 loc) · 774 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
using System;
using DynamicData.Tests.Domain;
using Xunit;
namespace DynamicData.Tests.List;
public class OnItemFixture
{
[Fact]
public void OnItemAddCalled()
{
var called = false;
var source = new SourceList<Person>();
source.Connect().OnItemAdded(_ => called = true).Subscribe();
var person = new Person("A", 1);
source.Add(person);
Assert.True(called);
}
[Fact]
public void OnItemRemovedCalled()
{
var called = false;
var source = new SourceList<Person>();
source.Connect().OnItemRemoved(_ => called = true).Subscribe();
var person = new Person("A", 1);
source.Add(person);
source.Remove(person);
Assert.True(called);
}
}