public void VocabularySerializingAnnotationsWithWrongTarget() { IEdmModel expectedModel = this.GetParserResult(VocabularyTestModelBuilder.AnnotationsWithWrongTarget()); StringWriter actualResult = new StringWriter(); XmlWriter xw = XmlWriter.Create(actualResult); IEnumerable <EdmError> errors; expectedModel.TryWriteSchema(xw, out errors); xw.Flush(); xw.Close(); Assert.AreNotEqual(string.Empty, actualResult.ToString().Trim(), "The serializer should not generate empty CSDLs"); var actualModel = this.GetParserResult(new XElement[] { XElement.Parse(actualResult.ToString()) }); Assert.AreEqual((actualModel.VocabularyAnnotations.Single().Target as IEdmCheckable).Errors.Single().ErrorCode, EdmErrorCode.BadUnresolvedType, "The Target property should have an error of unresolved type."); }