Example #1
0
        public void GetAttributeValueFromCsv()
        {
            string itemType   = "integer";
            string lookUpType = string.Empty;
            object input      = 5;

            var actual = (int)EntityConverterHelper.GetAttributeValueFromCsv(itemType, lookUpType, input);

            actual.Should().Be(5);
        }
Example #2
0
        public void GetAttributeValueFromCsvOptionSetValue()
        {
            string itemType   = "optionsetvalue";
            string lookUpType = string.Empty;
            object input      = 5;

            var actual = (OptionSetValue)EntityConverterHelper.GetAttributeValueFromCsv(itemType, lookUpType, input);

            actual.Value.Should().Be(5);
        }
Example #3
0
        public void GetAttributeValueFromCsvString()
        {
            string itemType   = "string";
            string lookUpType = string.Empty;
            object input      = "Joe";

            var actual = EntityConverterHelper.GetAttributeValueFromCsv(itemType, lookUpType, input);

            actual.ToString().Should().Be("Joe");
        }
Example #4
0
        public void GetAttributeValueFromCsvNullInput()
        {
            string itemType   = string.Empty;
            string lookUpType = string.Empty;
            object input      = null;

            var actual = EntityConverterHelper.GetAttributeValueFromCsv(itemType, lookUpType, input);

            actual.Should().BeNull();
        }
Example #5
0
        public void GetAttributeValueFromCsvEntityreference()
        {
            var    id         = Guid.NewGuid();
            var    entityName = "account";
            string itemType   = "entityreference";
            string lookUpType = entityName;
            object input      = id;

            var actual = (EntityReference)EntityConverterHelper.GetAttributeValueFromCsv(itemType, lookUpType, input);

            actual.Id.ToString().Should().Be(id.ToString());
            actual.LogicalName.Should().Be(entityName);
        }
Example #6
0
        public void GetAttributeValueFromCsvOptionSetValueCollection()
        {
            string itemType   = "optionsetvaluecollection";
            string lookUpType = string.Empty;
            object input      = "3|13|5";

            var actual = (OptionSetValueCollection)EntityConverterHelper.GetAttributeValueFromCsv(itemType, lookUpType, input);

            actual.Count.Should().Be(3);
            FluentActions.Invoking(() => actual.Single(a => a.Value == 13))
            .Should()
            .NotThrow();
            FluentActions.Invoking(() => actual.Single(a => a.Value == 3))
            .Should()
            .NotThrow();
            FluentActions.Invoking(() => actual.Single(a => a.Value == 5))
            .Should()
            .NotThrow();
        }