public void Serialize_StructureXml_NoDefaultAndSettings() { var references = new List <ReferenceXml>() { new ReferenceXml() { Name = "Bob", ConnectionString = "connStr" } }; var perspectiveXml = new PerspectiveXml(); perspectiveXml.Caption = "My Caption"; perspectiveXml.Default = new DefaultXml() { ApplyTo = SettingsXml.DefaultScope.Assert, ConnectionString = "connStr" }; perspectiveXml.Settings = new SettingsXml() { References = references }; var structureXml = new StructureXml() { Item = perspectiveXml, Default = new DefaultXml() { ApplyTo = SettingsXml.DefaultScope.Assert, ConnectionString = "connStr" }, Settings = new SettingsXml() { References = references } }; var testXml = new TestXml() { Systems = new List <AbstractSystemUnderTestXml>() { structureXml } }; var serializer = new XmlSerializer(typeof(TestXml)); var stream = new MemoryStream(); var writer = new StreamWriter(stream, Encoding.UTF8); serializer.Serialize(writer, testXml); var content = Encoding.UTF8.GetString(stream.ToArray()); writer.Close(); stream.Close(); Debug.WriteLine(content); Assert.That(content, Is.StringContaining("My Caption")); Assert.That(content, Is.Not.StringContaining("efault")); Assert.That(content, Is.Not.StringContaining("eference")); }
public void Serialize_StructureXml_NoDefaultAndSettings() { var perspectiveXml = new PerspectiveXml(); perspectiveXml.Caption = "My Caption"; perspectiveXml.Default = new DefaultXml() { ApplyTo = SettingsXml.DefaultScope.Assert, ConnectionString = new ConnectionStringXml() { Inline = "connStr" } }; perspectiveXml.Settings = new SettingsXml() { References = new List <ReferenceXml>() { new ReferenceXml() { Name = "Bob", ConnectionString = new ConnectionStringXml() { Inline = "connStr" } } } }; var structureXml = new StructureXml() { Item = perspectiveXml }; var serializer = new XmlSerializer(typeof(StructureXml)); var stream = new MemoryStream(); var writer = new StreamWriter(stream, Encoding.UTF8); serializer.Serialize(writer, structureXml); var content = Encoding.UTF8.GetString(stream.ToArray()); writer.Close(); stream.Close(); Debug.WriteLine(content); Assert.That(content, Does.Contain("My Caption")); Assert.That(content, Does.Not.Contain("efault")); Assert.That(content, Does.Not.Contain("eference")); }
public void GetSystemUnderTest_Build_CorrectSystemUnderTest() { var sutXml = new StructureXml(); var item = new PerspectiveXml(); sutXml.Item = item; item.ConnectionString = ConnectionStringReader.GetAdomd(); item.Caption = "perspective"; var ctrXml = new ExistsXml(); var builder = new StructureExistsBuilder(); builder.Setup(sutXml, ctrXml); builder.Build(); var sut = builder.GetSystemUnderTest(); Assert.That(sut, Is.InstanceOf <StructureDiscoveryCommand>()); }
public void GetConstraint_BuildWithoutIgnoreCase_ComparerCaseSensitive() { var sutXml = new StructureXml(); var item = new PerspectiveXml(); sutXml.Item = item; item.ConnectionString = ConnectionStringReader.GetAdomd(); item.Caption = "perspective"; var ctrXml = new ExistsXml(); var builder = new StructureExistsBuilder(); builder.Setup(sutXml, ctrXml); builder.Build(); var ctr = builder.GetConstraint(); var existsCtr = (ExistsConstraint)ctr; Assert.That(existsCtr.Comparer, Is.InstanceOf <Comparer>()); Assert.That(existsCtr.Comparer.Compare("c", "C"), Is.Not.EqualTo(0)); }
public void GetConstraint_BuildWithIgnoreCase_ComparerCaseInsensitive() { var sutXml = new StructureXml(); var item = new PerspectiveXml(); sutXml.Item = item; item.ConnectionString = "connectionString"; item.Caption = "perspective"; var ctrXml = new ExistsXml(); ctrXml.IgnoreCase = true; var builder = new StructureExistsBuilder(); builder.Setup(sutXml, ctrXml); builder.Build(); var ctr = builder.GetConstraint(); var existsCtr = (ExistsConstraint)ctr; Assert.That(existsCtr.Comparer, Is.InstanceOf <NBi.Core.Analysis.Metadata.Field.ComparerByCaption>()); Assert.That(existsCtr.Comparer.Compare("c", "C"), Is.EqualTo(0)); }
public void Serialize_PerspectiveXml_WithoutDefaultAndSettings() { var perspectiveXml = new PerspectiveXml() { Caption = "My Caption", ConnectionString = "connStr" }; var serializer = new XmlSerializer(typeof(PerspectiveXml)); var stream = new MemoryStream(); var writer = new StreamWriter(stream, Encoding.UTF8); serializer.Serialize(writer, perspectiveXml); var content = Encoding.UTF8.GetString(stream.ToArray()); writer.Close(); stream.Close(); Debug.WriteLine(content); Assert.That(content, Does.Contain("My Caption")); Assert.That(content, Does.Not.Contain("connectionString")); Assert.That(content, Does.Contain("connection-string")); }