예제 #1
0
        public void TryGetValueWhenKeyDoesNotExistTest()
        {
            // Arrange
            var dict = new InsertOrderedDictionary <int, string>
            {
                { 2, "3" },
                { 3, "4" },
                { 4, "5" },
                { 5, "1" },
                { 1, "2" }
            };

            // Act
            string actualValue;
            var    actualExists = dict.TryGetValue(6, out actualValue);

            // Assert
            Assert.IsFalse(actualExists);
            Assert.IsNull(actualValue);
        }
예제 #2
0
        public void TryGetValueWhenKeyExistsTest()
        {
            // Arrange
            var dict = new InsertOrderedDictionary <int, string>
            {
                { 2, "3" },
                { 3, "4" },
                { 4, "5" },
                { 5, "1" },
                { 1, "2" }
            };

            // Act
            string actualValue;
            var    actualExists = dict.TryGetValue(4, out actualValue);

            // Assert
            Assert.IsTrue(actualExists);
            Assert.AreEqual("5", actualValue);
        }
		public void TryGetValueWhenKeyDoesNotExistTest()
		{
			// Arrange
			var dict = new InsertOrderedDictionary<int, string>
			{
				{2, "3"},
				{3, "4"},
				{4, "5"},
				{5, "1"},
				{1, "2"}
			};

			// Act
			string actualValue;
			var actualExists = dict.TryGetValue(6, out actualValue);

			// Assert
			Assert.IsFalse(actualExists);
			Assert.IsNull(actualValue);
		}
		public void TryGetValueWhenKeyExistsTest()
		{
			// Arrange
			var dict = new InsertOrderedDictionary<int, string>
			{
				{2, "3"},
				{3, "4"},
				{4, "5"},
				{5, "1"},
				{1, "2"}
			};

			// Act
			string actualValue;
			var actualExists = dict.TryGetValue(4, out actualValue);

			// Assert
			Assert.IsTrue(actualExists);
			Assert.AreEqual("5", actualValue);
		}