Ejemplo n.º 1
0
 public QualifyLeadCommand(CrmTestingContext crmContext, string alias, bool createAccount, bool createContact, bool createOpportunity) : base(crmContext)
 {
     _alias             = alias;
     _createAccount     = createAccount;
     _createContact     = createContact;
     _createOpportunity = createOpportunity;
 }
Ejemplo n.º 2
0
            public static OpportunityCloseHelper Create(CrmTestingContext crmContext, Table table, EntityReference opportunity)
            {
                var result = new OpportunityCloseHelper
                {
                    Entity = new Entity("opportunityclose")
                };

                result.Entity.Attributes["opportunityid"] = opportunity;
                foreach (var row in table.Rows)
                {
                    if (row[Constants.SpecFlow.TABLE_KEY] == "opportunitystatuscode")
                    {
                        result.StatusReasonText = row[Constants.SpecFlow.TABLE_VALUE];
                        var setStateRequest = ObjectConverter.ToSetStateRequest(opportunity, result.StatusReasonText, crmContext);
                        result.StatusReasonNumber = setStateRequest.Status.Value;
                        result.Win = setStateRequest.State.Value == 1;
                    }
                    else
                    {
                        result.Entity[row[Constants.SpecFlow.TABLE_KEY]] =
                            ObjectConverter.ToCrmObject(result.Entity.LogicalName, row[Constants.SpecFlow.TABLE_KEY],
                                                        row[Constants.SpecFlow.TABLE_VALUE], crmContext);
                    }
                }

                return(result);
            }
Ejemplo n.º 3
0
 public AssertFormNotificationsCommand(CrmTestingContext crmContext, SeleniumTestingContext seleniumContext, string alias,
                                       Table notificationTable)
     : base(crmContext, seleniumContext)
 {
     _alias             = alias;
     _notificationTable = notificationTable;
 }
Ejemplo n.º 4
0
 public UpdateRecordCommand(CrmTestingContext crmContext, SeleniumTestingContext seleniumContext, EntityReference toUpdate,
                            Table criteria)
     : base(crmContext, seleniumContext)
 {
     _toUpdate = toUpdate;
     _criteria = criteria;
 }
Ejemplo n.º 5
0
 public ClickSubgridButtonCommand(CrmTestingContext crmContext, SeleniumTestingContext seleniumContext,
                                  string parentAlias, string tabName, string subgridName, string gridButtonId) : base(crmContext, seleniumContext)
 {
     _parentAlias  = parentAlias;
     _tabName      = tabName;
     _subgridName  = subgridName;
     _gridButtonId = gridButtonId;
 }
Ejemplo n.º 6
0
 public QuickCreateTestCommand(CrmTestingContext crmContext, SeleniumTestingContext seleniumContext,
                               string contactAlias, string accountAlias, Table contactCriteria)
     : base(crmContext, seleniumContext)
 {
     _contactAlias    = contactAlias;
     _accountAlias    = accountAlias;
     _contactCriteria = contactCriteria;
 }
Ejemplo n.º 7
0
 public CreateRecordCommand(CrmTestingContext crmContext, SeleniumTestingContext seleniumContext,
                            string entityLogicalName, Table criteria, string alias)
     : base(crmContext, seleniumContext)
 {
     _entityLogicalName = entityLogicalName;
     _criteria          = criteria;
     _alias             = alias;
 }
Ejemplo n.º 8
0
        public virtual void SetValue(CrmTestingContext crmContext, string fieldValueText)
        {
            object fieldValue = ObjectConverter.ToCrmObject(Metadata.EntityLogicalName, Metadata.LogicalName, fieldValueText, crmContext);

            Logger.WriteLine($"Setting field value");
            switch (Metadata.AttributeType.Value)
            {
            case AttributeTypeCode.Boolean:
                SetTwoOptionField(new BooleanValue((bool?)fieldValue));
                break;

            case AttributeTypeCode.DateTime:
                SetDateTimeField(new DateTimeValue((DateTimeAttributeMetadata)Metadata, (DateTime?)fieldValue));
                break;

            case AttributeTypeCode.Customer:
            case AttributeTypeCode.Lookup:
                SetLookupValue(new LookupValue((EntityReference)fieldValue));
                break;

            case AttributeTypeCode.Picklist:
                SetOptionSetField(new FieldTypes.OptionSetValue(((Microsoft.Xrm.Sdk.OptionSetValue)fieldValue)?.Value, fieldValueText));
                break;

            case AttributeTypeCode.Money:
                SetMoneyField(new DecimalValue(((Money)fieldValue)?.Value));
                break;

            case AttributeTypeCode.Virtual:
                SetVirtualField(fieldValueText);
                break;

            case AttributeTypeCode.Integer:
                SetIntegerField(new IntegerValue((int?)fieldValue));
                break;

            case AttributeTypeCode.Double:
                SetDoubleField(new DoubleValue((double?)fieldValue));
                break;

            case AttributeTypeCode.BigInt:
                SetLongField(new LongValue((long?)fieldValue));
                break;

            case AttributeTypeCode.Decimal:
                SetDecimalField(new DecimalValue((decimal?)fieldValue));
                break;

            default:
                SetTextField((string)fieldValue);
                break;
            }
        }
Ejemplo n.º 9
0
        public void SetValue(CrmTestingContext crmContext, string fieldValueText)
        {
            object fieldValue = ObjectConverter.ToCrmObject(Metadata.EntityLogicalName, Metadata.LogicalName, fieldValueText, crmContext);

            if (fieldValue != null)
            {
                Logger.WriteLine($"Setting field value");
                switch (Metadata.AttributeType.Value)
                {
                case AttributeTypeCode.Boolean:
                    SetTwoOptionField((bool)fieldValue, fieldValueText);
                    break;

                case AttributeTypeCode.DateTime:
                    SetDateTimeField((DateTime)fieldValue, fieldValueText);
                    break;

                case AttributeTypeCode.Customer:
                case AttributeTypeCode.Lookup:
                    SetLookupValue((EntityReference)fieldValue, fieldValueText);
                    break;

                case AttributeTypeCode.Picklist:
                    SetOptionSetField((OptionSetValue)fieldValue, fieldValueText);
                    break;

                case AttributeTypeCode.Money:
                    SetMoneyField((Money)fieldValue, fieldValueText);
                    break;

                case AttributeTypeCode.Virtual:
                    SetVirtualField(fieldValueText);
                    break;

                case AttributeTypeCode.Integer:
                case AttributeTypeCode.Double:
                case AttributeTypeCode.BigInt:
                case AttributeTypeCode.Decimal:
                    SetTextField(fieldValueText);
                    break;

                default:
                    SetTextField((string)fieldValue);
                    break;
                }
            }
            else
            {
                Logger.WriteLine($"Clearing field value");
                ClearValue();
            }
        }
        public void EnterData(CrmTestingContext crmContext, Table closeData)
        {
            foreach (var row in closeData.Rows)
            {
                var attribute = _entityMetadata.Attributes.FirstOrDefault(a => a.LogicalName == row[Constants.SpecFlow.TABLE_KEY]);
                if (attribute == null)
                {
                    throw new TestExecutionException(Constants.ErrorCodes.ATTRIBUTE_DOESNT_EXIST, row[Constants.SpecFlow.TABLE_KEY], _entityMetadata.LogicalName);
                }

                OpportunityCloseDialogField field = new OpportunityCloseDialogField(_app, attribute);
                field.SetValue(crmContext, row[Constants.SpecFlow.TABLE_VALUE]);
            }
        }
Ejemplo n.º 11
0
        public void FillForm(CrmTestingContext crmContext, Table formData)
        {
            Logger.WriteLine($"Filling form");
            var formState = new FormState(_app);

            foreach (var row in formData.Rows)
            {
                Assert.IsTrue(ContainsField(row[Constants.SpecFlow.TABLE_KEY]), $"Field {row[Constants.SpecFlow.TABLE_KEY]} isn't on the form");
                var field = _formFields[row[Constants.SpecFlow.TABLE_KEY]];
                Assert.IsTrue(field.IsVisible(formState), $"Field {row[Constants.SpecFlow.TABLE_KEY]} isn't visible");
                Assert.IsFalse(field.IsLocked(formState), $"Field {row[Constants.SpecFlow.TABLE_KEY]} is read-only");

                field.SetValue(crmContext, row[Constants.SpecFlow.TABLE_VALUE]);
            }
        }
Ejemplo n.º 12
0
        public void FillForm(CrmTestingContext crmContext, Table formData)
        {
            Logger.WriteLine($"Filling form");
            string currentTab = null;

            foreach (var row in formData.Rows)
            {
                Assert.IsTrue(ContainsField(row[Constants.SpecFlow.TABLE_KEY]), $"Field {row[Constants.SpecFlow.TABLE_KEY]} isn't on the form");
                var field = _formFields[row[Constants.SpecFlow.TABLE_KEY]];

                var newTab = field.GetTabName();
                if (string.IsNullOrWhiteSpace(currentTab) || currentTab != newTab)
                {
                    ExpandTab(field.GetTabLabel());
                    currentTab = newTab;
                }

                field.SetValue(crmContext, row[Constants.SpecFlow.TABLE_VALUE]);
            }
        }
Ejemplo n.º 13
0
 public GetRecordsCommand(CrmTestingContext crmContext, string entityName, Table criteria) : base(crmContext)
 {
     _entityName = entityName;
     _criteria   = criteria;
 }
Ejemplo n.º 14
0
 public FormulaHooks(CrmTestingContext crmContext, FormulaContext formulaContext)
 {
     _crmContext     = crmContext;
     _formulaContext = formulaContext;
 }
Ejemplo n.º 15
0
 public SetLookupAsAliasCommand(CrmTestingContext crmContext, string alias, string lookupFieldName, string lookupAlias) : base(crmContext)
 {
     _alias           = alias;
     _lookupFieldName = lookupFieldName;
     _lookupAlias     = lookupAlias;
 }
 public MoveToNextBusinessProcessStageCommand(CrmTestingContext crmContext, string alias) : base(crmContext)
 {
     _alias = alias;
 }
Ejemplo n.º 17
0
 public AssertFormStateCommand(CrmTestingContext crmContext, SeleniumTestingContext seleniumContext, EntityReference crmRecord, Table visibilityCriteria) :
     base(crmContext, seleniumContext)
 {
     _crmRecord          = crmRecord;
     _visibilityCriteria = visibilityCriteria;
 }
Ejemplo n.º 18
0
 public UnitTestSteps(CrmTestingContext crmContext, SeleniumTestingContext seleniumContext)
 {
     _crmContext      = crmContext;
     _seleniumContext = seleniumContext;
 }
 public MoveToBusinessProcessStageCommand(CrmTestingContext crmContext, string alias, string stageName) : base(crmContext)
 {
     this._alias     = alias;
     this._stageName = stageName;
 }
Ejemplo n.º 20
0
 public AssertRibbonStateCommand(CrmTestingContext crmContext, SeleniumTestingContext seleniumContext, string alias, Table ribbonState)
     : base(crmContext, seleniumContext)
 {
     _alias       = alias;
     _ribbonState = ribbonState;
 }
Ejemplo n.º 21
0
 public AssignRecordCommand(CrmTestingContext crmContext, string aliasToAssign, string aliasToAssignTo) : base(crmContext)
 {
     _aliasToAssign   = aliasToAssign;
     _aliasToAssignTo = aliasToAssignTo;
 }
Ejemplo n.º 22
0
 public WaitForAsyncJobsCommand(CrmTestingContext crmContext, string alias) : base(crmContext)
 {
     _alias = alias;
 }
Ejemplo n.º 23
0
 public OpportunitySteps(CrmTestingContext crmContext, SeleniumTestingContext selenumContext)
 {
     _crmContext     = crmContext;
     _selenumContext = selenumContext;
 }
Ejemplo n.º 24
0
 public AssertErrorDialogCommand(CrmTestingContext crmContext, SeleniumTestingContext seleniumContext, string expectedError)
     : base(crmContext, seleniumContext)
 {
     _expectedError = expectedError;
 }
Ejemplo n.º 25
0
 public BrowserOnlyCommandFunc(CrmTestingContext crmContext, SeleniumTestingContext seleniumContext)
 {
     _crmContext      = crmContext;
     _seleniumContext = seleniumContext;
 }
 public GetCurrentUserSettingsCommand(CrmTestingContext crmContext, string userAlias)
     : base(crmContext)
 {
     _userAlias = userAlias;
 }
Ejemplo n.º 27
0
 public GeneralSteps(CrmTestingContext crmContext, SeleniumTestingContext seleniumContext)
 {
     _crmContext      = crmContext;
     _seleniumContext = seleniumContext;
 }
Ejemplo n.º 28
0
 public ReviseQuoteCommand(CrmTestingContext crmContext, SeleniumTestingContext selenumContext, string toReviseAlias, string newQuoteAlias)
     : base(crmContext, selenumContext)
 {
     _toReviseAlias = toReviseAlias;
     _newQuoteAlias = newQuoteAlias;
 }
Ejemplo n.º 29
0
 public ActivateQuoteCommand(CrmTestingContext crmContext, SeleniumTestingContext selenumContext, string alias)
     : base(crmContext, selenumContext)
 {
     _alias = alias;
 }
Ejemplo n.º 30
0
 public CloseOpportunityCommand(CrmTestingContext crmContext, SeleniumTestingContext seleniumContext,
                                string alias, Table closeData) : base(crmContext, seleniumContext)
 {
     _alias     = alias;
     _closeData = closeData;
 }