InternalUtilities\OneOrManyTests.cs (35)
40Verify(OneOrMany.Create(ImmutableArray<int>.Empty));
41Verify(new OneOrMany<int>(ImmutableArray<int>.Empty));
47Verify(OneOrMany.Create(1), 1);
48Verify(OneOrMany.Create(ImmutableArray.Create(2)), 2);
49Verify(OneOrMany.Create(ImmutableArray<int>.Empty).Add(3), 3);
50Verify(new OneOrMany<int>(1), 1);
51Verify(new OneOrMany<int>(ImmutableArray.Create(2)), 2);
52Verify(new OneOrMany<int>(ImmutableArray<int>.Empty).Add(3), 3);
58Verify(OneOrMany.OneOrNone(1), 1);
59Verify(OneOrMany.OneOrNone("x"), "x");
60Verify(OneOrMany.OneOrNone<string>(null));
66Verify(OneOrMany.Create(ImmutableArray.Create(1, 2, 3)).Add(4), 1, 2, 3, 4);
67Verify(OneOrMany.Create(ImmutableArray.Create(1, 2, 3, 4)), 1, 2, 3, 4);
68Verify(OneOrMany.Create(ImmutableArray<int>.Empty).Add(1).Add(2).Add(3).Add(4), 1, 2, 3, 4);
69Verify(new OneOrMany<int>(ImmutableArray.Create(1, 2, 3)).Add(4), 1, 2, 3, 4);
70Verify(new OneOrMany<int>(ImmutableArray.Create(1, 2, 3, 4)), 1, 2, 3, 4);
71Verify(new OneOrMany<int>(ImmutableArray<int>.Empty).Add(1).Add(2).Add(3).Add(4), 1, 2, 3, 4);
72Verify(OneOrMany.Create(ImmutableArray.Create(1)).Add(4), 1, 4);
73Verify(OneOrMany.Create(ImmutableArray.Create(1)), 1);
75Verify(OneOrMany.Create(1, 2), 1, 2);
97Verify(OneOrMany<int>.Empty.RemoveAll(1));
98Verify(OneOrMany.Create(1).RemoveAll(1));
99Verify(OneOrMany.Create(2).RemoveAll(1), 2);
100Verify(OneOrMany.Create(1, 2).RemoveAll(1), 2);
101Verify(OneOrMany.Create(1, 2).RemoveAll(2), 1);
102Verify(OneOrMany.Create(1, 1).RemoveAll(1));
103Verify(OneOrMany.Create(ImmutableArray.Create(1, 1, 1, 2)).RemoveAll(1), 2);
109Verify(OneOrMany.Create(1).Select(i => i + 1), 2);
110Verify(OneOrMany.Create(ImmutableArray<int>.Empty).Select(i => i + 1));
111Verify(OneOrMany.Create(ImmutableArray.Create(1)).Select(i => i + 1), 2);
112Verify(OneOrMany.Create(ImmutableArray.Create(1, 2)).Select(i => i + 1), 2, 3);
118Verify(OneOrMany.Create(1).Select((i, a) => i + a, 1), 2);
119Verify(OneOrMany.Create(ImmutableArray<int>.Empty).Select((i, a) => i + a, 1));
120Verify(OneOrMany.Create(ImmutableArray.Create(1)).Select((i, a) => i + a, 1), 2);
121Verify(OneOrMany.Create(ImmutableArray.Create(1, 2)).Select((i, a) => i + a, 1), 2, 3);