Exemplo n.º 1
0
        public void GetErrorDescription()
        {
            var simpleConceptInfo = new SimpleConceptInfo {
                Name = "s", Data = "d"
            };
            var refConceptInfo = new RefConceptInfo {
                Name = "r", Reference = simpleConceptInfo
            };
            var refRefConceptInfo = new RefRefConceptInfo {
                Name = "rr", Reference = refConceptInfo
            };

            Assert.AreEqual("Rhetos.Dsl.Test.ConceptInfoHelperTest+RefRefConceptInfo Name=rr Reference=r.s", refRefConceptInfo.GetErrorDescription());

            refRefConceptInfo.Name = null;
            Assert.AreEqual("Rhetos.Dsl.Test.ConceptInfoHelperTest+RefRefConceptInfo Name=<null> Reference=r.s", refRefConceptInfo.GetErrorDescription());
            refRefConceptInfo.Name = "rr";

            refRefConceptInfo.Reference = null;
            Assert.AreEqual("Rhetos.Dsl.Test.ConceptInfoHelperTest+RefRefConceptInfo Name=rr Reference=<null>", refRefConceptInfo.GetErrorDescription());
            refRefConceptInfo.Reference = refConceptInfo;

            simpleConceptInfo.Name = null;
            TestUtility.AssertContains(refRefConceptInfo.GetErrorDescription(),
                                       new[] { refRefConceptInfo.GetType().FullName, "Name=rr", "Reference=", "null" });
            simpleConceptInfo.Name = "s";

            Assert.AreEqual("<null>", ConceptInfoHelper.GetErrorDescription(null));

            Assert.AreEqual(typeof(SimpleConceptInfo).FullName + " Name=s Data=<null>", new SimpleConceptInfo {
                Name = "s", Data = null
            }.GetErrorDescription());
        }