public void CVNotEqualsCodeTest() { MARC.Everest.DataTypes.CV<MARC.Everest.DataTypes.INT> aValue = new MARC.Everest.DataTypes.CV<MARC.Everest.DataTypes.INT>(), bValue = new MARC.Everest.DataTypes.CV<MARC.Everest.DataTypes.INT>(); aValue.Code = new MARC.Everest.DataTypes.Primitives.CodeValue<MARC.Everest.DataTypes.INT>(new MARC.Everest.DataTypes.INT(0)); aValue.CodeSystem = "0"; aValue.CodeSystemName = "0"; aValue.CodeSystemVersion = "0"; aValue.DisplayName = "0"; aValue.OriginalText = new MARC.Everest.DataTypes.ED(new System.Byte[] { 0 },"0"); aValue.CodingRationale = new MARC.Everest.DataTypes.SET<MARC.Everest.DataTypes.CodingRationale>(0) { MARC.Everest.DataTypes.CodingRationale.Original }; aValue.ValueSet = "0"; aValue.ValueSetVersion = "0"; aValue.NullFlavor = new MARC.Everest.DataTypes.CS<MARC.Everest.DataTypes.NullFlavor>(MARC.Everest.DataTypes.NullFlavor.AskedUnknown); aValue.UpdateMode = new MARC.Everest.DataTypes.CS<MARC.Everest.DataTypes.UpdateMode>(MARC.Everest.DataTypes.UpdateMode.Add); aValue.Flavor = "0"; aValue.ValidTimeLow = new MARC.Everest.DataTypes.TS(DateTime.Parse("2011-1-10")); aValue.ValidTimeHigh = new MARC.Everest.DataTypes.TS(DateTime.Parse("2011-1-10")); aValue.ControlActRoot = "0"; aValue.ControlActExt = "0"; bValue.Code = new MARC.Everest.DataTypes.Primitives.CodeValue<MARC.Everest.DataTypes.INT>(new MARC.Everest.DataTypes.INT(1)); bValue.CodeSystem = "0"; bValue.CodeSystemName = "0"; bValue.CodeSystemVersion = "0"; bValue.DisplayName = "0"; bValue.OriginalText = new MARC.Everest.DataTypes.ED(new System.Byte[] { 0 },"0"); bValue.CodingRationale = new MARC.Everest.DataTypes.SET<MARC.Everest.DataTypes.CodingRationale>(0) { MARC.Everest.DataTypes.CodingRationale.Original }; bValue.ValueSet = "0"; bValue.ValueSetVersion = "0"; bValue.NullFlavor = new MARC.Everest.DataTypes.CS<MARC.Everest.DataTypes.NullFlavor>(MARC.Everest.DataTypes.NullFlavor.AskedUnknown); bValue.UpdateMode = new MARC.Everest.DataTypes.CS<MARC.Everest.DataTypes.UpdateMode>(MARC.Everest.DataTypes.UpdateMode.Add); bValue.Flavor = "0"; bValue.ValidTimeLow = new MARC.Everest.DataTypes.TS(DateTime.Parse("2011-1-10")); bValue.ValidTimeHigh = new MARC.Everest.DataTypes.TS(DateTime.Parse("2011-1-10")); bValue.ControlActRoot = "0"; bValue.ControlActExt = "0"; Assert.AreNotEqual(aValue, bValue); }
public void CVEqualsSerializationTest() { MARC.Everest.DataTypes.CV<MARC.Everest.DataTypes.INT> aValue = new MARC.Everest.DataTypes.CV<MARC.Everest.DataTypes.INT>(), bValue = null; aValue.DisplayName = "0"; aValue.OriginalText = new MARC.Everest.DataTypes.ED(new System.Byte[] { 0 }, "0"); aValue.Code = new MARC.Everest.DataTypes.Primitives.CodeValue<MARC.Everest.DataTypes.INT>(new MARC.Everest.DataTypes.INT(0)); aValue.CodeSystem = "0"; aValue.CodeSystemName = "0"; aValue.CodeSystemVersion = "0"; aValue.Flavor = "0"; StringWriter sw = new StringWriter(); DatatypeFormatter fmtr = new DatatypeFormatter() { CompatibilityMode = DatatypeFormatterCompatibilityMode.Canadian }; XmlStateWriter xw = new XmlStateWriter(XmlWriter.Create(sw, new XmlWriterSettings() { Encoding = System.Text.Encoding.UTF8 })); xw.WriteStartElement("test"); fmtr.Graph(xw, aValue); xw.WriteEndElement(); // comp xw.Flush(); StringReader sr = new StringReader(sw.ToString()); XmlStateReader rdr = new XmlStateReader(XmlReader.Create(sr)); rdr.Read(); rdr.Read(); bValue = Util.Convert<MARC.Everest.DataTypes.CV<MARC.Everest.DataTypes.INT>>(fmtr.Parse(rdr, typeof(MARC.Everest.DataTypes.CV<MARC.Everest.DataTypes.INT>)).Structure); Assert.AreEqual(aValue, bValue); }