public void EquatableDictionaryOneOfShouldNotContain()
        {
            var toFind1 = new Dictionary<string, string> { { "key1", "999" } };
            var toFind2 = new Dictionary<string, string> { { "key3", "2" } };

            var factory = new EquatableDictionaryFactory<string, string>(_set.Concat(new[] { toFind1, toFind2 }).ToArray());

            Assert.DoesNotContain(factory.CreateEquatableOneOfDictionary(toFind1), _set.Select(factory.CreateEquatableOneOfDictionary));
            Assert.DoesNotContain(factory.CreateEquatableOneOfDictionary(toFind2), _set.Select(factory.CreateEquatableOneOfDictionary));
        }
コード例 #2
0
 public void Setup()
 {
     _data                = Enumerable.Range(0, DictNumber).Select(_ => Enumerable.Range(0, DictLength).ToDictionary(k => k.ToString(), v => RandomString(KeyValueStringLength))).ToArray();
     _factory             = new EquatableDictionaryFactory <string, string>(_data);
     _equatableOneOfDicts = _data.Select(d => _factory.CreateEquatableOneOfDictionary(d)).ToArray();
     _equatableAllOfDicts = _data.Select(d => _factory.CreateEquatableAllOfDictionary(d)).ToArray();
 }
        public void EquatableDictionaryOneOfShouldUseValueEqualityComparer()
        {
            var toFind = new Dictionary<string, string> { { "key1", "a" } };

            var factory = new EquatableDictionaryFactory<string, string>(_set.Concat(new[] { toFind }).ToArray(), valueEqualityComparer: StringComparer.InvariantCultureIgnoreCase);

            Assert.Contains(factory.CreateEquatableOneOfDictionary(toFind), _set.Select(factory.CreateEquatableOneOfDictionary).Concat(new[] { factory.CreateEquatableOneOfDictionary(new Dictionary<string, string> { { "key1", "A" }, { "key2", "A" } }) }));
        }
コード例 #4
0
        public int EquatableOneOfDictionaryCount()
        {
            var toFind = _factory.CreateEquatableOneOfDictionary(_toFindDict);

            return(_equatableOneOfDicts.Count(x => x == toFind));
        }