Exemple #1
0
 public void InputDialogText(string text, IList <User> to)
 {
     if (!_investigating &&
         ((_isTalker1Talking && _talker1.Controller == GameServerProxy.Instance.Self) ||
          (!_isTalker1Talking && _talker2.Controller == GameServerProxy.Instance.Self)))
     {
         if (to != null && GameServerProxy.Instance.Self.IsDM)
         {
             var message = new StorySceneDMDialogSendPrivateTextMessage();
             var players = new Identification[to.Count];
             for (int i = 0; i < to.Count; ++i)
             {
                 if (to[i].IsDM)
                 {
                     continue;
                 }
                 players[i] = IdentificationConverter.GetIdentification(to[i]);
             }
             message.players = players;
             message.text    = text;
             ConnectionRef.SendMessage(message);
         }
         else
         {
             var message = new StorySceneDialogSendTextMessage();
             message.text = text;
             ConnectionRef.SendMessage(message);
         }
     }
 }
 public Connection(string id, string color, ConnectionRef source, ConnectionRef target)
 {
     this.id     = id;
     this.color  = color;
     this.source = source;
     this.target = target;
 }
Exemple #3
0
        public void RetrieveDataTableTest()
        {
            var ts      = new SsisTestSuite();
            var connRef = new ConnectionRef("TestConn", "Data Source=localhost;Initial Catalog=AdventureWorks2012;Integrated Security=SSPI", ConnectionRef.ConnectionTypeEnum.AdoNet, "System.Data.SqlClient");

            ts.ConnectionList.Add(connRef.ReferenceName, connRef);
            var dataset = new Dataset(
                ts,
                "Test",
                connRef,
                false,
                @"SELECT 
CAST(1 AS INT) AS ColInt, 
CAST('Test' AS VARCHAR(50)) AS ColVarChar, 
CAST(N'Test' AS NVARCHAR(50)) AS ColNVarChar, 
CAST('1900-01-01' AS DATETIME) AS ColDateTime");

            var result = dataset.RetrieveDataTable();

            Assert.AreEqual(1, result.Rows.Count);
            Assert.AreEqual(1, result.Rows[0][0]);
            Assert.AreEqual("Test", result.Rows[0][1]);
            Assert.AreEqual("Test", result.Rows[0][2]);
            Assert.AreEqual(new DateTime(1900, 1, 1), result.Rows[0][3]);
        }
        public override StandardValuesCollection GetStandardValues(ITypeDescriptorContext context)
        {
            SsisTestSuite testSuite = null;

            CommandBase commandBase = context.Instance as CommandBase;

            if (commandBase != null)
            {
                testSuite = commandBase.TestSuite;
            }

            Dataset dataset = context.Instance as Dataset;

            if (commandBase == null && dataset != null)
            {
                testSuite = dataset.TestSuite;
            }

            if (testSuite == null || testSuite.ConnectionList == null)
            {
                return(new StandardValuesCollection(new ConnectionRef[0]));
            }

            ConnectionRef[] connections = new ConnectionRef[testSuite.ConnectionList.Count];

            testSuite.ConnectionList.Values.CopyTo(connections, 0);

            return(new StandardValuesCollection(connections));
        }
 public Connection()
 {
     id     = string.Empty;
     color  = string.Empty;
     source = new ConnectionRef();
     target = new ConnectionRef();
 }
Exemple #6
0
        public void SelectSelection(int selectionIdx)
        {
            if (!_selectionShowed)
            {
                return;
            }
            var message = new StorySceneSelectSelectionMessage();

            message.index = selectionIdx;
            ConnectionRef.SendMessage(message);
        }
Exemple #7
0
        public void InteractWithObject(int id)
        {
            if (_investigating)
            {
                return;
            }
            _controller.FinishNonRepeatAnimations();
            var message = new StorySceneInvestigateObjectMessage();

            message.objID = IdentificationConverter.GetIdentification(_objectList[id]);
            ConnectionRef.SendMessage(message);
        }
Exemple #8
0
        private void TreeTestBeforeSelect(object sender, TreeViewCancelEventArgs e)
        {
            if (treeTest.SelectedNode == null)
            {
                return;
            }

            _originalItem = treeTest.SelectedNode.Tag;

            IValidate item = _originalItem as IValidate;

            if (item != null)
            {
                Validate(item, treeTest.SelectedNode);
            }

            // Update Tree for label changes
            ConnectionRef connectionRef = _originalItem as ConnectionRef;

            if (connectionRef != null)
            {
                treeTest.SelectedNode.Text = connectionRef.ReferenceName;
                return;
            }

            PackageRef packageRef = _originalItem as PackageRef;

            if (packageRef != null)
            {
                treeTest.SelectedNode.Text = packageRef.Name;
                return;
            }

            Test test = _originalItem as Test;

            if (test != null)
            {
                treeTest.SelectedNode.Text = test.Name;
                return;
            }

            SsisAssert ssisAssert = _originalItem as SsisAssert;

            if (ssisAssert != null)
            {
                treeTest.SelectedNode.Text = ssisAssert.Name;
            }
        }
Exemple #9
0
        public void PersistDatasetWithoutResultsIsResultsStoredTrueTest()
        {
            var ts      = new SsisTestSuite();
            var connRef = new ConnectionRef("TestConn", "Data Source=localhost;Initial Catalog=AdventureWorks2012;Integrated Security=SSPI", ConnectionRef.ConnectionTypeEnum.AdoNet, "System.Data.SqlClient");

            ts.ConnectionList.Add(connRef.ReferenceName, connRef);
            var dataset = new Dataset(
                ts,
                "Test",
                connRef,
                true,
                @"SELECT 
CAST(1 AS INT) AS ColInt, 
CAST('Test' AS VARCHAR(50)) AS ColVarChar, 
CAST(N'Test' AS NVARCHAR(50)) AS ColNVarChar, 
CAST('1900-01-01' AS DATETIME) AS ColDateTime");

            //string datasetXml = "<Dataset name=\"Test\" connection=\"TestConn\" isResultsStored=\"true\"><query><![CDATA[SELECT \r\nCAST(1 AS INT) AS ColInt, \r\nCAST('Test' AS VARCHAR(50)) AS ColVarChar, \r\nCAST(N'Test' AS NVARCHAR(50)) AS ColNVarChar, \r\nCAST('1900-01-01' AS DATETIME) AS ColDateTime]]></query></Dataset>";

            dataset.Results = dataset.RetrieveDataTable();
        }
        public void RunDataCompareCommandSetWithOtherTestTest()
        {
            var ts      = new SsisTestSuite();
            var connRef = new ConnectionRef("TestConn", "Data Source=localhost;Initial Catalog=AdventureWorks2012;Integrated Security=SSPI", ConnectionRef.ConnectionTypeEnum.AdoNet, "System.Data.SqlClient");
            var pkgRef  = new PackageRef("pkg", _dtsxFilePath, PackageStorageType.FileSystem);

            ts.ConnectionList.Add(connRef.ReferenceName, connRef);
            ts.PackageList.Add(pkgRef.Name, pkgRef);
            var dataset = new Dataset(
                ts,
                "Test",
                connRef,
                false,
                @"SELECT 
CAST(1 AS INT) AS ColInt, 
CAST('Test' AS VARCHAR(50)) AS ColVarChar, 
CAST(N'Test' AS NVARCHAR(50)) AS ColNVarChar, 
CAST('1900-01-01' AS DATETIME) AS ColDateTime");

            ts.Datasets.Add(dataset.Name, dataset);

            var target = new DataCompareCommand(ts, "Test", dataset, dataset);
            var test   = new Test(ts, "TestCase1", "pkg", null, "\\Package");
            var assert = new SsisAssert(ts, test, "Assert1", true, false);

            assert.Command = target;
            test.Asserts.Add("Assert1", assert);
            ts.Tests.Add("TestCase1", test);
            var test2   = new Test(ts, "TestCase2", "pkg", null, "\\Package");
            var assert2 = new SsisAssert(ts, test2, "Assert2", false, false);

            assert2.Command = new FileCommand(ts, "Exists", @"C:\Test\Test.pkg", string.Empty);
            test2.Asserts.Add("Assert2", assert2);
            ts.Tests.Add("TestCase2", test2);

            var actual = ts.Execute();

            Assert.AreEqual(4, ts.Statistics.GetStatistic(StatisticEnum.AssertPassedCount));
        }
        public void RunDataCompareCommandSetTest()
        {
            var ts      = new SsisTestSuite();
            var connRef = new ConnectionRef("TestConn", "Data Source=localhost;Initial Catalog=ssisUnitTestDb;Integrated Security=SSPI", ConnectionRef.ConnectionTypeEnum.AdoNet, "System.Data.SqlClient");

            ts.ConnectionList.Add(connRef.ReferenceName, connRef);
            var dataset = new Dataset(
                ts,
                "Test",
                connRef,
                false,
                @"SELECT 
CAST(1 AS INT) AS ColInt, 
CAST('Test' AS VARCHAR(50)) AS ColVarChar, 
CAST(N'Test' AS NVARCHAR(50)) AS ColNVarChar, 
CAST('1900-01-01' AS DATETIME) AS ColDateTime");

            var target = new DataCompareCommand(ts, "Test", dataset, dataset);
            var actual = (DataCompareCommandResults)target.Execute();

            Assert.AreEqual(true, actual.IsDatasetsSame);
        }
Exemple #12
0
        public void AddConnectionRef()
        {
            TreeNode crNode  = treeTest.Nodes[0].Nodes.Find("Connection List", false)[0];
            int      counter = 1;

            while (_testSuite.ConnectionList.ContainsKey("ConnectionRef" + counter.ToString(CultureInfo.InvariantCulture)))
            {
                counter++;
            }

            var cr = new ConnectionRef("ConnectionRef" + counter.ToString(CultureInfo.InvariantCulture), string.Empty, ConnectionRef.ConnectionTypeEnum.ConnectionString);

            _testSuite.ConnectionList.Add(cr.ReferenceName, cr);
            var tn = new TreeNode(cr.ReferenceName)
            {
                Tag = cr
            };

            crNode.Nodes.Add(tn);
            tn.EnsureVisible();
            treeTest.SelectedNode = tn;
        }
 public Jump()
     : base()
 {
     target = new ConnectionRef();
     pins   = new List <Pin>();
 }
 public Jump(string id, string technicalName, LocalizableText displayName, LocalizableText text, Features features, Vector2 position, ConnectionRef target, List <Pin> pins)
     : base(id, technicalName, displayName, text, features, position)
 {
     this.target = target;
     this.pins   = pins;
 }
        public void SQL_MERGE_Users_Empty_table()
        {
            // a new test suite
            SsisTestSuite ts = new SsisTestSuite();

            // the package to test; three times .., because test dll is in .\bin\Development
            PackageRef p = new PackageRef(
                "15_Users_Dataset",
                @"..\..\..\Assets\ispac\ssisUnitLearning.ispac",
                "15_Users_Dataset.dtsx",
                PackageStorageType.FileSystem
                );

            // the connection for the datasets
            ConnectionRef c = new ConnectionRef(
                "ssisUnitLearningDB",
                @"Provider=SQLNCLI11.1;Data Source=.\SQL2017;Integrated Security=SSPI;Initial Catalog=ssisUnitLearningDB;Auto Translate=False",
                ConnectionRef.ConnectionTypeEnum.ConnectionString
                );

            // let the test suite know about the ConnectionRef and the PackageRef
            ts.ConnectionList.Add(c.ReferenceName, c);
            ts.PackageList.Add(p.Name, p);

            // expected and actual datasets
            Dataset expected = new Dataset(ts, "Empty table test: expected dataset", c, false, @"SELECT *
FROM(
    VALUES
        (CAST('Name 1' AS VARCHAR(50)), CAST('Login 1' AS CHAR(12)), CAST(1 AS BIT), CAST(1 AS INT), CAST(2 AS TINYINT), CAST(0 AS BIT)),
        (CAST('Name 2' AS VARCHAR(50)), CAST('Login 2' AS CHAR(12)), CAST(1 AS BIT), CAST(2 AS INT), CAST(2 AS TINYINT), CAST(0 AS BIT)),
        (CAST('Name 3' AS VARCHAR(50)), CAST('Login 3' AS CHAR(12)), CAST(0 AS BIT), CAST(3 AS INT), CAST(2 AS TINYINT), CAST(0 AS BIT))
)x(Name, Login, IsActive, Id, SourceSystemId, IsDeleted)
ORDER BY Id; ");

            Dataset actual = new Dataset(ts, "Empty table test: actual dataset", c, false, @"SELECT
    Name,
    Login,
    IsActive,
    SourceId,
    SourceSystemId,
    IsDeleted
FROM dbo.Users
 ORDER BY SourceId;");

            // add the datasets to the test suite
            ts.Datasets.Add(expected.Name, expected);
            ts.Datasets.Add(actual.Name, actual);

            // the test
            Test t = new Test(ts, "SQL MERGE Users: Empty table", "15_Users_Dataset", null, "{FB549B65-6F0D-4794-BA8E-3FF975A6AE0B}");

            ts.Tests.Add(t.Name, t);

            // test setup
            SqlCommand s1 = new SqlCommand(ts, "ssisUnitLearningDB", false, @"WITH stgUsers AS (
SELECT *
FROM (
    VALUES
        ('Name 1', 'Login 1', 1, 1, 2, -1),
        ('Name 2', 'Login 2', 1, 2, 2, -1),
        ('Name 3', 'Login 3', 0, 3, 2, -1)
)x (Name, Login, IsActive, Id, SourceSystemId, InsertedAuditId)
)
INSERT INTO stg.Users (
    Name, Login, IsActive, Id, SourceSystemId, InsertedAuditId
)
SELECT
    Name, Login, IsActive, Id, SourceSystemId, InsertedAuditId
FROM stgUsers
;");

            // add the setup to the test
            t.TestSetup.Commands.Add(s1);

            // test asserts and asserts' commands
            SsisAssert a1 = new SsisAssert(ts, t, "Assert: Added 3 records", 3, false);

            a1.Command = new SqlCommand(ts, "ssisUnitLearningDB", true, "SELECT COUNT(*) FROM dbo.Users;");

            SsisAssert a2 = new SsisAssert(ts, t, "Assert: dbo.Users has expected records", true, false);

            a2.Command = new DataCompareCommand(ts, "", expected, actual);

            // add the asserts to the test
            t.Asserts.Add(a1.Name, a1);
            t.Asserts.Add(a2.Name, a2);

            // test teardown
            SqlCommand t1 = new SqlCommand(ts, "ssisUnitLearningDb", false, "TRUNCATE TABLE stg.Users;");
            SqlCommand t2 = new SqlCommand(ts, "ssisUnitLearningDb", false, "TRUNCATE TABLE dbo.Users;");

            // add the teardown commands to the test
            // add the setup to the test
            t.TestTeardown.Commands.Add(t1);
            t.TestTeardown.Commands.Add(t2);

            // execute the test suite
            ts.Execute();

            // verify if everything is OK; we expect 3 asserts to pass
            Assert.AreEqual(3, ts.Statistics.GetStatistic(StatisticEnum.AssertPassedCount));

            // show me the XML version of the test - only in debug mode (internal method)
            //System.Console.Write(ts.PersistToXml);
        }
Exemple #16
0
        public async Task DoLogin(string name, string password)
        {
            Username = name;
            Password = password;
            try
            {
                string serverHash = RootComponents.Instance.AssetLoader.GetServerHash();
                if (serverHash != RootComponents.Instance.ClientHash)
                {
                    MainUI.Instance.ShowMessageBox($"Client/server incompatibility: \n {serverHash} \n {RootComponents.Instance.ClientHash}",
                                                   () => { MainUI.Instance.ShowLoginWindow(Username, Password); });
                    return;
                }
            }
            catch (Exception e)
            {
                if (e is SocketException)
                {
                    MainUI.Instance.ShowMessageBox($"Can't connect to server: {e.Message}",
                                                   () => { MainUI.Instance.ShowLoginWindow(Username, Password); });
                    return;
                }
                else
                {
                    MainUI.Instance.ShowMessageBox($"Error: {e.Message}",
                                                   () => { MainUI.Instance.ShowLoginWindow(Username, Password); });
                    return;
                }
            }



            _log.Info($"Logging in, login {name}, password {password}");


            try
            {
                IActorRef asel =
                    AkkaSystem.ActorSelection(MainSettings.ServerUrl)
                    .ResolveOne(TimeSpan.Zero).Result;

                MainServer = asel.Cast <ConnectionRef>();

                Tuple <bool, string, ServerInfo> loginInfo = await MainServer.DoLogin(name, password);



                if (!loginInfo.Item1)
                {
                    MainUI.Instance.ShowMessageBox(loginInfo.Item2,
                                                   () => { MainUI.Instance.ShowLoginWindow(Username, Password); });
                    return;
                }

                UserId = loginInfo.Item3._loggedInUserId;

                foreach (var atype in loginInfo.Item3.AdditionalRegisteredBehaviours)
                {
                    _log.Info($"Adding behavior type from plugin: {atype.Value}");
                    ///   TYPEBEHAVIOUR.AddRegisteredType();
                    TYPEBEHAVIOUR.AddRegisteredTypeAndIndex(atype.Key, atype.Value);
                }

                //now start the connection process

                _mainClient = AkkaSystem
                              .ActorOf(Props.Create(() => new ClientConnection(MainServer, _clientId, Guid.Parse(MainSettings.InitialScene))), "ClientConnection")
                              .Cast <ClientConnectionRef>();

                //await _mainClient.RegisterConnection(Guid.Empty, "");
            }
            catch (Exception e)
            {
                MainUI.Instance.ShowMessageBox(e.ToString(), () => { MainUI.Instance.ShowLoginWindow(Username, Password); });
                Debug.Log(e);
                //  throw;
            }

            //start updates
            //if (MainSettings.UseUpdateThread)
            //{
            //    _updateInterval = MainSettings.UpdateThreadInterval;
            //    _updateThread = new Thread(this.TickUpdaters);
            //    _updateThread.Start();
            //}
        }
Exemple #17
0
        public void TestMethod()
        {
            var        testSuite    = new SsisTestSuite();
            var        projectPath  = config.ProjectPath;
            var        template     = "Product.dtsx";
            var        templatePath = config.TemplatePath;
            PackageRef p            = new PackageRef("ProductPackage", projectPath, template, SsisUnit.Enums.PackageStorageType.FileSystem);

            var conn = new System.Data.SqlClient.SqlConnectionStringBuilder(config.ConnectionString);

            var DatabaseConnectionString = $"{ conn.ConnectionString};Provider=SQLNCLI11.1;Auto Translate=False;Integrated Security =SSPI;";

            ConnectionRef con1 = new ConnectionRef("Destination",
                                                   DatabaseConnectionString,
                                                   ConnectionRef.ConnectionTypeEnum.ConnectionString
                                                   );

            var originalProductListConnection = new PropertyCommand(testSuite)
            {
                Name         = "OriginalProductList",
                PropertyPath = @"\Package.Connections[OriginalProductList].Properties[ConnectionString]",
                Operation    = PropertyCommand.PropertyOperation.Set,
                Value        = config.OriginalFilePath
            };

            //var stagedProductListConnection = new PropertyCommand(testSuite)
            //{
            //    Name="StagedProductList",
            //    PropertyPath = @"\Package.Connections[StagedProductList].Properties[ConnectionString]",
            //    Operation =PropertyCommand.PropertyOperation.Set,
            //    Value= @"C:\Users\nishant-mishra\source\repos\SSIS_UnitTesting\temp\ProductList.txt"
            //};

            testSuite.SetupCommands.Commands.Add(originalProductListConnection);
            //testSuite.SetupCommands.Commands.Add(stagedProductListConnection);
            testSuite.ConnectionList.Add(con1.ReferenceName, con1);
            testSuite.PackageList.Add(p.Name, p);

            //VariableCommand var1 = new VariableCommand(testSuite)
            //{
            //    Name = "fileExists",
            //    Operation = VariableCommand.VariableOperation.Set,
            //    Value = "false"
            //};

            //testSuite.SetupCommands.Commands.Add(var1);

            Test test1 = new Test(testSuite, "Verify No of RecordsinTable", templatePath + template, null, "{74BF5B2C-1017-4015-8B4A-36EEEFD44C06}");

            testSuite.Tests.Add(test1.Name, test1);

            //SqlCommand command1 = new SqlCommand(testSuite, "Destination", false, "select count(1) from dbo.Product");

            //test1.TestSetup.Commands.Add(command1);

            var assert1 = new SsisAssert(testSuite, test1, "Assert: Product has records", 6, false)
            {
                Command = new SqlCommand(testSuite, "Destination", true, "select count(1) from dbo.Product;")
            };


            test1.Asserts.Add(assert1.Name, assert1);
            testSuite.Execute();

            Assert.AreEqual(2, testSuite.Statistics.GetStatistic(SsisUnitBase.Enums.StatisticEnum.AssertPassedCount));
        }
Exemple #18
0
 public Jump(string id, string technicalName, LocalizableText displayName, LocalizableText text, Features features, ConnectionRef target, List<Pin> pins)
     : base(id, technicalName, displayName, text, features)
 {
     this.target = target;
     this.pins = pins;
 }
Exemple #19
0
 public Jump()
     : base()
 {
     target = new ConnectionRef();
     pins = new List<Pin>();
 }
Exemple #20
0
 public Connection(string id, string color, ConnectionRef source, ConnectionRef target)
 {
     this.id = id;
     this.color = color;
     this.source = source;
     this.target = target;
 }
Exemple #21
0
        public void DeleteItem()
        {
            if (treeTest.SelectedNode.Name == "Connection List" ||
                treeTest.SelectedNode.Name == "Package List" ||
                treeTest.SelectedNode.Name == "Dataset List" ||
                treeTest.SelectedNode.Name == "Test Suite Setup" ||
                treeTest.SelectedNode.Name == "Setup" ||
                treeTest.SelectedNode.Name == "Test" ||
                treeTest.SelectedNode.Name == "Teardown" ||
                treeTest.SelectedNode.Name == "Test Suite Teardown")
            {
                return;
            }

            CommandSet commandSet = treeTest.SelectedNode.Parent == null ? null : treeTest.SelectedNode.Parent.Tag as CommandSet;

            if (commandSet != null)
            {
                commandSet.Commands.Remove((CommandBase)treeTest.SelectedNode.Tag);
                treeTest.SelectedNode.Remove();
                return;
            }

            ConnectionRef connectionRef = treeTest.SelectedNode.Tag as ConnectionRef;

            if (connectionRef != null)
            {
                ConnectionRef cref = connectionRef;
                _testSuite.ConnectionList.Remove(cref.ReferenceName);
                treeTest.SelectedNode.Remove();
                return;
            }

            PackageRef packageRef = treeTest.SelectedNode.Tag as PackageRef;

            if (packageRef != null)
            {
                _testSuite.PackageList.Remove(packageRef.Name);
                treeTest.SelectedNode.Remove();
                return;
            }

            Dataset dataset = treeTest.SelectedNode.Tag as Dataset;

            if (dataset != null)
            {
                _testSuite.Datasets.Remove(dataset.Name);
                treeTest.SelectedNode.Remove();
                return;
            }

            Test unitTest = treeTest.SelectedNode.Tag as Test;

            if (unitTest != null)
            {
                _testSuite.Tests.Remove(unitTest.Name);
                treeTest.SelectedNode.Remove();
                return;
            }

            SsisAssert ssisAssert = treeTest.SelectedNode.Tag as SsisAssert;

            if (ssisAssert != null)
            {
                if (treeTest.SelectedNode.Parent == null)
                {
                    return;
                }

                Test cs = (Test)treeTest.SelectedNode.Parent.Tag;
                cs.Asserts.Remove(ssisAssert.Name);
                treeTest.SelectedNode.Remove();
                return;
            }

            if (treeTest.SelectedNode.Parent == null || !(treeTest.SelectedNode.Parent.Tag is SsisAssert))
            {
                return;
            }

            SsisAssert assert = (SsisAssert)treeTest.SelectedNode.Parent.Tag;

            assert.Command = null;
            treeTest.SelectedNode.Remove();
        }
Exemple #22
0
 public Connection()
 {
     id = string.Empty;
     color = string.Empty;
     source = new ConnectionRef();
     target = new ConnectionRef();
 }
Exemple #23
0
        public void PersistDataSetWithResultsIsResultsStoredFalseTest()
        {
            var ts      = new SsisTestSuite();
            var connRef = new ConnectionRef("TestConn", "Data Source=localhost;Initial Catalog=AdventureWorks2012;Integrated Security=SSPI", ConnectionRef.ConnectionTypeEnum.AdoNet, "System.Data.SqlClient");

            ts.ConnectionList.Add(connRef.ReferenceName, connRef);
            var dataset = new Dataset(
                ts,
                "Test",
                connRef,
                false,
                @"SELECT 
CAST(1 AS INT) AS ColInt, 
CAST('Test' AS VARCHAR(50)) AS ColVarChar, 
CAST(N'Test' AS NVARCHAR(50)) AS ColNVarChar, 
CAST('1900-01-01' AS DATETIME) AS ColDateTime");

            dataset.Results = dataset.RetrieveDataTable();

            string datasetXml = @"<Dataset name=""Test"" connection=""TestConn"" isResultsStored=""false""><query><![CDATA[SELECT 
CAST(1 AS INT) AS ColInt, 
CAST('Test' AS VARCHAR(50)) AS ColVarChar, 
CAST(N'Test' AS NVARCHAR(50)) AS ColNVarChar, 
CAST('1900-01-01' AS DATETIME) AS ColDateTime]]></query><results><![CDATA[<NewDataSet>
  <xs:schema id=""NewDataSet"" xmlns="""" xmlns:xs=""http://www.w3.org/2001/XMLSchema"" xmlns:msdata=""urn:schemas-microsoft-com:xml-msdata"">
    <xs:element name=""NewDataSet"" msdata:IsDataSet=""true"" msdata:MainDataTable=""Results"" msdata:UseCurrentLocale=""true"">
      <xs:complexType>
        <xs:choice minOccurs=""0"" maxOccurs=""unbounded"">
          <xs:element name=""Results"">
            <xs:complexType>
              <xs:sequence>
                <xs:element name=""ColInt"" msdata:ReadOnly=""true"" type=""xs:int"" minOccurs=""0"" />
                <xs:element name=""ColVarChar"" msdata:ReadOnly=""true"" minOccurs=""0"">
                  <xs:simpleType>
                    <xs:restriction base=""xs:string"">
                      <xs:maxLength value=""50"" />
                    </xs:restriction>
                  </xs:simpleType>
                </xs:element>
                <xs:element name=""ColNVarChar"" msdata:ReadOnly=""true"" minOccurs=""0"">
                  <xs:simpleType>
                    <xs:restriction base=""xs:string"">
                      <xs:maxLength value=""50"" />
                    </xs:restriction>
                  </xs:simpleType>
                </xs:element>
                <xs:element name=""ColDateTime"" msdata:ReadOnly=""true"" type=""xs:dateTime"" minOccurs=""0"" />
              </xs:sequence>
            </xs:complexType>
          </xs:element>
        </xs:choice>
      </xs:complexType>
    </xs:element>
  </xs:schema>
  <Results>
    <ColInt>1</ColInt>
    <ColVarChar>Test</ColVarChar>
    <ColNVarChar>Test</ColNVarChar>
    <ColDateTime>1900-01-01T00:00:00+01:00</ColDateTime>
  </Results>
</NewDataSet>]]></results></Dataset>";
            string result     = dataset.PersistToXml();

            Assert.AreEqual(datasetXml, result);
        }