public void GetAllKeysAsListCaseNullCheck() { Dictionary <Object, Object> dictionary = null; // ReSharper disable once AssignNullToNotNullAttribute // ReSharper disable once ReturnValueOfPureMethodIsNotUsed Action test = () => dictionary.GetAllKeysAsList(); test.ShouldThrow <ArgumentNullException>(); }
public void GetAllKeysAsListTestCase() { var dictionary = new Dictionary<String, String> { { RandomValueEx.GetRandomString(), RandomValueEx.GetRandomString() }, { RandomValueEx.GetRandomString(), RandomValueEx.GetRandomString() } }; var allKeys = dictionary.GetAllKeysAsList(); Assert.IsTrue( dictionary.All( x => allKeys.Contains( x.Key ) ) ); }
public void GetAllKeysAsListTest() { var dictionary = new Dictionary <String, String> { { Extensions.GetRandomString(), Extensions.GetRandomString() }, { Extensions.GetRandomString(), Extensions.GetRandomString() } }; var allKeys = dictionary.GetAllKeysAsList(); Assert.True(dictionary.All(x => allKeys.Contains(x.Key))); }
public void ContainsAllKeyTestCase1() { var dictionary = new Dictionary<String, String> { { RandomValueEx.GetRandomString(), RandomValueEx.GetRandomString() }, { RandomValueEx.GetRandomString(), RandomValueEx.GetRandomString() } }; var allKeys = dictionary.GetAllKeysAsList(); Assert.IsTrue( dictionary.ContainsAllKey( allKeys ) ); allKeys.Add( "test" ); Assert.IsFalse( dictionary.ContainsAllKey( allKeys ) ); }
public void ContainsAllKeyTest1() { var dictionary = new Dictionary <String, String> { { RandomValueEx.GetRandomString(), RandomValueEx.GetRandomString() }, { RandomValueEx.GetRandomString(), RandomValueEx.GetRandomString() } }; var allKeys = dictionary.GetAllKeysAsList(); Assert.True(dictionary.ContainsAllKey(allKeys)); allKeys.Add("test"); Assert.False(dictionary.ContainsAllKey(allKeys)); }
public void ContainsAnyKeyTestCase1() { var dictionary = new Dictionary<String, String> { { RandomValueEx.GetRandomString(), RandomValueEx.GetRandomString() }, { RandomValueEx.GetRandomString(), RandomValueEx.GetRandomString() } }; var keys = dictionary.GetAllKeysAsList(); Assert.IsTrue( dictionary.ContainsAnyKey( keys ) ); keys.RemoveAt( 0 ); keys.Add( "test" ); Assert.IsTrue( dictionary.ContainsAnyKey( keys ) ); Assert.IsFalse( dictionary.ContainsAnyKey( new List<String> { "test", "test2" } ) ); }
public void ContainsAnyKeyTest1() { var dictionary = new Dictionary <String, String> { { RandomValueEx.GetRandomString(), RandomValueEx.GetRandomString() }, { RandomValueEx.GetRandomString(), RandomValueEx.GetRandomString() } }; var keys = dictionary.GetAllKeysAsList(); Assert.True(dictionary.ContainsAnyKey(keys)); keys.RemoveAt(0); keys.Add("test"); Assert.True(dictionary.ContainsAnyKey(keys)); Assert.False(dictionary.ContainsAnyKey(new List <String> { "test", "test2" })); }