Пример #1
0
        public async Task NewTraceUploadTest()
        {
            await NewTraceTest();

            IDictionary <string, object> data = new Dictionary <string, object>();

            data.Add("documents", new Identifiable[] { FileWrapper.FromFilePath(GetTestFilePath()) });

            AppendLinkInput <object>    appLinkInput = new AppendLinkInput <object>(config.UPLOAD_DOCUMENTS_ACTION_KEY, data, someTraceState.TraceId);
            TraceState <object, object> state        = await GetOtherGroupSdk().AppendLinkAsync <object>(appLinkInput);

            Assert.NotNull(state.TraceId);
            traceStateWithFile = state;
        }
Пример #2
0
        public async Task NewTraceUploadInClassTest()
        {
            await NewTraceTestWithPojo();

            UploadDocumentsClass data = new UploadDocumentsClass();

            data.documents = new Identifiable[] { FileWrapper.FromFilePath(GetTestFilePath()) };
            data.comment   = "upload comment";

            AppendLinkInput <UploadDocumentsClass>          appLinkInput = new AppendLinkInput <UploadDocumentsClass>(config.UPLOAD_DOCUMENTS_ACTION_KEY, data, initTraceState.TraceId);
            TraceState <StateExample, UploadDocumentsClass> state        = await GetOtherGroupSdk <StateExample>().AppendLinkAsync(appLinkInput);

            Assert.NotNull(state.TraceId);
        }
Пример #3
0
        public async Task UploadFilesInLinkDataTest()
        {
            await NewTraceTest();

            IDictionary <string, object> data = new Dictionary <string, object>
            {
                ["comment"] = "upload file comment"
            };

            data.Add("documents", new Identifiable[] { FileWrapper.FromFilePath(GetTestFilePath()) });

            await GetOtherGroupSdk().UploadFilesInLinkData(data);

            Assert.True(FileRecord.IsFileRecord(((object[])data["documents"])[0]));

            Debug.WriteLine(JsonHelper.ToJson(data));
        }
Пример #4
0
        public async Task NewTraceUploadInClassTest()
        {
            Sdk <Object> sdk = GetSdk <Object>();

            Step s = new Step();

            s.data = new StepData();
            s.data.stp_form_section = new Identifiable[] { FileWrapper.FromFilePath(Path.GetFullPath("../../Resources/TestFile1.txt")) };


            NewTraceInput <Step> newTraceInput = new NewTraceInput <Step>(FORM_ID, s);

            TraceState <object, Step> state = await sdk.NewTraceAsync <Step>(newTraceInput);

            Assert.IsNotNull(state.TraceId);
            Debug.WriteLine(state.TraceId);
        }
Пример #5
0
        public async Task ImportDataCsvTest()
        {
            await NewTraceTestWithPojo();

            ImportTaClass data = new ImportTaClass();
            // dirty simulate loading from csv
            string json = "[{ reference: \"reference\", entityName: \"entity\", currency: \"EUR\", amount: 500, endDate: \"2020-06-25\"},"
                          + "{reference: \"reference 2\", entityName: \"entity 2\", currency: \"EUR\", amount: 1300, endDate: \"2020-06-28\""
                          + "}]";

            data.taSummary = JsonHelper.FromJson <Object>(json);
            data.file      = FileWrapper.FromFilePath(GetTaFilePath());

            AppendLinkInput <ImportTaClass>          appLinkInput = new AppendLinkInput <ImportTaClass>(config.IMPORT_TA_ACTION_KEY, data, initTraceState.TraceId);
            TraceState <StateExample, ImportTaClass> state        = await GetSdk <StateExample>().AppendLinkAsync <ImportTaClass>(appLinkInput);

            Assert.NotNull(state.TraceId);
        }
Пример #6
0
        public async Task ImportDataCsvTest()
        {
            await NewTraceTest();

            IDictionary <string, object> data = new Dictionary <string, object>();

            // dirty simulate loading from csv
            IDictionary <string, object> taSummary = new Dictionary <string, object>();
            string json = "[{ reference: \"reference\", entityName: \"entity\", currency: \"EUR\", amount: 500, endDate: \"2020-06-25\"},"
                          + "{reference: \"reference 2\", entityName: \"entity 2\", currency: \"EUR\", amount: 1300, endDate: \"2020-06-28\""
                          + "}]";

            data.Add("taSummary", JsonHelper.FromJson <Object>(json));
            data.Add("file", FileWrapper.FromFilePath(GetTaFilePath()));

            AppendLinkInput <object>    appLinkInput = new AppendLinkInput <object>(config.IMPORT_TA_ACTION_KEY, data, someTraceState.TraceId);
            TraceState <object, object> state        = await GetSdk().AppendLinkAsync <object>(appLinkInput);

            Assert.NotNull(state.TraceId);
        }
Пример #7
0
        public async Task NewTraceUploadTest()
        {
            Sdk <Object> sdk = GetSdk();

            IDictionary <string, object> data = new Dictionary <string, object>
            {
                ["weight"]    = "123",
                ["valid"]     = true,
                ["operators"] = new string[] { "1", "2" },
                ["operation"] = "my new operation 1"
            };

            data.Add("Certificate1", FileWrapper.FromFilePath(Path.GetFullPath("../../Resources/TestFile1.txt")));
            data.Add("Certificates", new Identifiable[] { FileWrapper.FromFilePath(Path.GetFullPath("../../Resources/TestFile1.txt")) });

            NewTraceInput <Object> newTraceInput = new NewTraceInput <Object>(FORM_ID, data);

            TraceState <object, object> state = await sdk.NewTraceAsync <object>(newTraceInput);

            Assert.IsNotNull(state.TraceId);
            someTraceState = state;
        }