public void DltEmailOptionsItemCommand_IfQuoteStatusDoesNotEqualToApprovedAndCommandNameIsUpdate_UpdatesQuoteItemFieldsAndFiresEvent()
        {
            // Arrange
            var editOptionsListItem02 = _ddlEditType.Items.FindByValue(_quoteOption02.Code);

            if (editOptionsListItem02 != null)
            {
                editOptionsListItem02.Selected = true;
            }

            var editFrequencyListItem02 = _ddlEditFrequency.Items.FindByValue(((int)Frequency02).ToString());

            if (editFrequencyListItem02 != null)
            {
                editFrequencyListItem02.Selected = true;
            }

            _txtEditRate.Text         = Rate02.ToString();
            _txtEditDiscountRate.Text = DiscountRate02.ToString();

            var loadQuoteItemsCalled = false;

            ShimQuoteItemEditorBase.AllInstances.LoadQuoteItemsQuoteItemCollection = (_, __) =>
            {
                loadQuoteItemsCalled = true;
            };

            var fireQuoteItemChangeEventCalled = false;

            ShimQuoteItemEditorBase.AllInstances.FireQuoteItemChangeEvent = (_) =>
            {
                fireQuoteItemChangeEventCalled = true;
            };

            var expectedCount     = _quoteItemCollection.Count;
            var expectedIndex     = _dataListEditItem.ItemIndex;
            var originalEventArgs = new CommandEventArgs(CommandNameUpdate, null);
            var eventArgs         = new DataListCommandEventArgs(_dataListEditItem, null, originalEventArgs);

            // Act
            _testEntityPrivate.Invoke(MethodNameDltEmailOptionsItemCommand, null, eventArgs);

            // Assert
            _quoteItemCollection.ShouldSatisfyAllConditions(
                () => _quoteItemCollection.Count.ShouldBe(expectedCount),
                () => _quoteItemCollection[expectedIndex].Name.ShouldBe(_quoteOption02.Name),
                () => _quoteItemCollection[expectedIndex].Code.ShouldBe(_quoteOption02.Code),
                () => _quoteItemCollection[expectedIndex].Description.ShouldBe(_quoteOption02.Description),
                () => _quoteItemCollection[expectedIndex].Rate.ShouldBe(Rate02),
                () => _quoteItemCollection[expectedIndex].Frequency.ShouldBe(Frequency02),
                () => _quoteItemCollection[expectedIndex].DiscountRate.ShouldBe(DiscountRate02 / 100),
                () => _dltEmailOptions.EditItemIndex.ShouldBe(-1),
                () => fireQuoteItemChangeEventCalled.ShouldBeTrue(),
                () => loadQuoteItemsCalled.ShouldBeTrue());
        }
        public void BtnAddClick_IfQuoteStatusDoesNotEqualToApproved_AddsQuoteItem()
        {
            // Arrange
            var optionsListItem02 = _ddlAddOptions.Items.FindByValue(_quoteOption02.Code);

            if (optionsListItem02 != null)
            {
                optionsListItem02.Selected = true;
            }

            var frequencyListItem02 = _ddlAddFrequency.Items.FindByValue(((int)Frequency02).ToString());

            if (frequencyListItem02 != null)
            {
                frequencyListItem02.Selected = true;
            }

            _txtAddRate.Text         = Rate02.ToString();
            _txtAddDiscountRate.Text = DiscountRate02.ToString();

            var loadQuoteItemsCalled = false;

            ShimQuoteItemEditorBase.AllInstances.LoadQuoteItemsQuoteItemCollection = (_, __) =>
            {
                loadQuoteItemsCalled = true;
            };

            var fireQuoteItemChangeEventCalled = false;

            ShimQuoteItemEditorBase.AllInstances.FireQuoteItemChangeEvent = (_) =>
            {
                fireQuoteItemChangeEventCalled = true;
            };

            var pendingQuote = new Quote(QuoteId)
            {
                Status = QuoteStatusEnum.Pending
            };

            _httpSessionState[QuoteSessionStateKey] = pendingQuote;

            var expectedCount = _quoteItemCollection.Count + 1;
            var expectedIndex = expectedCount - 1;

            // Act
            _testEntityPrivate.Invoke(MethodNameBtnAddClick, _btnAdd, EventArgs.Empty);

            // Assert
            _quoteItemCollection.ShouldSatisfyAllConditions(
                () => _quoteItemCollection.Count.ShouldBe(expectedCount),
                () => _quoteItemCollection[expectedIndex].Name.ShouldBe(_quoteOption02.Name),
                () => _quoteItemCollection[expectedIndex].Code.ShouldBe(_quoteOption02.Code),
                () => _quoteItemCollection[expectedIndex].Description.ShouldBe(_quoteOption02.Description),
                () => _quoteItemCollection[expectedIndex].Quantity.ShouldBe(_quoteOption02.Quantity),
                () => _quoteItemCollection[expectedIndex].LicenseType.ShouldBe(_quoteOption02.LicenseType),
                () => _quoteItemCollection[expectedIndex].PriceType.ShouldBe(_quoteOption02.PriceType),
                () => _quoteItemCollection[expectedIndex].Rate.ShouldBe(Rate02),
                () => _quoteItemCollection[expectedIndex].Frequency.ShouldBe(Frequency02),
                () => _quoteItemCollection[expectedIndex].DiscountRate.ShouldBe(DiscountRate02 / 100),
                () => fireQuoteItemChangeEventCalled.ShouldBeTrue(),
                () => loadQuoteItemsCalled.ShouldBeTrue());
        }