Ejemplo n.º 1
0
        public void KnowledgeValueWithDateTimeCanBeSerializedAndDeserialized()
        {
            var knowledgeValue = KnowledgeValue.From(DateTime.Now.ToString("o"));
            var json           = JsonConvert.SerializeObject(knowledgeValue);
            var deserializedKnowledegeValue = JsonConvert.DeserializeObject <KnowledgeValue>(json);

            Assert.AreEqual(knowledgeValue, deserializedKnowledegeValue);
        }
Ejemplo n.º 2
0
        public void AssertKnowledgeValueCaseInsensitiveEqualsAndGetHashCode(string input1, string input2, bool equals)
        {
            var value1 = KnowledgeValue.From(input1);
            var value2 = KnowledgeValue.From(input2);

            Assert.AreEqual(equals, value1.Equals(value2));
            Assert.AreEqual(equals, value1.GetHashCode() == value2.GetHashCode());
        }
 public static SuggestedKnowledgeDto From(string knowledgeIdentifier, string value)
 {
     return(new SuggestedKnowledgeDto()
     {
         KnowledgeIdentifier = KnowledgeIdentifier.From(knowledgeIdentifier),
         Values = new HashSet <KnowledgeValueDto>()
         {
             new KnowledgeValueDto()
             {
                 KnowledgeValue = KnowledgeValue.From(value)
             }
         }
     });
 }
Ejemplo n.º 4
0
 public void TestEmptyKnowledgeValueThrows(string input)
 {
     Assert.Throws <ArgumentNullException>(() => KnowledgeValue.From(input));
 }