Example #1
0
        public void CreateButton_Click_UpdateNotActiveNoTriggerNOOPYesNOOPReply_SaveCalled(int blastId)
        {
            // Arrange
            var layoutPlan = new commEntities.LayoutPlans()
            {
                BlastID = 0
            };
            var blast = new commEntities.BlastSMS()
            {
                BlastID = blastId, CustomerID = 1
            };

            InitTest_CreateButton_Click(createBtnText: "Update Trigger", userId: 0, layoutPlaneId: 0, layoutPlans: layoutPlan, blastAbstract: blast, triggerPlan: null, noopRadioValue: "Y", hfSelectedLayoutNOOPReply: "10", updateTriggerMessageValue: 1);

            // Act
            _messageTriggersPrivateObject.Invoke("CreateButton_Click", new object[] { null, null });

            // Assert
            _phError.Visible.ShouldBeFalse();
            var saveCallCount = blastId > -1 ? 1 : 0;

            if (blastId > -1)
            {
                _triggerPlanSaveMethodCallCount.ShouldBe(saveCallCount);
            }
        }
Example #2
0
        public void CreateButton_Click_UpdateNotActiveWithTriggerNOOPYesNOOPReply_NoErrors(int updateTriggerMessageMethodValue)
        {
            // Arrange
            var triggerTimeSpan = new TimeSpan(5, 3, 1, 0);
            var layoutPlan      = new commEntities.LayoutPlans()
            {
                BlastID = 0
            };
            var userId = 200;
            var blast  = new commEntities.BlastSMS()
            {
                CustomerID = 1
            };
            var triggerPlans = new commEntities.TriggerPlans()
            {
                BlastID = 0
            };

            InitTest_CreateButton_Click(createBtnText: "Update Trigger", userId: userId, layoutPlaneId: 0, layoutPlans: layoutPlan, blastAbstract: blast, triggerPlan: triggerPlans, noopRadioValue: "Y", hfSelectedLayoutNOOPReply: "10", triggerTimeSpan: triggerTimeSpan, updateTriggerMessageValue: updateTriggerMessageMethodValue);

            // Act
            _messageTriggersPrivateObject.Invoke("CreateButton_Click", new object[] { null, null });

            // Assert
            triggerPlans.ShouldSatisfyAllConditions(
                () => triggerPlans.Period.ShouldBe(Convert.ToDecimal(triggerTimeSpan.TotalDays)),
                () => triggerPlans.ActionName.ShouldBe("NO OPEN on " + LayoutName),
                () => triggerPlans.UpdatedUserID.ShouldBe(userId));
            _triggerPlanSaveMethodCallCount.ShouldBe(1);
            _phError.Visible.ShouldBeFalse();
        }
Example #3
0
        public void CreateButton_Click_NotUpdateNOOPYesGetNOOPBlastError_Error()
        {
            // Arrange
            var blast = new commEntities.BlastSMS()
            {
                CustomerID = 1, BlastID = 1
            };

            InitTest_CreateButton_Click(createBtnText: "NotUpdate", userId: 0, layoutPlaneId: 0, layoutPlans: null, blastAbstract: blast, triggerPlan: null, noopRadioValue: "Y", hfSelectedLayoutNOOPReply: "10", updateTriggerMessageValue: 1);
            var ecnErros = new List <ECNError>();

            ecnErros.Add(new ECNError(Enums.Entity.BlastAB, Enums.Method.Get, "GetNOOPBlastFromControlsBlast_Error"));
            var ecnException = new ECNException(ecnErros);
            var error        = "<br/>" + Enums.Entity.BlastAB + ": " + "GetNOOPBlastFromControlsBlast_Error";

            ShimMessageTriggers.AllInstances.GetNOOPBlastFromControlsBlast = (m, b) => throw ecnException;

            // Act
            _messageTriggersPrivateObject.Invoke("CreateButton_Click", new object[] { null, null });

            // Assert
            _triggerPlanSaveMethodCallCount.ShouldBe(0);
            _phError.Visible.ShouldBeTrue();
            _lblErrorMessage.Text.ShouldBe(error);
        }
Example #4
0
        public void CreateButton_Click_UpdateActiveWithTrigger_Errors()
        {
            // Arrange
            var layoutPlan = new commEntities.LayoutPlans()
            {
                BlastID = 0
            };
            var blast = new commEntities.BlastSMS()
            {
                CustomerID = 1
            };
            var triggerPlans = new commEntities.TriggerPlans()
            {
                BlastID = 0
            };

            InitTest_CreateButton_Click(createBtnText: "Update Trigger", userId: 0, layoutPlaneId: 0, layoutPlans: layoutPlan, blastAbstract: blast, triggerPlan: triggerPlans, noopRadioValue: "Y", hfSelectedLayoutNOOPReply: "10", updateTriggerMessageValue: 1, activeOrSentResult: true);
            var error = "<br/>" + Enums.Entity.LayoutPlans + ": " + "Triggers have already been sent.  Cannot update.";

            // Act
            _messageTriggersPrivateObject.Invoke("CreateButton_Click", new object[] { null, null });

            // Assert
            _phError.Visible.ShouldBeTrue();
            _lblErrorMessage.Text.ShouldBe(error);
        }
Example #5
0
        public void CreateButton_Click_UpdateNotActiveWithTriggerNOOPYesNullNOOPReply_Error()
        {
            // Arrange
            var layoutPlan = new commEntities.LayoutPlans()
            {
                BlastID = 0
            };
            var blast = new commEntities.BlastSMS()
            {
                CustomerID = 1
            };
            var triggerPlans = new commEntities.TriggerPlans()
            {
                BlastID = 0
            };
            var error = "<br/>" + Enums.Entity.LayoutPlans + ": " + "Please select a No Open follow up message";

            InitTest_CreateButton_Click(createBtnText: "Update Trigger", userId: 0, layoutPlaneId: 0, layoutPlans: layoutPlan, blastAbstract: blast, triggerPlan: triggerPlans, noopRadioValue: "Y", hfSelectedLayoutNOOPReply: string.Empty, updateTriggerMessageValue: 1);

            // Act
            _messageTriggersPrivateObject.Invoke("CreateButton_Click", new object[] { null, null });

            // Assert
            _phError.Visible.ShouldBeTrue();
            _lblErrorMessage.Text.ShouldBe(error);
        }
Example #6
0
        public void CreateButton_Click_UpdateNotActiveWithTriggerNOOPYesNOOPReplyGetNOOPBlastError_Error()
        {
            // Arrange
            var layoutPlan = new commEntities.LayoutPlans()
            {
                BlastID = 0
            };
            var blast = new commEntities.BlastSMS()
            {
                CustomerID = 1
            };
            var triggerPlans = new commEntities.TriggerPlans()
            {
                BlastID = 0
            };
            var ecnErros = new List <ECNError>();

            ecnErros.Add(new ECNError(Enums.Entity.BlastAB, Enums.Method.Save, "GetNOOPBlast_Error"));
            var ecnException = new ECNException(ecnErros);
            var error        = "<br/>" + Enums.Entity.BlastAB + ": " + "GetNOOPBlast_Error";

            InitTest_CreateButton_Click(createBtnText: "Update Trigger", userId: 0, layoutPlaneId: 0, layoutPlans: layoutPlan, blastAbstract: blast, triggerPlan: triggerPlans, noopRadioValue: "Y", hfSelectedLayoutNOOPReply: "10", updateTriggerMessageValue: 1);
            _shimMessageTriggers.GetNOOPBlastFromControlsBlast = (b) => throw ecnException;

            // Act
            _messageTriggersPrivateObject.Invoke("CreateButton_Click", new object[] { null, null });

            // Assert
            _phError.Visible.ShouldBeTrue();
            _lblErrorMessage.Text.ShouldBe(error);
        }
Example #7
0
        public void CreateButton_Click_NotUpdateNOOPYes_SaveCalledNoError(string eventTypeItem)
        {
            // Arrange
            var blast = new commEntities.BlastSMS()
            {
                CustomerID = 1, BlastID = 1
            };

            InitTest_CreateButton_Click(createBtnText: "NotUpdate", userId: 0, layoutPlaneId: 0, layoutPlans: null, blastAbstract: blast, triggerPlan: null, noopRadioValue: "Y", hfSelectedLayoutNOOPReply: "10", updateTriggerMessageValue: 1, eventTypeSelectedItem: eventTypeItem);

            // Act
            _messageTriggersPrivateObject.Invoke("CreateButton_Click", new object[] { null, null });

            // Assert
            _triggerPlanSaveMethodCallCount.ShouldBe(1);
            _phError.Visible.ShouldBeFalse();
        }
Example #8
0
        public void CreateButton_Click_NotUpdateNOOPYesInvalidTriggerBlastId_SkipSaveNoError()
        {
            // Arrange
            var blast = new commEntities.BlastSMS()
            {
                CustomerID = 1, BlastID = 1
            };

            InitTest_CreateButton_Click(createBtnText: "NotUpdate", userId: 0, layoutPlaneId: 0, layoutPlans: null, blastAbstract: blast, triggerPlan: null, noopRadioValue: "Y", hfSelectedLayoutNOOPReply: "10", updateTriggerMessageValue: 1);
            ShimMessageTriggers.AllInstances.CreateTriggerMessageBlast = (m, b) => - 1;

            // Act
            _messageTriggersPrivateObject.Invoke("CreateButton_Click", new object[] { null, null });

            // Assert
            _triggerPlanSaveMethodCallCount.ShouldBe(0);
            _phError.Visible.ShouldBeFalse();
        }
Example #9
0
        public void CreateButton_Click_NotUpdateNOOPNO_Error()
        {
            // Arrange
            var blast = new commEntities.BlastSMS()
            {
                CustomerID = 1, BlastID = 1
            };

            InitTest_CreateButton_Click(createBtnText: "NotUpdate", userId: 0, layoutPlaneId: 0, layoutPlans: null, blastAbstract: blast, triggerPlan: null, noopRadioValue: "N", hfSelectedLayoutNOOPReply: "10", updateTriggerMessageValue: 1);
            var error = "<br/>" + Enums.Entity.LayoutPlans + ": " + "Please select a No Open follow up message";

            // Act
            _messageTriggersPrivateObject.Invoke("CreateButton_Click", new object[] { null, null });

            // Assert
            _triggerPlanSaveMethodCallCount.ShouldBe(0);
            _phError.Visible.ShouldBeTrue();
            _lblErrorMessage.Text.ShouldBe(error);
        }
Example #10
0
        public void CreateButton_Click_UpdateNotActiveNoTriggerWrongSelectedValue_Error(string noopValue, string layoutNOOPReplyValue)
        {
            // Arrange
            var layoutPlan = new commEntities.LayoutPlans()
            {
                BlastID = 0
            };
            var blast = new commEntities.BlastSMS()
            {
                BlastID = 1, CustomerID = 1
            };
            var error = "<br/>" + Enums.Entity.LayoutPlans + ": " + "Please select a No Open follow up message";

            InitTest_CreateButton_Click(createBtnText: "Update Trigger", userId: 0, layoutPlaneId: 0, layoutPlans: layoutPlan, blastAbstract: blast, triggerPlan: null, noopRadioValue: noopValue, hfSelectedLayoutNOOPReply: layoutNOOPReplyValue, updateTriggerMessageValue: 1);

            // Act
            _messageTriggersPrivateObject.Invoke("CreateButton_Click", new object[] { null, null });

            // Assert
            _phError.Visible.ShouldBeTrue();
            _triggerPlanSaveMethodCallCount.ShouldBe(0);
            _lblErrorMessage.Text.ShouldBe(error);
        }
Example #11
0
        public void CreateButton_Click_UpdateNotActiveWithTriggerNOOPNo_DeleteCalled()
        {
            // Arrange
            var layoutPlan = new commEntities.LayoutPlans()
            {
                BlastID = 0
            };
            var blast = new commEntities.BlastSMS()
            {
                CustomerID = 1
            };
            var triggerPlans = new commEntities.TriggerPlans()
            {
                BlastID = 0
            };

            InitTest_CreateButton_Click(createBtnText: "Update Trigger", userId: 0, layoutPlaneId: 0, layoutPlans: layoutPlan, blastAbstract: blast, triggerPlan: triggerPlans, noopRadioValue: "N", hfSelectedLayoutNOOPReply: string.Empty, updateTriggerMessageValue: 1);

            // Act
            _messageTriggersPrivateObject.Invoke("CreateButton_Click", new object[] { null, null });

            // Assert
            _triggerPlanDeleteMethodCallCount.ShouldBe(1);
        }