public void ShouldExntedReadOnlyDictionaryByToImmutableSetMultiDictionaryMethod() { // given var dictionary = Dictionaries.CreateImmutable("A", "A1", "B", "B1", "C", "C1"); // when var multiDictionary = dictionary.ToImmutableSetMultiDictionary(); // then Check.That(multiDictionary) .IsEqualTo(ImmutableSetMultiDictionary <string, string> .Of("A", "A1", "B", "B1", "C", "C1")); }
public void ShouldReturnObjectIfIsPresentInReadOnlyDictionary() { // given var expectedValue = DateTime.Now; IReadOnlyDictionary <int, DateTime?> dictionary = Dictionaries.CreateImmutable <int, DateTime?>(1, expectedValue); // when var value = dictionary.GetIfPresent(1); // then Check.That(value).IsEqualTo(expectedValue); }
public void ShouldExtendReadOnlyDictionaryByEntriesMethod() { // given var dictionary = Dictionaries.CreateImmutable("A", "A1", "B", "B1", "C", "C1"); // when var entries = dictionary.Entries(); // then Check.That(entries).HasSize(3); Check.That(entries).Contains( Dictionaries.Entry("A", "A1"), Dictionaries.Entry("B", "B1"), Dictionaries.Entry("C", "C1")); }