diff --git a/TestData/Integration/xslt/compiled/sample-inline-cs-auto-instrument.xslt b/TestData/Integration/xslt/compiled/sample-inline-cs-auto-instrument.xslt index 065ba19..1c47c09 100644 --- a/TestData/Integration/xslt/compiled/sample-inline-cs-auto-instrument.xslt +++ b/TestData/Integration/xslt/compiled/sample-inline-cs-auto-instrument.xslt @@ -9,6 +9,49 @@ using System; using System.Globalization; public class MathHelper { + // Private fields + private int counter = 0; + private string prefix = "Result: "; + private double multiplier = 2.5; + private int[] cachedValues = new int[] { 10, 20, 30, 40, 50 }; + + // Methods using private variables + public int IncrementCounter() { + counter++; + return counter; + } + + public int GetCounterValue() { + return counter; + } + + public string GetPrefixedMessage(string message) { + string result = prefix + message; + return result; + } + + public double ApplyMultiplier(double value) { + double result = value * multiplier; + return result; + } + + public int GetCachedValue(int index) { + if (index >= 0 && index < cachedValues.Length) { + int value = cachedValues[index]; + return value; + } + return -1; + } + + public int SumCachedValues() { + int sum = 0; + for (int i = 0; i < cachedValues.Length; i++) { + sum += cachedValues[i]; + } + return sum; + } + + // Integer operations public int Add(int a, int b) { return a + b; } @@ -21,6 +64,142 @@ public class MathHelper { public string FormatNumber(int num) { return num.ToString("N0", CultureInfo.InvariantCulture); } + + // Double operations + public double AddDouble(double a, double b) { + double result = a + b; + return result; + } + + public double DivideDouble(double a, double b) { + if (b == 0) return 0; + return a / b; + } + + public string FormatDouble(double num) { + return num.ToString("F2", CultureInfo.InvariantCulture); + } + + // Decimal operations + public decimal AddDecimal(decimal a, decimal b) { + decimal result = a + b; + return result; + } + + public decimal MultiplyDecimal(decimal a, decimal b) { + return a * b; + } + + public string FormatCurrency(decimal amount) { + return amount.ToString("C2", CultureInfo.InvariantCulture); + } + + // DateTime operations + public string GetCurrentDate() { + DateTime now = DateTime.Now; + return now.ToString("yyyy-MM-dd", CultureInfo.InvariantCulture); + } + + public string FormatDate(int year, int month, int day) { + DateTime date = new DateTime(year, month, day); + return date.ToString("MMMM dd, yyyy", CultureInfo.InvariantCulture); + } + + public int GetDaysDifference(int year1, int month1, int day1, int year2, int month2, int day2) { + DateTime date1 = new DateTime(year1, month1, day1); + DateTime date2 = new DateTime(year2, month2, day2); + TimeSpan diff = date2 - date1; + return diff.Days; + } + + // String operations + public string ConcatStrings(string a, string b) { + string result = a + " " + b; + return result; + } + + public string ToUpperCase(string text) { + return text.ToUpper(); + } + + public string ReverseString(string text) { + char[] charArray = text.ToCharArray(); + Array.Reverse(charArray); + return new string(charArray); + } + + public int GetStringLength(string text) { + return text.Length; + } + + // Array operations + public int SumArray(int count) { + int[] numbers = new int[count]; + for (int i = 0; i < count; i++) { + numbers[i] = i + 1; + } + + int sum = 0; + for (int i = 0; i < numbers.Length; i++) { + sum += numbers[i]; + } + return sum; + } + + public string JoinStringArray() { + string[] words = new string[] { "XSLT", "Debugger", "Test" }; + string result = ""; + for (int i = 0; i < words.Length; i++) { + if (i > 0) result += " "; + result += words[i]; + } + return result; + } + + public double AverageDoubles(int count) { + double[] values = new double[count]; + for (int i = 0; i < count; i++) { + values[i] = (i + 1) * 1.5; + } + + double sum = 0; + for (int i = 0; i < values.Length; i++) { + sum += values[i]; + } + double average = sum / values.Length; + return average; + } + + public int FindMaxInArray(int size) { + int[] numbers = new int[size]; + for (int i = 0; i < size; i++) { + numbers[i] = (i * 7) % 100; + } + + int max = numbers[0]; + for (int i = 1; i < numbers.Length; i++) { + if (numbers[i] > max) { + max = numbers[i]; + } + } + return max; + } + + public string ReverseArray(int count) { + int[] numbers = new int[count]; + for (int i = 0; i < count; i++) { + numbers[i] = i + 1; + } + + Array.Reverse(numbers); + + string result = ""; + for (int i = 0; i < numbers.Length; i++) { + if (i > 0) result += ","; + result += numbers[i].ToString(); + } + return result; + } } ]]> @@ -32,9 +211,49 @@ public class MathHelper {
Increment counter (1st call):
Increment counter (2nd call):
Increment counter (3rd call):
Get counter value:
Prefixed message:
Apply multiplier to 10:
Cached value at index 2:
Sum of cached values:
Add 5 + 3 =
Multiply 4 * 7 =
Formatted:
Add 3.14 + 2.86 =
Divide 10.5 / 2.5 =
Formatted Double:
Add Decimal 10.50 + 20.75 =
Multiply Decimal 5.5 * 2 =
Currency:
Current Date:
Formatted Date:
Days between 2025-01-01 and 2025-12-31:
Concat:
Uppercase:
Reverse:
Length of 'Testing':
Sum of array [1,2,3,4,5]:
Join string array:
Average of doubles [1.5, 3.0, 4.5, 6.0]:
Max in array (size 10):
Reverse array [1,2,3,4,5,6]: