Skip to content

Commit

Permalink
Commented out dictionary<char,char> test.
Browse files Browse the repository at this point in the history
  • Loading branch information
disks86 committed Jun 23, 2019
1 parent 95fcd08 commit 650d4e4
Showing 1 changed file with 45 additions and 45 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -100,51 +100,51 @@ public static void Execute()
Assert.IsFalse(dictionary2.TryGetValue("Six", out int val4), "Dictionary<string, int>.TryGetValue() of not existing key does not work");
}

#region "Dictionary<char, char> Tests"
{
var dictionary = new Dictionary<char, char>
{
{ 'a', 'a' },
{ 'b', 'b' },
{ 'c', 'c' },
};

Assert.IsTrue(dictionary.ContainsKey('a'), "Dictionary<char, char> ContainsKey does not work1");
Assert.IsFalse(dictionary.ContainsKey('d'), "Dictionary<char, char> ContainsKey does not work2");

Assert.IsTrue(dictionary['a'] == 'a', "Dictionary<char, char> operator [] does not work");
dictionary['b'] = 'v';
Assert.IsTrue(dictionary['b'] == 'v', "Dictionary<char, char> [] operator (set existing) does not work");

Assert.IsTrue(dictionary.Count == 4, "Dictionary<char, char>.Count does not work");
dictionary['d'] = 'd';
Assert.IsTrue(dictionary['d'] == 'd', "Dictionary<char, char> [] operator (set not existing) does not work");

/* We added another key so now Count should be 4 */
Assert.IsTrue(dictionary.Count == 4, "Dictionary<char, char>.Count (after new key) does not work");

Dictionary<char, char>.KeyCollection keyColl = dictionary.Keys;

foreach (var key in keyColl)
{
Assert.IsTrue(key == 'a' || key == 'b' || key == 'c' || key == 'd', "Dictionary<char, char>.Keys returns invalid key");
}

dictionary.Add('e', 'e');
/* We added another key so now Count should be 5 */
Assert.IsTrue(dictionary.Count == 5, "Dictionary<char, char>.Count (after Added key) does not work");

/* Now we remove "5" key, the operation should succeed and Count should be 4 again */
Assert.IsTrue(dictionary.Remove('e'), "Dictionary<char, char>.Remove() of existing key does not work");
Assert.IsTrue(dictionary.Count == 4, "Dictionary<char, char>.Count (after Removed key) does not work");

/* Now we remove "6" key, the operation should fail as there is not "6" key */
Assert.IsFalse(dictionary.Remove('f'), "Dictionary<char, char>.Remove() of not existing key does not work");

Assert.IsTrue(dictionary.TryGetValue('a', out char val1), "Dictionary<char, char>.TryGetValue() of existing key does not work");
Assert.IsFalse(dictionary.TryGetValue('f', out char val2), "Dictionary<char, char>.TryGetValue() of not existing key does not work");
}
#endregion
//#region "Dictionary<char, char> Tests"
//{
// var dictionary = new Dictionary<char, char>
// {
// { 'a', 'a' },
// { 'b', 'b' },
// { 'c', 'c' },
// };

// Assert.IsTrue(dictionary.ContainsKey('a'), "Dictionary<char, char> ContainsKey does not work1");
// Assert.IsFalse(dictionary.ContainsKey('d'), "Dictionary<char, char> ContainsKey does not work2");

// Assert.IsTrue(dictionary['a'] == 'a', "Dictionary<char, char> operator [] does not work");
// dictionary['b'] = 'v';
// Assert.IsTrue(dictionary['b'] == 'v', "Dictionary<char, char> [] operator (set existing) does not work");

// Assert.IsTrue(dictionary.Count == 4, "Dictionary<char, char>.Count does not work");
// dictionary['d'] = 'd';
// Assert.IsTrue(dictionary['d'] == 'd', "Dictionary<char, char> [] operator (set not existing) does not work");

// /* We added another key so now Count should be 4 */
// Assert.IsTrue(dictionary.Count == 4, "Dictionary<char, char>.Count (after new key) does not work");

// Dictionary<char, char>.KeyCollection keyColl = dictionary.Keys;

// foreach (var key in keyColl)
// {
// Assert.IsTrue(key == 'a' || key == 'b' || key == 'c' || key == 'd', "Dictionary<char, char>.Keys returns invalid key");
// }

// dictionary.Add('e', 'e');
// /* We added another key so now Count should be 5 */
// Assert.IsTrue(dictionary.Count == 5, "Dictionary<char, char>.Count (after Added key) does not work");

// /* Now we remove "5" key, the operation should succeed and Count should be 4 again */
// Assert.IsTrue(dictionary.Remove('e'), "Dictionary<char, char>.Remove() of existing key does not work");
// Assert.IsTrue(dictionary.Count == 4, "Dictionary<char, char>.Count (after Removed key) does not work");

// /* Now we remove "6" key, the operation should fail as there is not "6" key */
// Assert.IsFalse(dictionary.Remove('f'), "Dictionary<char, char>.Remove() of not existing key does not work");

// Assert.IsTrue(dictionary.TryGetValue('a', out char val1), "Dictionary<char, char>.TryGetValue() of existing key does not work");
// Assert.IsFalse(dictionary.TryGetValue('f', out char val2), "Dictionary<char, char>.TryGetValue() of not existing key does not work");
//}
//#endregion

#region "Dictionary<sbyte, sbyte> Tests"
{
Expand Down

0 comments on commit 650d4e4

Please sign in to comment.