public async Task GetUploadedString()
        {
            string url = ApiPaths.ALGO_STORE_UPLOAD_STRING;

            MetaDataResponseDTO metadataWithUploadedString = DataManager.getMetaDataForBinaryUpload();

            string Algoid = metadataWithUploadedString.Id;

            PostUploadStringAlgoDTO uploadedStringDTO = new PostUploadStringAlgoDTO()
            {
                AlgoId = Algoid,
                Data   = Helpers.RandomString(300)
            };

            var responceUploadString = await this.Consumer.ExecuteRequest(url, Helpers.EmptyDictionary, JsonUtils.SerializeObject(uploadedStringDTO), Method.POST);

            Assert.That(responceUploadString.Status, Is.EqualTo(HttpStatusCode.NoContent));

            Dictionary <string, string> quaryParamGetString = new Dictionary <string, string>()
            {
                { "AlgoId", Algoid }
            };

            var responceGetUploadString = await this.Consumer.ExecuteRequest(url, quaryParamGetString, null, Method.GET);

            Assert.That(responceGetUploadString.Status, Is.EqualTo(HttpStatusCode.OK));

            UploadStringDTO uploadedStringContent = JsonUtils.DeserializeJson <UploadStringDTO>(responceGetUploadString.ResponseJson);

            Assert.That(uploadedStringDTO.Data, Is.EqualTo(uploadedStringContent.Data));
        }
Пример #2
0
        public async Task UploadStringBadRequest(string badID, string AlgoString)
        {
            string url = ApiPaths.ALGO_STORE_UPLOAD_STRING;

            string Algoid = badID;

            PostUploadStringAlgoDTO uploadedStringDTO = new PostUploadStringAlgoDTO()
            {
                AlgoId = Algoid,
                Data   = AlgoString
            };

            var responceUploadString = await this.Consumer.ExecuteRequest(url, Helpers.EmptyDictionary, JsonUtils.SerializeObject(uploadedStringDTO), Method.POST);

            Assert.That(responceUploadString.Status, Is.EqualTo(HttpStatusCode.BadRequest));
        }
Пример #3
0
        public async Task DeleteMetadataWithUpoadAlgoString()
        {
            MetaDataResponseDTO temporaryResponseDTO = DataManager.getMetadataForDelete();
            CascadeDeleteDTO    editMetaData         = new CascadeDeleteDTO()
            {
                Id   = temporaryResponseDTO.Id,
                Name = temporaryResponseDTO.Name
            };

            string url = ApiPaths.ALGO_STORE_UPLOAD_STRING;

            string Algoid = editMetaData.Id;

            PostUploadStringAlgoDTO uploadedStringDTO = new PostUploadStringAlgoDTO()
            {
                AlgoId = Algoid,
                Data   = Helpers.RandomString(300)
            };

            var responceUploadString = await this.Consumer.ExecuteRequest(url, Helpers.EmptyDictionary, JsonUtils.SerializeObject(uploadedStringDTO), Method.POST);

            Assert.That(responceUploadString.Status, Is.EqualTo(HttpStatusCode.NoContent));

            Dictionary <string, string> quaryParamGetString = new Dictionary <string, string>()
            {
                { "AlgoId", Algoid }
            };

            var responceGetUploadString = await this.Consumer.ExecuteRequest(url, quaryParamGetString, null, Method.GET);

            Assert.That(responceGetUploadString.Status, Is.EqualTo(HttpStatusCode.OK));

            UploadStringDTO uploadedStringContent = JsonUtils.DeserializeJson <UploadStringDTO>(responceGetUploadString.ResponseJson);

            Assert.That(uploadedStringDTO.Data, Is.EqualTo(uploadedStringContent.Data));

            url = ApiPaths.ALGO_STORE_CASCADE_DELETE;
            var responceCascadeDelete = await this.Consumer.ExecuteRequest(url, Helpers.EmptyDictionary, JsonUtils.SerializeObject(editMetaData), Method.POST);

            Assert.That(responceCascadeDelete.Status, Is.EqualTo(HttpStatusCode.NoContent));
            MetaDataEntity metaDataEntityDeleted = await MetaDataRepository.TryGetAsync(t => t.Id == editMetaData.Id) as MetaDataEntity;

            Assert.Null(metaDataEntityDeleted);
        }
        public async Task UploadString()
        {
            string url = ApiPaths.ALGO_STORE_UPLOAD_STRING;

            MetaDataResponseDTO metadataWithUploadedString = DataManager.getMetaDataForBinaryUpload();

            string Algoid = metadataWithUploadedString.Id;

            PostUploadStringAlgoDTO uploadedStringDTO = new PostUploadStringAlgoDTO()
            {
                AlgoId = Algoid,
                Data   = Helpers.RandomString(300)
            };

            var responceUploadString = await this.Consumer.ExecuteRequest(url, Helpers.EmptyDictionary, JsonUtils.SerializeObject(uploadedStringDTO), Method.POST);

            Assert.That(responceUploadString.Status, Is.EqualTo(HttpStatusCode.NoContent));

            bool blobExists = await this.BlobRepository.CheckIfBlobExists(Algoid, BinaryAlgoFileType.STRING);

            Assert.That(blobExists, Is.EqualTo(true));
        }