Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using DictionaryWorkshop.Implementation;
- using DictionaryWorkshop.Implementation.Contracts;
- using DictionaryWorkshop.Models;
- using Microsoft.VisualStudio.TestTools.UnitTesting;
- namespace DictionaryWorkshop.Tests
- {
- [TestClass]
- public class DictionaryTests
- {
- [TestMethod]
- public void Indexer_NotExistingElement_ShouldReturnTheValue()
- {
- // Arrange
- MyDictionary<int, string> dictionary = new MyDictionary<int, string> { { 555, "Vasko" } };
- string[] expectedValues = { "Vasko", "Gosho" };
- // Act
- dictionary[5] = "Gosho";
- IEnumerable<string> values = dictionary.GetValues();
- // Assert
- CollectionAssert.AreEquivalent(expectedValues, values.ToArray());
- }
- [TestMethod]
- [ExpectedException(typeof(KeyNotFoundException))]
- public void Indexer_NonExistingElement_ShouldThrowException()
- {
- // Arrange
- MyDictionary<int, string> dictionary = new MyDictionary<int, string>();
- // Act
- string value = dictionary[12345];
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment