Exemplo n.º 1
0
        public void InsertUpdateToDbTests_ShouldInsertUpdateInboundEmailsToDb()
        {
            foreach (List <string> emailX in InboundEmailsList)
            {
                string fileName      = emailX[0];
                string subject       = emailX[1];
                string emailUsername = emailX[2];
                string response      = emailX[3];
                string responseDate  = emailX[4];
                string phase         = emailX[5];
                CreateEntryInboundStrEmails(fileName, emailUsername, "InboundStrEmails", subject, response, responseDate, phase);
            }
            foreach (List <string> emailX in OutboundEmailsList)
            {
                string fileName      = emailX[0];
                string subject       = emailX[1];
                string emailUsername = emailX[2];
                string sentDate      = emailX[3];
                string phase         = emailX[4];
                CreateEntryOutboundStrEmails(fileName, emailUsername, "OutboundStrEmails", subject, sentDate, phase);
            }
            MyDbUtils muForRead     = new MyDbUtils(this.DbPath);
            long      actualCount   = muForRead.CountEntries("InboundStrEmails");
            long      expectedCount = 11;

            Assert.Equal(expectedCount, actualCount);
        }
Exemplo n.º 2
0
        public void InsertToDbTest_ShouldInsertEntriesToOuboundStrEmails()
        {
            foreach (List <string> entryX in this.OutboundEmailsList)
            {
                string fileName               = entryX[0];
                string subject                = entryX[1];
                string emailUsername          = entryX[2];
                string sentDate               = entryX[3];
                OutboundStrEmailsHandler outH = new OutboundStrEmailsHandler(this.DbPath, fileName, subject, emailUsername, sentDate);
                outH.InsertToDb();
            }
            MyDbUtils muForRead     = new MyDbUtils(this.DbPath);
            long      actualCount   = muForRead.CountEntries("OutboundStrEmails");
            long      expectedCount = 3;

            Assert.Equal(expectedCount, actualCount);
        }
        public void InsertToDbTests_ShouldInsertInboundEmailsToDb()
        {
            foreach (List <string> emailX in InboundEmailsList)
            {
                string fileName      = emailX[0];
                string subject       = emailX[1];
                string emailUsername = emailX[2];
                string response      = emailX[3];
                string responseDate  = emailX[4];
                InboundStrEmailsHandler iSEHandler = new InboundStrEmailsHandler(this.DbPath, fileName, subject, emailUsername, response, responseDate);
                iSEHandler.InsertToDb();
            }
            MyDbUtils muForRead     = new MyDbUtils(this.DbPath);
            long      actualCount   = muForRead.CountEntries("InboundStrEmails");
            long      expectedCount = 12;

            Assert.Equal(expectedCount, actualCount);
        }
Exemplo n.º 4
0
        private void CreateEntryInboundStrEmails(string FileName, string EmailUsername, string TABLE_NAME, string Subject, string Response, string ResponseDate, string Phase)
        {
            Dictionary <string, string> criteriaX = new Dictionary <string, string>()
            {
                ["FileName"]      = FileName,
                ["EmailUsername"] = EmailUsername,
            };
            MyDbUtils mduForCount = new MyDbUtils(this.DbPath);
            long      resultCount = mduForCount.CountEntries(TABLE_NAME, criteriaX);

            if (resultCount < 1)
            {
                Dictionary <string, string> recordsX = new Dictionary <string, string>()
                {
                    ["FileName"]      = FileName,
                    ["Subject"]       = Subject,
                    ["EmailUsername"] = EmailUsername,
                    ["Response"]      = Response,
                    ["ResponseDate"]  = ResponseDate,
                    ["Phase"]         = Phase
                };

                MyDbUtils mdu = new MyDbUtils(this.DbPath);
                mdu.CreateEntry(TABLE_NAME, recordsX);
            }
            else
            {
                Dictionary <string, string> recordsX = new Dictionary <string, string>()
                {
                    ["Subject"]      = Subject,
                    ["Response"]     = Response,
                    ["ResponseDate"] = ResponseDate,
                    ["Phase"]        = Phase
                };

                MyDbUtils mduForUpdate = new MyDbUtils(this.DbPath);
                mduForUpdate.UpdateEntry(TABLE_NAME, criteriaX, recordsX);
            }
        }