public void Serialize_PerspectiveXml_NoDefaultAndSettings() { var perspectiveXml = new PerspectiveXml(); perspectiveXml.Caption = "My Caption"; perspectiveXml.Default = new DefaultXml() { ApplyTo = SettingsXml.DefaultScope.Assert, ConnectionString = "connStr" }; perspectiveXml.Settings = new SettingsXml() { References = new List<ReferenceXml>() { new ReferenceXml() { Name = "Bob", 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, Is.StringContaining("My Caption")); Assert.That(content, Is.Not.StringContaining("efault")); Assert.That(content, Is.Not.StringContaining("eference")); }
public void GetSystemUnderTest_Build_CorrectSystemUnderTest() { var sutXml = new StructureXml(); var item = new PerspectiveXml(); sutXml.Item = item; item.ConnectionString = "connectionString"; 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<MetadataDiscoveryRequest>()); }
public void GetConstraint_BuildWithoutIgnoreCase_ComparerCaseSensitive() { var sutXml = new StructureXml(); var item = new PerspectiveXml(); sutXml.Item = item; item.ConnectionString = "connectionString"; 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<NBi.Core.Analysis.Metadata.Field.ComparerByCaption>()); 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 = ConnectionStringReader.GetAdomd(); 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<CaseInsensitiveComparer>()); Assert.That(existsCtr.Comparer.Compare("c", "C"), Is.EqualTo(0)); }