Exemplo n.º 1
0
        public static void UpdateListItem(Enums.ResourceType resourceType, string fieldAlias, ScaleInvalidInput valueType, HrbcRecordCreator records, HrbcRecordDelete cleaner)
        {
            var fieldValue = WriteScaleInvalidInput.GetDataInput(valueType);

            IEnumerable <XmlResource> resourceList = new List <XmlResource>
            {
                ResourceHelper.CreateResourceInstance(records, resourceType, 0),
                ResourceHelper.CreateResourceInstance(records, resourceType, 1)
            };

            List <WriteResultItem> ids = ResourceHelper.WriteResources(resourceType, resourceList, cleaner);

            Assume.That(ids, Is.Not.Null.And.Not.Empty, string.Format(Enums.Message.CREATE_RESOURCE_ENTRY_FAILED, resourceType));
            Assume.That(ids.Select(t => t.Code), Is.All.EqualTo(0), string.Format(Enums.Message.CREATE_RESOURCE_ENTRY_FAILED, resourceType));

            resourceList = ids.Select(item =>
            {
                return(ResourceHelper.CreateUpdatedResource(resourceType, item.Id, fieldAlias, fieldValue));
            });

            ErrorCode result = ResourceHelper.WriteResourcesFail(resourceList);

            Assert.That(result, Is.Not.Null, string.Format(Enums.Message.UPDATE_RESOURCE_ENTRY_FAILED, resourceType));
            Assert.That(result.Code, Is.EqualTo(Enums.PublicAPIResultCode.InvalidParameterValue), Enums.Message.WRONG_ERROR_CODE);
        }
Exemplo n.º 2
0
        public static void CreateSingleItem(Enums.ResourceType resourceType, string fieldAlias, ScaleInvalidInput valueType, HrbcRecordCreator records, HrbcRecordDelete cleaner)
        {
            var fieldValue = WriteScaleInvalidInput.GetDataInput(valueType);

            XmlResource resource = ResourceHelper.CreateResourceInstance(records, resourceType);

            resource.DictionaryValues[fieldAlias] = fieldValue;
            var error = ResourceHelper.WriteResourceFail(resource, cleaner);

            Assert.That(error, Is.Not.Null, string.Format(Enums.Message.CREATE_RESOURCE_ENTRY_FAILED, resourceType));
            Assert.That(error.Code, Is.EqualTo(Enums.PublicAPIResultCode.InvalidParameterValue), Enums.Message.WRONG_ERROR_CODE);
        }
Exemplo n.º 3
0
        //Invalid
        public static void CreateListItem(Enums.ResourceType resourceType, string fieldAlias, ScaleInvalidInput valueType, HrbcRecordCreator records, HrbcRecordDelete cleaner)
        {
            var fieldValue = WriteScaleInvalidInput.GetDataInput(valueType);

            var resourceList = new[] { 0, 1 }.Select(depKey =>
            {
                var resource = ResourceHelper.CreateResourceInstance(records, resourceType, depKey);
                resource.DictionaryValues[fieldAlias] = fieldValue;
                return(resource);
            }).ToList();

            ErrorCode result = ResourceHelper.WriteResourcesFail(resourceList, cleaner);

            Assert.That(result, Is.Not.Null, string.Format(Enums.Message.CREATE_RESOURCE_ENTRY_FAILED, resourceType));
            Assert.That(result.Code, Is.EqualTo(Enums.PublicAPIResultCode.InvalidParameterValue), Enums.Message.WRONG_ERROR_CODE);
        }