Пример #1
0
        public void ValueObjectWithDictionaryIsComparableByValueUsingTheEqualsMethod()
        {
            var testObjectOne = new TestObjectWithDictionary();
            var testObjectTwo = new TestObjectWithDictionary();

            Assert.AreEqual(testObjectOne, testObjectTwo);
            testObjectTwo.TestDictionary.Add("Okay", 555);
            Assert.AreNotEqual(testObjectOne, testObjectTwo);
        }
Пример #2
0
        public void ValueObjectWithDictionaryIsComparableByValueUsingOperators()
        {
            var testObjectOne = new TestObjectWithDictionary();
            var testObjectTwo = new TestObjectWithDictionary();

            Assert.IsTrue(testObjectOne == testObjectTwo);
            testObjectTwo.TestDictionary.Add("Okay", 555);
            Assert.IsTrue(testObjectOne != testObjectTwo);
        }
Пример #3
0
        public void ValueObjectWithDictionaryPropertyWorksWithHashSet()
        {
            var hashSet       = new HashSet <TestObjectWithDictionary>();
            var testObjectOne = new TestObjectWithDictionary();
            var testObjectTwo = new TestObjectWithDictionary();

            hashSet.Add(testObjectOne);
            hashSet.Add(testObjectTwo);
            Assert.IsTrue(hashSet.Count == 1);
            testObjectTwo.TestDictionary.Add("Opss!", 333);
            hashSet.Add(testObjectTwo);
            Assert.IsTrue(hashSet.Count == 2);
        }
Пример #4
0
 protected override void MultipleItemSetterVerifyDictionary(TestObjectWithDictionary gil)
 {
     // FIXME: varies from the base class by:
     //  - skill level being a double type, rather than an int
     //  - updated at being a JObject, rather than a DateTimeOffset
     // These are not the types I'd expect for these values, but, the RethinkDB datum converters are only plugged into the
     // top level of the object with the newtonsoft converter, not the values inside a dictionary.  This is debatably wrong,
     // but, I'm not fixing it right now... the best solution might be to incorporate any technical requirements of the
     // newtonsoft extension library into the core, and drop this extension library...
     gil.FreeformProperties.Should().Contain("best known for", "being awesome");
     gil.FreeformProperties.Should().Contain("skill level", 1000.0);
     gil.FreeformProperties.Should().ContainKey("updated at");
     gil.FreeformProperties ["updated at"].Should().BeOfType <JObject>();
     gil.FreeformProperties.Should().HaveCount(5);
 }