public void ConvertToTest()
        {
            long number = 0; // TODO: 初始化为适当的值

            Program_Accessor.ConvertTo(number);
            Assert.Inconclusive("无法验证不返回值的方法。");
        }
예제 #2
0
        public void CreateProjectAndDeployTest2()
        {
            string serverName = ConfigurationManager.ConnectionStrings["CHEF"].ConnectionString.Split(';')[1];
            int    index      = serverName.IndexOf('=');

            serverName = serverName.Substring(index + 1);
            Server server = new Server(serverName);
            IntegrationServices integrationServices = new IntegrationServices(server);
            Catalog             catalog             = integrationServices.Catalogs["SSISDB"];
            CatalogFolder       catalogFolder       = catalog.Folders["NotTheCHEFFolder"];

            if (catalogFolder == null)
            {
                catalogFolder = new CatalogFolder(catalog, "NotTheCHEFFolder", "Not the CHEF folder.");
                catalogFolder.Create();
            }
            string      strProjectLocation = @"C:\Program Files\Microsoft\CHEF\Temp";
            Package     package            = null;
            Application app = new Application();

            package = app.LoadPackage(@"C:\Users\t-satsen\Documents\Visual Studio 2010\Projects\Package_DatabaseToDatabase\BasicFeaturesPackage\bin\Debug\TableToTableDataTransferPkg.dtsx", null);
            Program_Accessor.processID   = "100";
            Program_Accessor.processName = "TestTask";
            if (catalogFolder.Projects[Program_Accessor.processID + "_" + Program_Accessor.processName] != null)
            {
                catalogFolder.Projects[Program_Accessor.processID + "_" + Program_Accessor.processName].Drop();
            }
            Program_Accessor.CreateProjectAndDeploy(catalogFolder, strProjectLocation, package);
            Assert.IsNull(catalogFolder.Projects[Program_Accessor.processID + "_" + Program_Accessor.processName]);
        }
예제 #3
0
        public void OnUnhandledExceptionTest()
        {
            object sender = null;                 // TODO: Initialize to an appropriate value
            UnhandledExceptionEventArgs e = null; // TODO: Initialize to an appropriate value

            Program_Accessor.OnUnhandledException(sender, e);
            Assert.Inconclusive("A method that does not return a value cannot be verified.");
        }
 public void Listing5_01to06()
 {
     using (ConsoleTester consoleTester = ConsoleTester.GetConsoleTester(
                "<<Inigo Montoya: Enough to survive on\r\n"))
     {
         Program_Accessor.Main();
     }
 }
예제 #5
0
        public void ReadInputWordsTest()
        {
            string path = Path.GetFullPath(Path.Combine(Directory.GetCurrentDirectory(), @"..\..\..\WordScoreExercise\Data\american-words.txt"));

            string[] actual;
            actual = Program_Accessor.ReadInputWords(path);
            Assert.IsNotNull(actual);
        }
        public void MainTestProgram()
        {
            string[] args = new string[1];
            args[0] = "1";

            Program_Accessor.Main(args);

            Assert.AreEqual(args.Length, 1);
        }
예제 #7
0
        public void CalculateScoreTest()
        {
            Word target = new Word();

            target.WordLetters = "abcd";
            Program_Accessor.BuildLetterScoreMapping();
            target.CalculateScore();
            Assert.AreEqual(target.WordScore, 10);
        }
예제 #8
0
        public void daTest()
        {
            int[] A        = { 4, 5, 6 }; // TODO: 初始化为适当的值
            int   expected = 15;          // TODO: 初始化为适当的值
            int   actual;

            actual = Program_Accessor.da(A);
            Assert.AreEqual(expected, actual);
            //Assert.Inconclusive("验证此测试方法的正确性。");
        }
예제 #9
0
        public void FindWordsWithRequiredScoreTest()
        {
            string[]      words         = { "balkanizes", "food" };
            List <string> wordMatches   = new List <string>();
            int           requiredScore = 100;

            Program_Accessor.BuildLetterScoreMapping();
            Program_Accessor.FindWordsWithRequiredScore(words, wordMatches, requiredScore);
            Assert.AreEqual(wordMatches[0], "balkanizes");
        }
예제 #10
0
        public void GetAllFilesTest()
        {
            string directory = Environment.CurrentDirectory;
            IEnumerable <FileInfo> expected     = null;
            IEnumerable <FileInfo> actual       = Program_Accessor.GetAllFiles(directory);
            List <FileInfo>        actualToList = actual.ToList();

            Assert.AreEqual(1, actualToList.Count());
            Assert.AreEqual(directory, actualToList[0].DirectoryName);
        }
예제 #11
0
        public void CheckCatalogFolderTest1()
        {
            string folderName = "CHEFFolder"; // TODO: Initialize to an appropriate value
            Server server     = new Server("localhost");
            IntegrationServices integrationServices = new IntegrationServices(server);
            Catalog             catalog             = integrationServices.Catalogs["SSISDB"];
            CatalogFolder       expected            = catalog.Folders[folderName]; // TODO: Initialize to an appropriate value
            CatalogFolder       actual;

            actual = Program_Accessor.CheckCatalogFolder(folderName);
            Assert.AreEqual(expected.FolderId, actual.FolderId);
        }
예제 #12
0
        public void MartinData()
        {
            Program_Accessor.Main(new string[] { @"..\..\..\Testdata\GWL_diff.xml" });

            DFS2 outp = new DFS2(@"..\..\..\Testdata\test_Diff_GWL.dfs2");

            Assert.AreEqual(13, outp.GetData(0, 1)[234, 160]);
            Assert.AreEqual(13, outp.GetData(1, 1)[234, 160]);
            Assert.AreEqual(14, outp.GetData(2, 1)[234, 160]);
            Assert.AreEqual(42.4304, outp.GetData(4, 1)[231, 160], 0.001);
            outp.Dispose();
        }
예제 #13
0
        public void determineEnvironmentTest()
        {
            string[] args        = "some.msi".Split(',');
            string   machineName = "kjwhfwjkfhwjkauto1o;qkdopwkd";
            string   expected    = "AUTO1";
            string   actual;

            actual = Program_Accessor.determineEnvironment(args, machineName);
            Assert.AreEqual(expected, actual);

            machineName = "kjwhfwjkfhwjkqa1o;qkdopwkd";
            expected    = "QA1";
            actual      = Program_Accessor.determineEnvironment(args, machineName);
            Assert.AreEqual(expected, actual);

            machineName = "kjwhfwjkfhwjkqa2o;qkdopwkd";
            expected    = "QA2";
            actual      = Program_Accessor.determineEnvironment(args, machineName);
            Assert.AreEqual(expected, actual);

            machineName = "kjwhfwjkfhwjkmodel1o;qkdopwkd";
            expected    = "MODEL1";
            actual      = Program_Accessor.determineEnvironment(args, machineName);
            Assert.AreEqual(expected, actual);

            machineName = "kjwhfwjkfhwjkmodel21o;qkdopwkd";
            expected    = "MODEL2";
            actual      = Program_Accessor.determineEnvironment(args, machineName);
            Assert.AreEqual(expected, actual);

            machineName = "kjwhfwjkfhwjkprod;qkdopwkd";
            expected    = "PROD";
            actual      = Program_Accessor.determineEnvironment(args, machineName);
            Assert.AreEqual(expected, actual);

            machineName = "qa2kjwhfwjkfhwjkprod;qkdopwkd";
            expected    = "QA2";
            actual      = Program_Accessor.determineEnvironment(args, machineName);
            Assert.AreEqual(expected, actual);

            args        = "some.msi,dev2".Split(',');
            machineName = "I'mAPRODBox";
            expected    = "DEV2";
            actual      = Program_Accessor.determineEnvironment(args, machineName);
            Assert.AreEqual(expected, actual);

            args        = "some.msi".Split(',');
            machineName = "NoMatch";
            expected    = "?";
            actual      = Program_Accessor.determineEnvironment(args, machineName);
            Assert.AreEqual(expected, actual);
        }
        public void MapViewModelTest()
        {
            EmailCobrancaAvaliacao email = GetEmailCompleto();
            MailViewModel          actual;

            actual = Program_Accessor.MapViewModel(email);
            Assert.AreEqual(actual.AvaliacaoSolicitacaoAno, email.Avaliacao.Solicitacao.Ano);
            Assert.AreEqual(actual.AvaliacaoSolicitacaoSeq, email.Avaliacao.Solicitacao.Seq);
            Assert.AreEqual(actual.AvaliacaoDataLimite, email.Avaliacao.DataLimite);
            Assert.AreEqual(actual.AvaliacaoSolicitacaoUserFullName, email.Avaliacao.Solicitacao.User.FullName);
            Assert.AreEqual(actual.AvaliacaoId, email.Avaliacao.Id);
            Assert.AreEqual(actual.AvaliacaoSolicitacaoUserEmail, email.Avaliacao.Solicitacao.User.Email);
            Assert.AreEqual(actual.AvaliacaoSolicitacaoId, email.Avaliacao.Solicitacao.Id);
        }
        public void EnviarEmailsTest()
        {
            EmailCobrancaAvaliacao emailCompleto        = GetEmailCompleto();
            IEnumerable <EmailCobrancaAvaliacao> emails = new EmailCobrancaAvaliacao[] {
                emailCompleto
            };

            Program_Accessor.EnviarEmails(emails);
            foreach (var email in emails)
            {
                Assert.IsTrue(email.Enviado, "Email deve ser marcado como enviado");
                Assert.IsTrue(DateTime.Now.Subtract(email.EnviadoEm) < new TimeSpan(0, 2, 0),
                              "Tempo desde o envio deve ser menor que 2 min");
            }
        }
예제 #16
0
        public void validateEnvironmentTest()
        {
            string env = "DEV";

            Program_Accessor.validateEnvironment(env);

            env = "QA";
            Program_Accessor.validateEnvironment(env);

            env = "MODEL";
            Program_Accessor.validateEnvironment(env);

            env = "PROD";
            Program_Accessor.validateEnvironment(env);

            Assert.Inconclusive("If the result is inconclusive it passed!");
        }
        public void EnviarEmailTest()
        {
            string        templateText = "Enviando email para @Model.AvaliacaoSolicitacaoUserEmail";
            MailViewModel email        = new MailViewModel()
            {
                AvaliacaoSolicitacaoUserEmail = "*****@*****.**",
                AvaliacaoSolicitacaoAno       = 2012,
                AvaliacaoSolicitacaoSeq       = 1,
                AvaliacaoSolicitacaoId        = 1,
                AvaliacaoId         = 1,
                AvaliacaoDataLimite = DateTime.Now.AddDays(2),
                AvaliacaoSolicitacaoUserFullName = "Paolo Haji de Carvalho Bueno"
            };
            bool expected = true;
            bool actual   = false;

            actual = Program_Accessor.EnviarEmail(templateText, email);
            Assert.AreEqual(expected, actual);
        }
예제 #18
0
        public void ParseArgumentsTest()
        {
            string[] arguments = new [] { "--value2=15", "--value1=\"hallo welt\"" };
            Dictionary <string, string> expected = new Dictionary <string, string>
            {
                { "value2", "15" },
                { "value1", "hallo welt" },
            };

            Dictionary <string, string> actual;

            actual = Program_Accessor.ParseArguments(arguments);

            foreach (var item in expected)
            {
                Assert.IsTrue(actual.ContainsKey(item.Key));
                Assert.AreEqual(item.Value, actual[item.Key]);
            }

            Assert.IsTrue(actual.Count == expected.Count);
        }
        public void MachBracketTest()
        {
            char[] list     = new char[] { '[', ']', '{' }; // TODO: 初始化为适当的值
            bool   expected = false;                        // TODO: 初始化为适当的值
            bool   actual;

            actual = Program_Accessor.MachBracket(list);
            Assert.AreEqual(expected, actual);

            list     = new char [] { '{', '[', '(', ')', ']', '}' };
            expected = true;
            actual   = Program_Accessor.MachBracket(list);
            Assert.AreEqual(expected, actual);

            list     = new char[] { '{', '{', '(', ')', ']', '}' };
            expected = false;
            actual   = Program_Accessor.MachBracket(list);
            Assert.AreEqual(expected, actual);

            list     = new char[] { '}', '{', '(', ')', ']', '}' };
            expected = false;
            actual   = Program_Accessor.MachBracket(list);
            Assert.AreEqual(expected, actual);
        }
예제 #20
0
        public void TestFlatFileToTableTask()
        {
            string[]      args = { };
            SqlConnection conn = new SqlConnection(ConfigurationManager.ConnectionStrings["CHEF"].ConnectionString);

            conn.Open();
            SqlCommand cmd = conn.CreateCommand();

            cmd.CommandType = System.Data.CommandType.Text;
            cmd.CommandText = "DELETE FROM [Chef].[Log]"
                              + " WHERE [Log].[QueueID] IN"
                              + " (SELECT QueueID FROM [CHEF].[RequestQueue]"
                              + " WHERE ProcessID = 9500)";
            cmd.ExecuteNonQuery();
            cmd.CommandType = System.Data.CommandType.Text;
            cmd.CommandText = "DELETE FROM [Chef].[RequestQueue]"
                              + " WHERE ProcessID = 9500";
            cmd.ExecuteNonQuery();
            cmd.CommandText = "DELETE FROM [Chef].[MetaData]"
                              + " WHERE ProcessID = 9500";
            cmd.ExecuteNonQuery();
            cmd.CommandType = System.Data.CommandType.Text;
            cmd.CommandText = "INSERT INTO [CHEF].[Metadata] VALUES "
                              + "(9500"
                              + ",'FlatFileToTableTaskTest'"
                              + ",'<CHEFMetaData ApplicationName=\"TestApplication\">"
                              + "     <Process ID=\"9500\" Name=\"DemoFlatFileToTable\" DefaultAllowTruncate=\"False\" VerboseLogging=\"False\" ExecuteExistingPackage=\"False\" >"
                              + "         <ConnectionSet>"
                              + "             <SQLConnection key=\"SQLConnection\" ServerName=\"(local)\" DatabaseName=\"AdventureWorks2012\" />"
                              + "             <FlatFileConnection key=\"FlatFileConnection\" FileName=\"C:\\Users\\t-satsen\\Desktop\" />"
                              + "         </ConnectionSet>"
                              + "         <Step ID=\"9510\" Name=\"SQL Query To Table Test\" TypeID=\"1\" TypeName=\"Staging\">"
                              + "                 <DataFlowSet Name=\"FlatFileToTable\" SourceConnection=\"FlatFileConnection\" TargetConnection=\"SQLConnection\" SourceType=\"FlatFile\" TargetType=\"Table\" PickColumnsFromTarget=\"True\" ColumnDelimeter=\",\" RowDelimeter=\"{CR}{LF}\" IsColumnNamesInFirstDataRow=\"True\" RunParallel=\"True\" AllowFlatFileTruncate=\"False\" TruncateOrDeleteBeforeInsert=\"Truncate\" DeleteFilterClause=\"\" >"
                              + "                 <DataFlow Name=\"TestFile1\" SourceName=\"MyFlatFile.txt\" TargetName=\"Sales.CustomerCOPY\" />"
                              + "             </DataFlowSet>"
                              + "         </Step>"
                              + "     </Process>"
                              + "</CHEFMetaData>'"
                              + ",0"
                              + ",SUSER_SNAME()"
                              + ",SYSDATETIME()"
                              + ",SUSER_SNAME()"
                              + ",SYSDATETIME())";
            cmd.ExecuteNonQuery();
            cmd.Parameters.Clear();
            cmd.CommandType = System.Data.CommandType.StoredProcedure;
            cmd.Parameters.AddWithValue("@ProcessID", 9500);
            cmd.Parameters.AddWithValue("@StartStepID", 9510);
            cmd.Parameters.AddWithValue("@RequestStatus", 1);
            cmd.CommandText = "CHEF.InsertRequestQueue";
            cmd.ExecuteNonQuery();

            Program_Accessor.WraperCreateSSISPkg(args);

            cmd.Parameters.Clear();
            cmd.CommandType = CommandType.Text;
            cmd.CommandText = "DELETE FROM [CHEF].[RequestQueue] WHERE [QueueID] = (SELECT MAX(QueueID) FROM [CHEF].[RequestQueue] WHERE [ProcessID] = 9500)";
            cmd.ExecuteNonQuery();
            string serverName    = ConfigurationManager.ConnectionStrings["CHEF"].ConnectionString.Split(';')[1];
            int    index         = serverName.IndexOf('=');
            int    finalStatusID = 4;
            bool   testPass      = true;

            serverName = serverName.Substring(index + 1);
            Server server = new Server(serverName);
            IntegrationServices integrationServices = new IntegrationServices(server);

            Microsoft.SqlServer.Management.IntegrationServices.PackageInfo packageInfo = null;
            ProjectInfo projectInfo = integrationServices.Catalogs["SSISDB"].Folders["CHEFFolder"].Projects["9500_FlatFileToTableTaskTest"];

            Assert.IsNotNull(projectInfo);
            packageInfo = projectInfo.Packages["Package.dtsx"];
            Assert.IsNotNull(packageInfo);
            packageInfo.Execute(false, null);
            Thread.Sleep(1000);
            cmd.Parameters.Clear();
            cmd.CommandType = System.Data.CommandType.Text;
            cmd.CommandText = "SELECT MAX([StatusID])"
                              + " FROM [CHEF].[Log]"
                              + " WHERE [QueueID] ="
                              + " (SELECT [QueueID]"
                              + " FROM [CHEF].[RequestQueue]"
                              + " WHERE [ProcessID] = 9500)";
            SqlDataReader sqlDataReader = cmd.ExecuteReader();

            if (sqlDataReader.HasRows)
            {
                sqlDataReader.Read();
                finalStatusID = Convert.ToInt32(sqlDataReader[0].ToString());
            }
            if (finalStatusID == 4)
            {
                testPass = false;
            }
            sqlDataReader.Close();
            if (testPass)
            {
                cmd.Parameters.Clear();
                cmd.CommandType = CommandType.Text;
                cmd.CommandText = "UPDATE [CHEF].[RequestQueue]"
                                  + " SET [RequestStatus] = 2"
                                  + " WHERE [ProcessID] = 9500";
                cmd.ExecuteNonQuery();
            }
            else
            {
                cmd.Parameters.Clear();
                cmd.CommandType = CommandType.Text;
                cmd.CommandText = "UPDATE [CHEF].[RequestQueue]"
                                  + " SET [RequestStatus] = 4"
                                  + " WHERE [ProcessID] = 9500";
                cmd.ExecuteNonQuery();
            }
            Assert.IsTrue(testPass);
        }
예제 #21
0
 public void MainTest()
 {
     string[] args = null; // TODO: 初始化为适当的值
     Program_Accessor.Main(args);
     Assert.Inconclusive("无法验证不返回值的方法。");
 }
예제 #22
0
 public void MainTest()
 {
     string[] args = null; // TODO: initialisez à une valeur appropriée
     Program_Accessor.Main(args);
     Assert.Inconclusive("Une méthode qui ne retourne pas une valeur ne peut pas être vérifiée.");
 }
예제 #23
0
 public void MainTest1()
 {
     Program_Accessor.Main();
 }
예제 #24
0
 public void MainTest()
 {
     Program_Accessor.Main();
     Assert.Inconclusive("Une méthode qui ne retourne pas une valeur ne peut pas être vérifiée.");
 }
예제 #25
0
 public void TestMethod1()
 {
     Program_Accessor.Main(new string[] { @"d:\temp\Dk5_LayerSum.xml" });
 }
예제 #26
0
 public void MainTest()
 {
     string[] args = null; // TODO: Initialize to an appropriate value
     Program_Accessor.Main(args);
 }
예제 #27
0
 public void Dfs0ToMonthlyTest()
 {
     Program_Accessor.Main(new string[] { @"..\..\..\..\TestData\GridTools\GridTools_Input.xml" });
 }
예제 #28
0
 public void Setdirectorytest()
 {
     Program_Accessor.Main(new string[] { "./GridTools_Input.xml" });
 }
예제 #29
0
 public void MainTest()
 {
     Program_Accessor.Main();
     Assert.Inconclusive("A method that does not return a value cannot be verified.");
 }
예제 #30
0
 public void InsertValuesTest()
 {
     Program_Accessor.Main(new string[] { @"..\..\..\TestData\GridTools_InsetValuesTest.xml" });
 }