-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathTODO.txt
73 lines (46 loc) · 2.67 KB
/
TODO.txt
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
68
69
70
71
72
-----------------------------------------------------------------------------------------
Bugs?
-----------------------------------------------------------------------------------------
We did convert Assert.That(() => Dummy, Throws.InstanceOf<OutOfMemoryException>()) to
something like this:
Assert.IsInstanceOfType(Assert.ThrowsException<Exception>(Dummy),typeof(OutOfMemoryException));
This doesn't work in practice, because Assert.ThrowsException<Exception>(),
will fail if not exactly System.Exception is thrown.
We would need to do something like this:
try {
/* test */
Assert.Fail($"Expected exception of type {exceptionType}.");
} catch (Exception ex) when (!(ex is AssertFailException)) {
Assert.IsInstanceOfType(ex, exceptionType);
}
So currently, this is commented out and will not be converted.
-----------------------------------------------------------------------------------------
Package
-----------------------------------------------------------------------------------------
Make sure that project that has been selected, has successfully been built, is up to date,
and no contained files are unsaved, etc.
-----------------------------------------------------------------------------------------
Asserts
-----------------------------------------------------------------------------------------
CollectionAssert.AreEqual(ICollection, ICollection)
CollectionAssert.AreEqual(v1?.ToArray(), v2?.ToArray())
Assert.AreEqual(<collection type>, <collection type>)
CollectionAssert.AreEqual( ... )
Assert.That(actual.ToList(), Is.EqualTo(expected.ToList()).Using(new MyComparer()));
CollectionAssert.AreEqual(actual.ToList(), expected.ToList(), new MyComparer());
Assert.That(actual.ToList(), Is.EquivalentTo(expected.ToList()).Using(new MyComparer()));
CollectionAssert.AreEquivalent() does not support a custom comparer.
Assert.That(actual, Is.EqualTo(expected).Using(new MyComparer()));
Assert.*Equal() does not support using a custom comparer.
Workaround:
CollectionAssert.AreEqual(new [] { actual }, new [] { expected }, new MyComparer());
Assert.That(() => result, Is.Not.Null);
Assert.That(() => result.Foo, Is.EqualTo(options.Foo));
Assert.That(() => result.Foo, Is.Empty);
Assert.That(() => result.Foo, Is.Empty);
Assert.That(() => result, Is.Not.Null.Or.Empty, "dldldl");
Could all be converted to simple "Assert.AreEqual", "Assert.IsEmpty", etc.
because the expression is just a value.
Assert.That(() => /*whatever*/, Throws.InnerException.InstanceOf<DirectoryNotFoundException>());
Assert.That(() => /*whatever*/, Throws.InnerException.TypeOf<DirectoryNotFoundException>());
Must be manually handled.