Skip to content

Commit 36b388e

Browse files
committed
TryGetValue<>单元测试
1 parent 7231421 commit 36b388e

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

WebApiClientCore.Test/DataCollectionTest.cs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,12 @@ public void ReadWriteTest()
1818
var state = datas.TryGetValue(typeof(DataCollectionTest), out var value);
1919
Assert.True(state && value is DataCollectionTest);
2020

21+
state = datas.TryGetValue<DataCollectionTest>(typeof(DataCollectionTest), out var tValue);
22+
Assert.True(state && tValue != null);
23+
24+
state = datas.TryGetValue<DataCollectionTest>(typeof(string), out _);
25+
Assert.False(state);
26+
2127
datas.TryRemove("string", out _);
2228
Assert.True(datas.Get<string>("string") == default);
2329
}

0 commit comments

Comments
 (0)