public void GetBase64CharSequenceTest_SimpleString_ReturnsStringOfLengthDivisableByFour() { // Given string simpleString = "Simple String Content"; // When string base64String = DexterUtil.GetBase64CharSequence(simpleString); // Then base64String = base64String.Trim(); Assert.IsTrue((base64String.Length % 4 == 0)); }
public void GetBase64CharSequenceTest_SimpleString_ReturnsStringContainingOnlyBase64Characters() { // Given string simpleString = "Simple String Content"; // When string base64String = DexterUtil.GetBase64CharSequence(simpleString); // Then base64String = base64String.Trim(); Assert.IsTrue(Regex.IsMatch(base64String, @"^[a-zA-Z0-9\+/]*={0,3}$", RegexOptions.None)); }
public async Task StoreSourceCodeCharSequence(long snapshotId, long groupId, string modulePath, string fileName, string sourcecode) { try { HttpResponseMessage response = await httpClient.PostAsJsonAsync(DexterConfig.POST_SNAPSHOT_SOURCECODE, new SourceCodeJsonFormat { SnapshotId = snapshotId, GroupId = groupId, ModulePath = modulePath, FileName = fileName, SourceCode = DexterUtil.GetBase64CharSequence(sourcecode) }); response.EnsureSuccessStatusCode(); } catch (Exception e) { CliLog.Error(e.StackTrace); } }