public void TryGet_WithEmptyDictionaryAndTypedSymbol_ReturnsNoValue()
        {
            var symbol     = new Symbol <int>();
            var dictionary = new SymbolDictionary();

            Assert.IsTrue(dictionary.TryGet(symbol) == Maybe <int> .NoValue);
        }
        public void GetSet_RoundTrip_WithUntypedSymbol()
        {
            var symbol     = new Symbol();
            var dictionary = new SymbolDictionary();

            dictionary.Set(symbol, 42);

            Assert.AreEqual(42, dictionary.Get <int>(symbol));
        }
        public void Set_WithNoValue_RemovesFromDictionary()
        {
            var symbol          = new Symbol <int>();
            var innerDictionary = new Dictionary <ISymbol, object> {
                { symbol, 42 }
            };
            var dictionary = new SymbolDictionary(innerDictionary);

            dictionary.Set(symbol, Maybe <int> .NoValue);

            Assert.AreEqual(0, innerDictionary.Count);
        }
        public void Set_ValueTwice_ReturnsSecondValue()
        {
            var symbol          = new Symbol <int>();
            var innerDictionary = new Dictionary <ISymbol, object> {
                { symbol, 42 }
            };
            var dictionary = new SymbolDictionary(innerDictionary);

            dictionary.Set(symbol, 7);
            dictionary.Set(symbol, 42);

            Assert.AreEqual(1, innerDictionary.Count);
            Assert.AreEqual(42, (int)innerDictionary[symbol]);
        }