Beispiel #1
0
        /// <summary>
        /// Verify that:
        ///   CSfunc_GetTestData clears any potential existing data
        ///   CSfunc_SaveTestData adds test data
        ///   CSfunc_TestDataExists can correctly verify both states
        /// </summary>
        // [UUnitTest]
        public void WriteTestSequence(UUnitTestContext testContext)
        {
            bool   functionResult, callResult;
            string getErrorReport, saveErrorReport, fetchErrorReport;

            TestSuiteReport[] testResults;
            object            nullReturn;

            // Reset a previous test if relevant
            callResult = CloudScriptListener.ExecuteCloudScript(CloudScriptListener.CsFuncGetTestData, getRequest, testTitleData.extraHeaders, out testResults, out fetchErrorReport);
            //UUnitAssert.True(callResult, fetchErrorReport);

            // Verify that no data pre-exists
            callResult = CloudScriptListener.ExecuteCloudScript(CloudScriptListener.CsFuncTestDataExists, getRequest, testTitleData.extraHeaders, out functionResult, out getErrorReport);
            testContext.True(callResult, getErrorReport);
            testContext.False(functionResult, getErrorReport);

            // Save some data
            callResult = CloudScriptListener.ExecuteCloudScript(CloudScriptListener.CsFuncSaveTestData, saveRequest, testTitleData.extraHeaders, out nullReturn, out saveErrorReport);
            testContext.True(callResult, saveErrorReport);

            // Verify that the saved data exists
            callResult = CloudScriptListener.ExecuteCloudScript(CloudScriptListener.CsFuncTestDataExists, getRequest, testTitleData.extraHeaders, out functionResult, out getErrorReport);
            testContext.True(callResult, getErrorReport);
            testContext.True(functionResult, saveErrorReport);

            // Fetch that data
            callResult = CloudScriptListener.ExecuteCloudScript(CloudScriptListener.CsFuncGetTestData, getRequest, testTitleData.extraHeaders, out testResults, out fetchErrorReport);
            testContext.True(callResult, fetchErrorReport);
            testContext.NotNull(testResults, fetchErrorReport);

            // Verify that it was consumed
            callResult = CloudScriptListener.ExecuteCloudScript(CloudScriptListener.CsFuncTestDataExists, getRequest, testTitleData.extraHeaders, out functionResult, out getErrorReport);
            testContext.True(callResult, getErrorReport);
            testContext.False(functionResult, getErrorReport);

            testContext.EndTest(UUnitFinishState.PASSED, null);
        }
        public void WriteTestSequence()
        {
            bool   functionResult, callResult;
            string getErrorReport, saveErrorReport, fetchErrorReport;

            TestSuiteReport[] testResults;
            object            nullReturn;

            // Reset a previous test if relevant
            callResult = CloudScriptListener.ExecuteCloudScript(CloudScriptListener.CSfunc_GetTestData, getRequest, out testResults, out fetchErrorReport);
            UUnitAssert.True(callResult, fetchErrorReport);

            // Verify that no data pre-exists
            callResult = CloudScriptListener.ExecuteCloudScript(CloudScriptListener.CSfunc_TestDataExists, getRequest, out functionResult, out getErrorReport);
            UUnitAssert.True(callResult, getErrorReport);
            UUnitAssert.False(functionResult, getErrorReport);

            // Save some data
            callResult = CloudScriptListener.ExecuteCloudScript(CloudScriptListener.CSfunc_SaveTestData, saveRequest, out nullReturn, out saveErrorReport);
            UUnitAssert.True(callResult, saveErrorReport);

            // Verify that the saved data exists
            callResult = CloudScriptListener.ExecuteCloudScript(CloudScriptListener.CSfunc_TestDataExists, getRequest, out functionResult, out getErrorReport);
            UUnitAssert.True(callResult, getErrorReport);
            UUnitAssert.True(functionResult, saveErrorReport);

            // Fetch that data
            callResult = CloudScriptListener.ExecuteCloudScript(CloudScriptListener.CSfunc_GetTestData, getRequest, out testResults, out fetchErrorReport);
            UUnitAssert.True(callResult, fetchErrorReport);
            UUnitAssert.NotNull(testResults, fetchErrorReport);

            // Verify that it was consumed
            callResult = CloudScriptListener.ExecuteCloudScript(CloudScriptListener.CSfunc_TestDataExists, getRequest, out functionResult, out getErrorReport);
            UUnitAssert.True(callResult, getErrorReport);
            UUnitAssert.False(functionResult, getErrorReport);
        }