Exemple #1
0
        public void TestChangeTransOutcomeStepStatus()
        {
            var record = new TransmissionOutcomeStep
            {
                Instance       = DbBaseClass.FNSBA,
                XMissionStepId = TestOutcomeStepId
            };

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

            var outcome = new ChangeTransOutcomeStepStatus(DbBaseClass.FNSBA)
            {
                TransmissionStepId = record.XMissionStepId,
                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 TransmissionOutcomeStep
            {
                Instance       = DbBaseClass.FNSBA,
                XMissionStepId = TestOutcomeStepId
            };

            Assert.IsTrue(result.Execute(), result.LastError);
            Assert.IsTrue(SpecialStatus == result.Status, "Results were not set correctly!");
        }
Exemple #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);
        }
Exemple #3
0
        public void TestInsertAndUpdateTransOutcomeStepStatus()
        {
            var record = new TransmissionOutcomeStep
            {
                Instance = DbBaseClass.FNSBA,
                TransmissionOutcomeId = TestOutcomeId,
                Status                = SpecialStatus,
                DestinationString     = "*****@*****.**",
                TransmissionTypeId    = "7",
                ServerName            = "CHA1ND110",
                TransmissionSeqStepId = TestTranSeqStepId
            };

            record.XMissionStepId = record.GetNextSequence();

            Assert.IsTrue(record.Insert(), record.LastError);
            Console.WriteLine("XmissionStepId = {0}", record.XMissionStepId);

            var result = new TransmissionOutcomeStep
            {
                Instance       = DbBaseClass.FNSBA,
                XMissionStepId = record.XMissionStepId
            };

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

            Assert.IsTrue(result.Status.Equals(SpecialStatus), "Results were not set correctly!");
            result.Status    = "PROCESSED";
            result.ErrorText = "MODIFIED BY TestChangeTransOutcomeStatus";
            Assert.IsTrue(result.Update(), record.LastError);

            Assert.IsFalse(result.Status.Equals(SpecialStatus), "Unexpected STATUS result!");
        }
Exemple #4
0
        public void TestUnitOfWorkRollback()
        {
            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.XMissionStepId,
                ErrorText             = "Created from UnitOfWork!"
            };

            work.RegisterInsert(record2);

            Assert.IsFalse(work.Commit(), work.LastError);
            Assert.IsNotEmpty(work.LastError, "No error message reported!");
            Console.WriteLine(work.LastError);

            work.Rollback();
            Assert.IsFalse(work.HasWork, "HasWork is incorrect!");
        }