mirror of https://github.com/abpframework/abp.git
2 changed files with 51 additions and 2 deletions
@ -0,0 +1,26 @@ |
|||||
|
using Shouldly; |
||||
|
using Xunit; |
||||
|
|
||||
|
namespace System.Collections.Generic |
||||
|
{ |
||||
|
public class AbpCollectionExtensions_Tests |
||||
|
{ |
||||
|
[Fact] |
||||
|
public void AddIfNotContains_With_Predicate() |
||||
|
{ |
||||
|
var collection = new List<int> {4, 5, 6}; |
||||
|
|
||||
|
collection.AddIfNotContains(x => x == 5, () => 5); |
||||
|
collection.Count.ShouldBe(3); |
||||
|
|
||||
|
collection.AddIfNotContains(x => x == 42, () => 42); |
||||
|
collection.Count.ShouldBe(4); |
||||
|
|
||||
|
collection.AddIfNotContains(x => x < 8, () => 8); |
||||
|
collection.Count.ShouldBe(4); |
||||
|
|
||||
|
collection.AddIfNotContains(x => x > 999, () => 8); |
||||
|
collection.Count.ShouldBe(5); |
||||
|
} |
||||
|
} |
||||
|
} |
||||
Loading…
Reference in new issue