Пример #1
0
        public void ReadValidTests(ResourceId resourceId, ValidReadId id, ValidSelect select)
        {
            var systemField = GetSytemFieldUuidByFieldType(resourceId, Commons.FieldTypeAPI);
            var userFields  = PrepareUserField.Data[resourceId].ToArray();
            var appFields   = PrepareAppField.Data[resourceId].ToArray();
            var ids         = ValidReadUUIDMapperValue[id]($"{userFields[0]}", $"{ userFields[1]}", $"{appFields[0]}", $"{appFields[0]}", systemField);

            ids.AddRange(Selects.SelectMapperValue[select]);
            ExecuteReadTest(ids, select);
        }
Пример #2
0
        public void ReadInvalidSpecialTests(ResourceId resourceId, ValidReadId id, InvalidRead testcase)
        {
            var systemField = GetSytemFieldUuidByFieldType(resourceId, Commons.FieldTypeAPI);
            var userFields  = PrepareUserField.Data[resourceId].ToArray();
            var appFields   = PrepareAppField.Data[resourceId].ToArray();
            var ids         = ValidReadUUIDMapperValue[id]($"{userFields[0]}", $"{ userFields[1]}", $"{appFields[0]}", $"{appFields[0]}", systemField);

            InvalidReadMapperValue[testcase](PrepareDeletedField.Data[resourceId].ToString(), ids);
            var manager = new DefaultManager();
            var result  = manager.Send(FieldManager.FieldHandlingRelativeUrl, ids, HttpMethod.GET);

            PrAssert.That(result, PrIs.ErrorResponse().And.HttpCode(System.Net.HttpStatusCode.BadRequest), "Still read field successfull");
        }
Пример #3
0
        public void TestReadFieldInvalid(ResourceId resource, ValidReadId validReadId, InvalidRead invalidRead)
        {
            var firstUuidUser  = FirstGuidsForRead[resource].Values.First().ToString();
            var secondUuidUser = SecondGuidsForRead[resource].Values.Last().ToString();
            var deletedUuid    = GuidsForDelete[resource].Values.First().ToString();

            var request = ValidReadUUIDMapperValue[validReadId](firstUuidUser, secondUuidUser, string.Empty, string.Empty, string.Empty);

            InvalidReadMapperValue[invalidRead](deletedUuid, request);

            var handler  = new DefaultManager();
            var response = handler.Send <FieldDetailsResponseItem>(FieldManager.FieldHandlingRelativeUrl, request, HttpMethod.GET);

            PrAssert.That(response, PrIs.ErrorResponse().And.HttpCode(System.Net.HttpStatusCode.BadRequest));
        }
Пример #4
0
        public void TestReadFieldInvalid(ResourceId resource, ValidReadId validReadId, InvalidRead invalidRead)
        {
            var firstUuidUser  = FieldsCreator.Data[$"{resource}-{Defines.FieldTypeApi.ToString()}-0"].Guid.ToString();
            var secondUuidUser = FieldsCreator.Data[$"{resource}-{Defines.FieldTypeApi.ToString()}-1"].Guid.ToString();
            var firstUuidApp   = TextHelpers.Guid[TextHelpers.FieldTypes.Application](resource, null, Defines.FieldTypeApi, TextHelpers.ApplicationFieldNames[Defines.FieldTypeApi]().First()).ToString();
            var secondUuidApp  = TextHelpers.Guid[TextHelpers.FieldTypes.Application](resource, null, Defines.FieldTypeApi, TextHelpers.ApplicationFieldNames[Defines.FieldTypeApi]().Last()).ToString();
            var deletedUuid    = FieldsCreator.Data[$"{resource}-{Defines.FieldTypeApi.ToString()}-2"].Guid.ToString();

            var request = ValidReadUUIDMapperValue[validReadId](firstUuidUser, secondUuidUser, firstUuidApp, secondUuidApp, SystemFields.GetSytemFieldUuidByFieldType(resource, FieldType.SingleLineText));

            InvalidReadMapperValue[invalidRead](deletedUuid, request);

            var handler  = new DefaultManager();
            var response = handler.Send <FieldDetailsResponseItem>(FieldManager.FieldHandlingRelativeUrl, request, HttpMethod.GET);

            PrAssert.That(response, PrIs.ErrorResponse().And.HttpCode(System.Net.HttpStatusCode.BadRequest));
        }
Пример #5
0
        public void TestReadFieldValid(ResourceId resource, ValidReadId validReadId, Selects.ValidSelect select)
        {
            var firstUuidUser  = FirstGuidsForRead[resource].Values.First().ToString();
            var secondUuidUser = SecondGuidsForRead[resource].Values.Last().ToString();

            var idParams = ValidReadUUIDMapperValue[validReadId](firstUuidUser, secondUuidUser, string.Empty, string.Empty, string.Empty);
            var sel      = Selects.SelectMapperValue[select];
            var request  = new List <KeyValuePair <string, string> >();

            request.AddRange(idParams);
            request.AddRange(sel);
            var handler  = new DefaultManager();
            var response = handler.Send <FieldDetailsResponse>(FieldManager.FieldHandlingRelativeUrl, request, HttpMethod.GET);

            PrAssert.That(response, PrIs.SuccessfulResponse().And.HttpCode(System.Net.HttpStatusCode.OK));

            //Verify
            Selects.VerifyContainExpectedSelect(response.Result, select);
        }
Пример #6
0
        public void TestReadFieldValid(ResourceId resource, ValidReadId validReadId, Selects.ValidSelect select)
        {
            var firstUuidUser  = FieldsCreator.Data[$"{resource}-{Defines.FieldTypeApi.ToString()}-0"].Guid.ToString();
            var secondUuidUser = FieldsCreator.Data[$"{resource}-{Defines.FieldTypeApi.ToString()}-1"].Guid.ToString();
            var firstUuidApp   = TextHelpers.Guid[TextHelpers.FieldTypes.Application](resource, null, Defines.FieldTypeApi, TextHelpers.ApplicationFieldNames[Defines.FieldTypeApi]().First()).ToString();
            var secondUuidApp  = TextHelpers.Guid[TextHelpers.FieldTypes.Application](resource, null, Defines.FieldTypeApi, TextHelpers.ApplicationFieldNames[Defines.FieldTypeApi]().Last()).ToString();

            var idParams = ValidReadUUIDMapperValue[validReadId](firstUuidUser, secondUuidUser, firstUuidApp, secondUuidApp, SystemFields.GetSytemFieldUuidByFieldType(resource, FieldType.SingleLineText));
            var sel      = Selects.SelectMapperValue[select];
            var request  = new List <KeyValuePair <string, string> >();

            request.AddRange(idParams);
            request.AddRange(sel);
            var handler  = new DefaultManager();
            var response = handler.Send <FieldDetailsResponse>(FieldManager.FieldHandlingRelativeUrl, request, HttpMethod.GET);

            PrAssert.That(response, PrIs.SuccessfulResponse().And.HttpCode(System.Net.HttpStatusCode.OK));

            //Verify
            Selects.VerifyContainExpectedSelect(response.Result, select);
        }