コード例 #1
0
        public void RemoveTicket()
        {
            EmptyTicket();

            MakeTicket();

            TicketProcess ticketProcess = new TicketProcess();
            List <Ticket> tickets       = ticketProcess.GetTickets();

            ticketProcess.RemoveTicket(tickets[0]);

            Assert.IsTrue(tickets.Count == (ticketProcess.GetTickets().Count + 1));
        }
コード例 #2
0
        public void MakeTicket()
        {
            TicketProcess ticketProcess = new TicketProcess();

            int count = ticketProcess.GetTickets().Count;

            Ticket ticket = new Ticket();

            ticket.SenderName    = "Sender";
            ticket.SenderAddress = "*****@*****.**";
            ticket.Subject       = "Subject";
            ticket.Body          = "Body";
            ticket.Source        = new Source()
            {
                Provider         = "System.Data.SqlClient",
                Value            = "select top 1000 userName as name, userEmail as address from Member where userEmail like '*****@*****.**'",
                ConnectionString = "Data Source=tiger02;Initial Catalog=ALToolsMember;Integrated Security=False;User Id=svcinfra;Password=dkdlvhsy10;MultipleActiveResultSets=True"
            };


            string fileName = string.Empty;

            ticketProcess.SaveTicket(ticket);

            Assert.IsTrue(Directory.GetFiles(PathInfo.Ticket).Length == ++count);

            ticketProcess = new TicketProcess();

            Assert.IsTrue(ticketProcess.GetTickets().Count > 0);
        }
コード例 #3
0
        private void EmptyTicket()
        {
            TicketProcess ticketProcess = new TicketProcess();

            ticketProcess.EmptyTicket();

            Assert.IsTrue(ticketProcess.GetTickets().Count == 0);
        }
コード例 #4
0
        public void GetTickets()
        {
            TicketProcess ticketProcess = new TicketProcess();
            List <Ticket> tickets       = ticketProcess.GetTickets();

            Source source = tickets[0].DecryptedSource;

            Assert.IsTrue(!string.IsNullOrEmpty(source.Provider));
            Assert.IsTrue(!string.IsNullOrEmpty(source.Value));
            Assert.IsTrue(!string.IsNullOrEmpty(source.ConnectionString));
        }
コード例 #5
0
        public void GetSourceFromTicket()
        {
            MakeTicket();

            TicketProcess ticketProcess = new TicketProcess();
            List <Ticket> tickets       = ticketProcess.GetTickets();

            Source source = tickets[0].DecryptedSource;

            string value            = source.Value;
            string connectionString = source.ConnectionString;

            if (source.Provider == "System.Data.SqlClient")
            {
                Database db = new SqlDatabase(source.ConnectionString);
                DataSet  ds = db.ExecuteDataSet(CommandType.Text, source.Value);

                Assert.IsTrue(ds.Tables.Count > 0 && ds.Tables[0].Rows.Count >= 0);
            }
            else
            {
                throw new NotSupportedException();
            }
        }