forked from wasabii/OLinq
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathTakeTests.cs
67 lines (55 loc) · 2.1 KB
/
TakeTests.cs
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
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
using System.Collections.ObjectModel;
using System.Linq;
using Microsoft.VisualStudio.TestTools.UnitTesting;
namespace OLinq.Tests
{
[TestClass]
public class TakeTests
{
ObservableCollection<string> source;
ObservableBuffer<string> buffer;
[TestInitialize]
public void SetupFilters()
{
source = new ObservableCollection<string>("0123456789".Select(i => i.ToString()));
buffer = source.AsObservableQuery().Take(5).AsObservableQuery().ToObservableView().ToBuffer();
}
[TestMethod]
public void NotYetImplemented_TakeWorks()
{
Assert.AreEqual("01234", string.Join("", buffer));
}
[TestMethod]
public void NotYetImplemented_InsertIntoTaken()
{
source.Insert(0, "X");
Assert.AreEqual(string.Join("", source.Take(5)), string.Join("", buffer));
source.Insert(4, "X");
Assert.AreEqual(string.Join("", source.Take(5)), string.Join("", buffer));
}
[TestMethod]
public void NotYetImplemented_InsertAfterTaken()
{
source.Insert(5, "X");
Assert.AreEqual(string.Join("", source.Take(5)), string.Join("", buffer));
source.Insert(7, "X");
Assert.AreEqual(string.Join("", source.Take(5)), string.Join("", buffer));
}
[TestMethod]
public void NotYetImplemented_RemoveFromTaken()
{
source.RemoveAt(0);
Assert.AreEqual(string.Join("", source.Take(5)), string.Join("", buffer));
source.RemoveAt(4);
Assert.AreEqual(string.Join("", source.Take(5)), string.Join("", buffer));
}
[TestMethod]
public void NotYetImplemented_RemovedAfterTaken()
{
source.RemoveAt(0); ;
Assert.AreEqual(string.Join("", source.Take(5)), string.Join("", buffer));
source.RemoveAt(7);
Assert.AreEqual(string.Join("", source.Take(5)), string.Join("", buffer));
}
}
}