public void Deserialize_FromCatalog_EtlXml() { int testNr = 7; // Create an instance of the XmlSerializer specifying type and namespace. TestSuiteXml ts = DeserializeSample(); Assert.That(ts.Tests[testNr].Systems[0].BaseItem, Is.InstanceOf <EtlXml>()); var etl = ts.Tests[testNr].Systems[0].BaseItem as EtlXml; Assert.That(etl, Is.Not.Null); Assert.That(etl.Server, Is.EqualTo(".")); Assert.That(etl.Catalog, Is.EqualTo(@"SSISDB")); Assert.That(etl.Folder, Is.EqualTo(@"Folder")); Assert.That(etl.Project, Is.EqualTo(@"Project")); Assert.That(etl.Name, Is.EqualTo("Sample")); Assert.That(etl.Is32Bits, Is.False); }
public void Deserialize_SampleFile_ReadCorrectlyFormulaComparer() { int testNr = 0; // Create an instance of the XmlSerializer specifying type and namespace. TestSuiteXml ts = DeserializeSample(); var allRows = ts.Tests[testNr].Constraints[0] as AllRowsXml; var comparison = allRows.Predication; Assert.That((comparison.Operand as ColumnNameIdentifier).Name, Is.EqualTo("ModDepId")); Assert.That(comparison.ColumnType, Is.EqualTo(ColumnType.Numeric)); Assert.That(comparison.Predicate, Is.TypeOf <MoreThanXml>()); var moreThan = comparison.Predicate as MoreThanXml; Assert.That(moreThan.Reference, Is.EqualTo("10")); Assert.That(moreThan.Not, Is.False); }
public void Deserialize_SampleFile_ReadCorrectlyNullComparer() { int testNr = 1; // Create an instance of the XmlSerializer specifying type and namespace. TestSuiteXml ts = DeserializeSample(); var allRows = ts.Tests[testNr].Constraints[0] as AllRowsXml; var predicate = allRows.Predication; Assert.That((predicate.Operand as ColumnNameIdentifier).Name, Is.EqualTo("Name")); Assert.That(predicate.ColumnType, Is.EqualTo(ColumnType.Text)); Assert.That(predicate.Predicate, Is.TypeOf <EmptyXml>()); var emptyPredicate = predicate.Predicate as EmptyXml; Assert.That(emptyPredicate.OrNull, Is.True); Assert.That(emptyPredicate.Not, Is.False); }
public void Deserialize_SampleFile_ReadCorrectlyStartsWithComparer() { int testNr = 2; // Create an instance of the XmlSerializer specifying type and namespace. TestSuiteXml ts = DeserializeSample(); var allRows = ts.Tests[testNr].Constraints[0] as AllRowsXml; var predicate = allRows.Predication; Assert.That((predicate.Operand as ColumnNameIdentifier).Name, Is.EqualTo("Name")); Assert.That(predicate.ColumnType, Is.EqualTo(ColumnType.Text)); Assert.That(predicate.Predicate, Is.TypeOf <StartsWithXml>()); var cpr = predicate.Predicate as StartsWithXml; Assert.That(cpr.IgnoreCase, Is.False); Assert.That(cpr.Not, Is.False); }
public void Deserialize_SampleFile_ReadCorrectlyWithinRangeComparer() { int testNr = 8; // Create an instance of the XmlSerializer specifying type and namespace. TestSuiteXml ts = DeserializeSample(); var allRows = ts.Tests[testNr].Constraints[0] as AllRowsXml; var predicate = allRows.Predication; Assert.That((predicate.Operand as ColumnNameIdentifier).Name, Is.EqualTo("Value")); Assert.That(predicate.ColumnType, Is.EqualTo(ColumnType.Numeric)); Assert.That(predicate.Predicate, Is.TypeOf <WithinRangeXml>()); var cpr = predicate.Predicate as WithinRangeXml; Assert.That(cpr.Reference, Is.EqualTo("[10;30]")); Assert.That(cpr.Not, Is.False); }
public void Deserialize_MethodWithParamDecimal_AssemblyXml() { int testNr = 2; // Create an instance of the XmlSerializer specifying type and namespace. TestSuiteXml ts = DeserializeSample(); Assert.That(ts.Tests[testNr].Systems[0], Is.TypeOf <ExecutionXml>()); Assert.That(((ExecutionXml)ts.Tests[testNr].Systems[0]).BaseItem, Is.TypeOf <AssemblyXml>()); var assembly = (AssemblyXml)((ExecutionXml)ts.Tests[testNr].Systems[0]).BaseItem; Assert.That(assembly, Is.Not.Null); Assert.That(assembly.MethodParameters, Is.Not.Null); Assert.That(assembly.MethodParameters, Has.Count.EqualTo(1)); Assert.That(assembly.MethodParameters[0].Name, Is.EqualTo("MyDecimal")); Assert.That(assembly.MethodParameters[0].Value, Is.EqualTo("10.52")); }
public void Deserialize_ReportWithDefault_ReportXml() { int testNr = 3; // Create an instance of the XmlSerializer specifying type and namespace. TestSuiteXml ts = DeserializeSample(); Assert.That(ts.Tests[testNr].Systems[0], Is.TypeOf <ExecutionXml>()); Assert.That(((ExecutionXml)ts.Tests[testNr].Systems[0]).BaseItem, Is.TypeOf <ReportXml>()); var report = (ReportXml)((ExecutionXml)ts.Tests[testNr].Systems[0]).BaseItem; Assert.That(report, Is.Not.Null); Assert.That(report.Source, Is.EqualTo(@"http://new.reports.com/reports")); Assert.That(report.Path, Is.EqualTo("Details")); Assert.That(report.Name, Is.EqualTo("Currency Rates")); Assert.That(report.Dataset, Is.EqualTo("DataSet1")); Assert.That(report.ConnectionString, Is.Null.Or.Empty); }
public void DeserializeEqualToResultSet_SettingsWithDefault_DefaultLoaded() { // Create an instance of the XmlSerializer specifying type and namespace. TestSuiteXml ts = DeserializeSample("SettingsXmlWithDefault"); Assert.That(ts.Settings.Defaults.Count, Is.EqualTo(3)); //(One empty and one initialized) var sutDefault = ts.Settings.GetDefault(SettingsXml.DefaultScope.SystemUnderTest); Assert.That(sutDefault.ConnectionStringSpecified, Is.True); Assert.That(sutDefault.ConnectionString.Inline, Is.Not.Null.And.Not.Empty); Assert.That(sutDefault.Parameters, Is.Not.Null); var varDefault = ts.Settings.GetDefault(SettingsXml.DefaultScope.SystemUnderTest); Assert.That(varDefault.ConnectionStringSpecified, Is.True); Assert.That(varDefault.ConnectionString.Inline, Is.Not.Null.And.Not.Empty); Assert.That(varDefault.Parameters, Is.Not.Null); }
public void DeserializeEqualToQuery_NoDefaultValue_Transformation() { int testNr = 10; // Create an instance of the XmlSerializer specifying type and namespace. TestSuiteXml ts = DeserializeSample(); Assert.That(ts.Tests[testNr].Constraints[0], Is.TypeOf <EqualToXml>()); var ctr = ts.Tests[testNr].Constraints[0] as EqualToXml; Assert.That(ctr.ColumnsDef[1].Transformation, Is.TypeOf <TransformationXml>()); var transfo = ctr.ColumnsDef[1].Transformation as TransformationXml; Assert.That(transfo.Language, Is.EqualTo(LanguageType.CSharp)); Assert.That(transfo.OriginalType, Is.EqualTo(ColumnType.DateTime)); Assert.That(transfo.Code, Is.EqualTo("String.Format(\"{0:00}.{1}\", value.Month, value.Year)")); }
public void Deserialize_ReportWithMixDefaultReference_ReportXml() { int testNr = 4; // Create an instance of the XmlSerializer specifying type and namespace. TestSuiteXml ts = DeserializeSample(); Assert.That(ts.Tests[testNr].Systems[0], Is.TypeOf <ExecutionXml>()); Assert.That(((ExecutionXml)ts.Tests[testNr].Systems[0]).BaseItem, Is.TypeOf <ReportXml>()); var report = (ReportXml)((ExecutionXml)ts.Tests[testNr].Systems[0]).BaseItem; Assert.That(report, Is.Not.Null); Assert.That(report.Source, Is.EqualTo(@"http://new.reports.com/reports")); Assert.That(report.Path, Is.EqualTo("alternate")); Assert.That(report.Name, Is.EqualTo("Currency Rates")); Assert.That(report.Dataset, Is.EqualTo("DataSet1")); Assert.That(report.GetConnectionString(), Is.EqualTo(@"Data Source=mhknbn2kdz.database.windows.net;Initial Catalog=AdventureWorks2012;User Id=sqlfamily;password=sqlf@m1ly")); }
public void DeserializeEqualToQuery_DefaultValue_Transformation() { int testNr = 10; // Create an instance of the XmlSerializer specifying type and namespace. TestSuiteXml ts = DeserializeSample(); Assert.That(ts.Tests[testNr].Constraints[0], Is.AssignableTo <EqualToXml>()); var ctr = ts.Tests[testNr].Constraints[0] as EqualToXml; Assert.That(ctr.ColumnsDef[0].Transformation, Is.TypeOf <LightTransformXml>()); var transfo = ctr.ColumnsDef[0].Transformation as LightTransformXml; Assert.That(transfo.Language, Is.EqualTo(LanguageType.CSharp)); Assert.That(transfo.OriginalType, Is.EqualTo(ColumnType.Text)); Assert.That(transfo.Code, Is.EqualTo("value.Substring(2)")); }
public void Deserialize_SampleFile_ReadCorrectlyFormulaComparer() { int testNr = 4; // Create an instance of the XmlSerializer specifying type and namespace. TestSuiteXml ts = DeserializeSample(); var rowCount = ts.Tests[testNr].Constraints[0] as RowCountXml; var comparison = rowCount.Filter.Predication; Assert.That((comparison.Operand as ColumnNameIdentifier).Name, Is.EqualTo("ModDepId")); Assert.That(comparison.ColumnType, Is.EqualTo(ColumnType.Numeric)); Assert.That(comparison.Predicate, Is.TypeOf <LessThanXml>()); var lessThan = comparison.Predicate as LessThanXml; Assert.That(lessThan.Value, Is.EqualTo("1")); Assert.That(lessThan.Not, Is.EqualTo(false)); }
public void Deserialize_SampleFile_ReadCorrectlyMoreThan() { int testNr = 2; // Create an instance of the XmlSerializer specifying type and namespace. TestSuiteXml ts = DeserializeSample(); var rowCount = ts.Tests[testNr].Constraints[0] as RowCountXml; Assert.That(rowCount.Not, Is.True); Assert.That(rowCount.MoreThan, Is.Not.Null); Assert.That(rowCount.MoreThan, Is.TypeOf <MoreThanXml>()); Assert.That(rowCount.Comparer, Is.EqualTo(rowCount.MoreThan)); var comparer = rowCount.Comparer as MoreLessThanPredicateXml; Assert.That(comparer.Value, Is.EqualTo("3")); Assert.That(comparer.OrEqual, Is.True); }
public void Deserialize_ReportWithEverythingDefined_ReportXml() { int testNr = 0; // Create an instance of the XmlSerializer specifying type and namespace. TestSuiteXml ts = DeserializeSample(); Assert.That(ts.Tests[testNr].Systems[0], Is.TypeOf <ExecutionXml>()); Assert.That(((ExecutionXml)ts.Tests[testNr].Systems[0]).BaseItem, Is.TypeOf <ReportXml>()); var report = (ReportXml)((ExecutionXml)ts.Tests[testNr].Systems[0]).BaseItem; Assert.That(report, Is.Not.Null); Assert.That(report.Source, Is.EqualTo(@"Data Source=(local)\SQL2012;Initial Catalog=ReportServer;Integrated Security=True;")); Assert.That(report.Path, Is.EqualTo("/AdventureWorks Sample Reports/")); Assert.That(report.Name, Is.EqualTo("Currency_List")); Assert.That(report.Dataset, Is.EqualTo("currency")); Assert.That(report.GetConnectionString(), Is.EqualTo(@"Data Source=tadam;Initial Catalog=AdventureWorks2012;User Id=sqlfamily;password=sqlf@m1ly")); }
public void Deserialize_SampleFile_ReadCorrectlyContainsComparer() { int testNr = 4; // Create an instance of the XmlSerializer specifying type and namespace. TestSuiteXml ts = DeserializeSample(); var allRows = ts.Tests[testNr].Constraints[0] as AllRowsXml; var predicate = allRows.Predication; Assert.That(predicate.ColumnIndex, Is.EqualTo(-1)); Assert.That(predicate.Operand, Is.EqualTo("Name")); Assert.That(predicate.Not, Is.EqualTo(false)); Assert.That(predicate.ColumnType, Is.EqualTo(ColumnType.Text)); Assert.That(predicate.Predicate, Is.TypeOf <ContainsXml>()); var cpr = predicate.Predicate as ContainsXml; Assert.That(cpr.IgnoreCase, Is.True); }
public void Deserialize_SampleFile_Custom() { int testNr = 1; // Create an instance of the XmlSerializer specifying type and namespace. TestSuiteXml ts = DeserializeSample(); // Check the properties of the object. Assert.That(ts.Tests[testNr].Condition.Predicates[0], Is.TypeOf <CustomConditionXml>()); var condition = ts.Tests[testNr].Condition.Predicates[0] as CustomConditionXml; Assert.That(condition.AssemblyPath, Is.EqualTo("myAssembly.dll")); Assert.That(condition.TypeName, Is.EqualTo("myType")); Assert.That(condition.Parameters, Has.Count.EqualTo(2)); Assert.That(condition.Parameters[0].Name, Is.EqualTo("firstParam")); Assert.That(condition.Parameters[0].StringValue, Is.EqualTo("2012-10-10")); Assert.That(condition.Parameters[1].Name, Is.EqualTo("secondParam")); Assert.That(condition.Parameters[1].StringValue, Is.EqualTo("102")); }
public void Deserialize_FromDefaultSetup_EtlXml() { int testNr = 0; // Create an instance of the XmlSerializer specifying type and namespace. TestSuiteXml ts = DeserializeSample("EtlXmlWithDefaultTest"); Assert.That(ts.Tests[testNr].Setup.Commands[0], Is.InstanceOf <EtlRunXml>()); var etl = ts.Tests[testNr].Setup.Commands[0] as EtlRunXml; Assert.That(etl, Is.Not.Null); Assert.That(etl.Server, Is.EqualTo(".")); Assert.That(etl.Environment, Is.EqualTo("Environment")); Assert.That(etl.Path, Is.EqualTo("/Etl/")); Assert.That(etl.Name, Is.EqualTo("Sample")); //Assert.That(etl.Version, Is.EqualTo("SqlServer2012")); //Assert.That(etl.Is32Bits, Is.True); //Assert.That(etl.Timeout, Is.EqualTo(30)); }
public void Deserialize_FromDefaultSut_EtlXml() { int testNr = 1; // Create an instance of the XmlSerializer specifying type and namespace. TestSuiteXml ts = DeserializeSample("EtlXmlWithDefaultTest"); Assert.That(ts.Tests[testNr].Systems[0].BaseItem, Is.InstanceOf <EtlXml>()); var etl = ts.Tests[testNr].Systems[0].BaseItem as EtlXml; Assert.That(etl, Is.Not.Null); Assert.That(etl.Server, Is.EqualTo("localhost")); Assert.That(etl.Environment, Is.EqualTo("EnvironmentOverride")); Assert.That(etl.Path, Is.EqualTo("/Etl/")); Assert.That(etl.Name, Is.EqualTo("Sample")); //Assert.That(etl.Version, Is.EqualTo("SqlServer2014")); //Assert.That(etl.Is32Bits, Is.False); //Assert.That(etl.Timeout, Is.EqualTo(60)); }
public void Deserialize_FromReferenceSsiSB_EtlXml() { int testNr = 1; // Create an instance of the XmlSerializer specifying type and namespace. TestSuiteXml ts = DeserializeSample("EtlXmlWithDefaultSsisDBTest"); Assert.That(ts.Tests[testNr].Systems[0].BaseItem, Is.InstanceOf <EtlXml>()); var etl = ts.Tests[testNr].Systems[0].BaseItem as EtlXml; Assert.That(etl, Is.Not.Null); Assert.That(etl.Version, Is.EqualTo("SqlServer2014")); Assert.That(etl.Server, Is.EqualTo("127.0.0.1")); Assert.That(etl.Catalog, Is.EqualTo("SSISDB")); Assert.That(etl.Folder, Is.EqualTo("FolderRef")); Assert.That(etl.Project, Is.EqualTo("ProjectRef")); Assert.That(etl.Name, Is.EqualTo("NameRef")); Assert.That(etl.Path, Is.Null.Or.Empty); }
public void Deserialize_SampleFile_StartAndStopService() { int testNr = 2; // Create an instance of the XmlSerializer specifying type and namespace. TestSuiteXml ts = DeserializeSample(); // Check the properties of the object. Assert.That(ts.Tests[testNr].Setup.Commands[0], Is.TypeOf<ServiceStartXml>()); var cmd = ts.Tests[testNr].Setup.Commands[0] as ServiceStartXml; Assert.That(cmd.TimeOut, Is.EqualTo(5000)); //Default value Assert.That(cmd.ServiceName, Is.EqualTo("MyService")); // Check the properties of the object. Assert.That(ts.Tests[testNr].Cleanup.Commands[0], Is.TypeOf<ServiceStopXml>()); var cmdCleanup = ts.Tests[testNr].Cleanup.Commands[0] as ServiceStopXml; Assert.That(cmdCleanup.TimeOut, Is.EqualTo(15000)); //Value Specified Assert.That(cmdCleanup.ServiceName, Is.EqualTo("MyService")); }
public void Deserialize_SampleFile_ReadCorrectlyFormulaComparer() { int testNr = 0; // Create an instance of the XmlSerializer specifying type and namespace. TestSuiteXml ts = DeserializeSample(); var noRow = ts.Tests[testNr].Constraints[0] as NoRowsXml; var comparison = noRow.Predication; Assert.That(comparison.ColumnIndex, Is.EqualTo(-1)); Assert.That(comparison.Operand, Is.EqualTo("ModDepId")); Assert.That(comparison.Not, Is.EqualTo(false)); Assert.That(comparison.ColumnType, Is.EqualTo(ColumnType.Numeric)); Assert.That(comparison.Predicate, Is.TypeOf <MoreThanXml>()); var moreThan = comparison.Predicate as MoreThanXml; Assert.That(moreThan.Value, Is.EqualTo("10")); }
public void Deserialize_SampleFile_AlterationExtend() { int testNr = 12; // Create an instance of the XmlSerializer specifying type and namespace. TestSuiteXml ts = DeserializeSample(); // Check the properties of the object. Assert.That(ts.Tests[testNr].Systems[0], Is.AssignableTo <ResultSetSystemXml>()); var rs = ts.Tests[testNr].Systems[0] as ResultSetSystemXml; Assert.That(rs.Alterations, Is.Not.Null); Assert.That(rs.Alterations, Has.Count.EqualTo(1)); var extend = rs.Alterations[0] as ExtendXml; Assert.That(extend.Identifier.Label, Is.EqualTo("[myNewColumn]")); Assert.That(extend.Script, Is.Not.Null); Assert.That(extend.Script.Language, Is.EqualTo(LanguageType.NCalc)); }
public void Deserialize_SampleFile_MembersWithLevel() { int testNr = 0; // Create an instance of the XmlSerializer specifying type and namespace. TestSuiteXml ts = DeserializeSample(); // Check the properties of the object. Assert.That(ts.Tests[testNr].Systems[0], Is.TypeOf <MembersXml>()); Assert.That(((MembersXml)ts.Tests[testNr].Systems[0]).Item, Is.TypeOf <LevelXml>()); LevelXml item = (LevelXml)((MembersXml)ts.Tests[testNr].Systems[0]).Item; Assert.That(item.Dimension, Is.EqualTo("dimension")); Assert.That(item.Hierarchy, Is.EqualTo("hierarchy")); Assert.That(item.Caption, Is.EqualTo("level")); Assert.That(item.Perspective, Is.EqualTo("Perspective")); Assert.That(item.GetConnectionString(), Is.EqualTo("ConnectionString")); }
public void Serialize_CustomEvaluation_CustomElement() { var testSuiteXml = new TestSuiteXml() { Variables = new List <GlobalVariableXml> { new GlobalVariableXml { Name = "myVar", Custom = new CustomXml { AssemblyPath = "AssemblyPath\\myAssembly.dll", TypeName = "@VarType", Parameters = new List <CustomParameterXml> { new CustomParameterXml { Name = "myParam", StringValue = "@VarParam" } } } } } }; var serializer = new XmlSerializer(typeof(TestSuiteXml)); using (var stream = new MemoryStream()) using (var writer = new StreamWriter(stream, Encoding.UTF8)) { serializer.Serialize(writer, testSuiteXml); var content = Encoding.UTF8.GetString(stream.ToArray()); Debug.WriteLine(content); Assert.That(content, Does.Contain("<variable name=\"myVar\"")); Assert.That(content, Does.Contain("<custom")); Assert.That(content, Does.Contain("assembly-path=\"AssemblyPath\\myAssembly.dll\"")); Assert.That(content, Does.Contain("type=\"@VarType\"")); Assert.That(content, Does.Contain("<parameter name=\"myParam\">")); Assert.That(content, Does.Contain("@VarParam")); } }
public void DeserializeEqualToResultSet_SettingsWithReference_ReferenceAppliedToTest() { int testNr = 0; // Create an instance of the XmlSerializer specifying type and namespace. TestSuiteXml ts = DeserializeSample("SettingsXmlWithReference"); Assert.That(((ExecutionXml)ts.Tests[testNr].Systems[0]).Item.ConnectionString, Is.Not.Null.And.Not.Empty); Assert.That(((ExecutionXml)ts.Tests[testNr].Systems[0]).Item.ConnectionString, Is.EqualTo("@second-ref")); var system = (ExecutionXml)ts.Tests[testNr].Systems[0]; Assert.That(system.Item.ConnectionString, Is.Not.Null.And.Not.Empty); Assert.That(system.Item.ConnectionString, Does.StartWith("@")); Assert.That(system.Item.ConnectionString, Is.EqualTo("@second-ref")); Assert.That(system.Settings, Is.Not.Null); Assert.That(system.Settings.GetReference("second-ref").ConnectionString.Inline, Is.Not.Null.And.Not.Empty); Assert.That(system.Item.Settings, Is.Not.Null); Assert.That(system.Item.Settings.GetReference("second-ref").ConnectionString.Inline, Is.Not.Null.And.Not.Empty); Assert.That(system.Item.Settings.GetReference("second-ref").ConnectionString.Inline, Is.EqualTo(system.Settings.GetReference("second-ref").ConnectionString.Inline)); }
public void DeserializeSupersetQuery_QueryFile4_List() { int testNr = 4; // Create an instance of the XmlSerializer specifying type and namespace. TestSuiteXml ts = DeserializeSample(); Assert.That(ts.Tests[testNr].Constraints[0], Is.TypeOf <SupersetOfXml>()); Assert.That(((SupersetOfXml)ts.Tests[testNr].Constraints[0]).Query, Is.TypeOf <QueryXml>()); var connStr = ((SupersetOfXml)ts.Tests[testNr].Constraints[0]).Query.ConnectionString; Assert.That(connStr, Is.Not.Empty); Assert.That(connStr, Contains.Substring("Reference")); var query = ((SupersetOfXml)ts.Tests[testNr].Constraints[0]).Query.InlineQuery; Assert.That(query, Is.Not.Empty); Assert.That(query, Contains.Substring("select top 2 [Name]")); }
public void DeserializeEquivalentTo_PatternIntegerRange_Week1toWeek52() { int testNr = 5; // Create an instance of the XmlSerializer specifying type and namespace. TestSuiteXml ts = DeserializeSample(); Assert.That(ts.Tests[testNr].Constraints[0], Is.AssignableTo <EquivalentToXml>()); Assert.That(((EquivalentToXml)ts.Tests[testNr].Constraints[0]).Range, Is.Not.Null); Assert.That(((EquivalentToXml)ts.Tests[testNr].Constraints[0]).Range, Is.InstanceOf <IIntegerRange>()); Assert.That(((EquivalentToXml)ts.Tests[testNr].Constraints[0]).Range, Is.InstanceOf <IPatternDecorator>()); var range = (PatternIntegerRangeXml)(((EquivalentToXml)ts.Tests[testNr].Constraints[0]).Range); Assert.That(range.Start, Is.EqualTo(1)); Assert.That(range.End, Is.EqualTo(52)); Assert.That(range.Step, Is.EqualTo(1)); Assert.That(range.Pattern, Is.EqualTo("Week ")); Assert.That(range.Position, Is.EqualTo(PositionValue.Suffix)); }
public void Serialize_TwoVariables_Correct() { var testSuiteXml = new TestSuiteXml() { Variables = new List <GlobalVariableXml>() { new GlobalVariableXml() { Name = "mySQL", QueryScalar = new QueryScalarXml() { ConnectionString = "myConnString", InlineQuery = "select * from myTable;" } }, new GlobalVariableXml() { Name = "myCSharp", Script = new ScriptXml() { Language = NBi.Core.Transformation.LanguageType.CSharp, Code = "0+0" } } } }; var serializer = new XmlSerializer(typeof(TestSuiteXml)); var stream = new MemoryStream(); var writer = new StreamWriter(stream, Encoding.UTF8); serializer.Serialize(writer, testSuiteXml); var content = Encoding.UTF8.GetString(stream.ToArray()); writer.Close(); stream.Close(); Debug.WriteLine(content); Assert.That(content, Is.StringContaining("<variables")); Assert.That(content, Is.StringContaining("<variable name=\"mySQL\"")); Assert.That(content, Is.StringContaining("<variable name=\"myCSharp\"")); }
public void Deserialize_QueryWithTwoParams_QueryXml() { int testNr = 1; // Create an instance of the XmlSerializer specifying type and namespace. TestSuiteXml ts = DeserializeSample(); var query = (QueryXml)((ExecutionXml)ts.Tests[testNr].Systems[0]).BaseItem; Assert.That(query.GetQuery(), Is.StringContaining("select myColumn from myTable where myFirstField=@FirstField and 1=@NonEmpty")); Assert.That(query.Parameters, Is.Not.Null); Assert.That(query.Parameters, Is.Not.Empty); Assert.That(query.Parameters, Has.Count.EqualTo(2)); Assert.That(query.Parameters[0].Name, Is.EqualTo("FirstField")); Assert.That(query.Parameters[0].GetValue <string>(), Is.EqualTo("Identifier")); Assert.That(query.Parameters[1].Name, Is.EqualTo("NonEmpty")); Assert.That(query.Parameters[1].GetValue <int>(), Is.EqualTo(1)); }
public void Deserialize_SampleFile_RunningService() { int testNr = 0; // Create an instance of the XmlSerializer specifying type and namespace. TestSuiteXml ts = DeserializeSample(); // Check the properties of the object. Assert.That(ts.Tests[testNr].Condition.Predicates[0], Is.TypeOf <ServiceRunningConditionXml>()); var check = ts.Tests[testNr].Condition.Predicates[0] as ServiceRunningConditionXml; Assert.That(check.TimeOut, Is.EqualTo("5000")); //Default value Assert.That(check.ServiceName, Is.EqualTo("MyService")); // Check the properties of the object. Assert.That(ts.Tests[testNr].Condition.Predicates[1], Is.TypeOf <ServiceRunningConditionXml>()); var check2 = ts.Tests[testNr].Condition.Predicates[1] as ServiceRunningConditionXml; Assert.That(check2.TimeOut, Is.EqualTo("1000")); //Value Specified Assert.That(check2.ServiceName, Is.EqualTo("MyService2")); }