Пример #1
0
        public void TestChangeTransOutcomeStatus()
        {
            var record = new TransmissionOutcome {
                Instance = DbBaseClass.FNSBA, TransmissionOutcomeId = TestOutcomeId
            };

            Assert.IsTrue(record.Execute(), record.LastError);

            var outcome = new ChangeTransOutcomeStatus(DbBaseClass.FNSBA)
            {
                TransmissionId = record.TransmissionOutcomeId,
                OldStatus      = record.Status,
                NewStatus      = SpecialStatus
            };

            Assert.IsFalse(outcome.OldStatus == outcome.NewStatus, "Reset source Status to test!");
            Assert.IsTrue(outcome.Execute(), outcome.LastError);

            var result = new TransmissionOutcome {
                Instance = DbBaseClass.FNSBA, TransmissionOutcomeId = TestOutcomeId
            };

            Assert.IsTrue(result.Execute(), result.LastError);
            Assert.IsTrue(SpecialStatus == result.Status, "Results were not set correctly!");
        }
Пример #2
0
        public void TestUnitOfWork()
        {
            var work = new UnitOfWork(DbBaseClass.FNSBA);

            var record = new TransmissionOutcomeStep
            {
                TransmissionOutcomeId = TestOutcomeId,
                Status                = SpecialStatus,
                DestinationString     = "*****@*****.**",
                TransmissionTypeId    = "7",
                ServerName            = "CHA1ND110",
                TransmissionSeqStepId = TestTranSeqStepId,
                Instance              = DbBaseClass.FNSBA
            };

            record.XMissionStepId = record.GetNextSequence();
            record.ErrorText      = "Created from UnitOfWork!";
            work.RegisterInsert(record);

            var record2 = new TransmissionOutcomeStep
            {
                TransmissionOutcomeId = TestOutcomeId,
                Status                = SpecialStatus,
                DestinationString     = "6178862064",
                TransmissionTypeId    = "1",
                ServerName            = "CHA1ND110",
                TransmissionSeqStepId = TestTranSeqStepId,
                Instance              = DbBaseClass.FNSBA,
                XMissionStepId        = record.GetNextSequence(),
                ErrorText             = "Created from UnitOfWork!"
            };

            work.RegisterInsert(record2);

            var outcomeRecord = new TransmissionOutcome
            {
                Instance = DbBaseClass.FNSBA,
                TransmissionOutcomeId = TestOutcomeId
            };

            Assert.IsTrue(outcomeRecord.Execute(), outcomeRecord.LastError);
            var newLastError = String.Format("{0}!", outcomeRecord.LastErrorText);

            outcomeRecord.LastErrorText = newLastError;
            work.RegisterUpdate(outcomeRecord);

            Assert.IsTrue(work.Commit(), work.LastError);

            var outcomeRecord2 = new TransmissionOutcome
            {
                Instance = DbBaseClass.FNSBA,
                TransmissionOutcomeId = TestOutcomeId
            };

            Assert.IsTrue(outcomeRecord2.Execute(), outcomeRecord.LastError);
            Assert.IsTrue(outcomeRecord.LastErrorText.Equals(newLastError), "Update seems to have failed!");

            Console.WriteLine("record 1 XmissionStepId = {0}", record.XMissionStepId);
            Console.WriteLine("record 2 XmissionStepId = {0}", record2.XMissionStepId);
        }
Пример #3
0
        public void TestCreateTransmissionOutcome()
        {
            var outcome = new TransmissionOutcome
            {
                Instance      = "ESUBA",
                RoutingPlanId = "100055",
                Status        = "UNPROCESSED",
                CallId        = "1004608"
            };

            Assert.IsTrue(outcome.Execute(), outcome.LastErrorText);
            //Assert.IsTrue(outcome.Insert(), outcome.LastErrorText);
        }
Пример #4
0
        public void TestUpdateTransOutcomeStatus()
        {
            var record = new TransmissionOutcome {
                Instance = DbBaseClass.FNSBA, TransmissionOutcomeId = TestOutcomeId
            };

            Assert.IsTrue(record.Execute(), record.LastError);
            Assert.IsFalse(record.Status.Equals(SpecialStatus), "Unexpected STATUS result!");
            record.Status        = SpecialStatus;
            record.LastErrorText = "MODIFIED BY TestUpdateTransOutcomeStatus";

            Assert.IsTrue(record.Update(), record.LastError);

            var result = new TransmissionOutcome {
                Instance = DbBaseClass.FNSBA, TransmissionOutcomeId = TestOutcomeId
            };

            Assert.IsTrue(result.Execute(), result.LastError);
            Assert.IsTrue(result.Status.Equals(SpecialStatus), "Results were not set correctly!");

            result.Status = "PROCESSED";
            Assert.IsTrue(result.Update(), record.LastError);
        }
Пример #5
0
        /// <summary>
        /// Creates the transmission outcome record.
        /// </summary>
        /// <param name="instance">The instance.</param>
        /// <param name="routingPlan">The routing plan.</param>
        /// <param name="callId">The call id.</param>
        /// <returns></returns>
        static public bool CreateTransmissionOutcomeRecord(string instance, string routingPlan, string callId)
        {
            bool results = false;

            try
            {
                TransmissionOutcome outcome = new TransmissionOutcome();
                outcome.Instance      = instance;
                outcome.RoutingPlanId = routingPlan;
                outcome.Status        = "UNPROCESSED";
                outcome.CallId        = callId;
                if (!outcome.Insert())
                {
                    throw new ApplicationException(outcome.LastErrorText);
                }
            }
            catch (Exception ex)
            {
                GeneralUtility.LogError(ex.Message, "UpdateOutcomeStatusUsingLock");
                results = false;
            }
            return(results);
        }