public override string ToPresentation(ICharacteristic characteristic)
            {
                var valueType = ReflectionUtils.GetGenericTypeArguments(characteristic.GetType()).First().GetCorrectTypeName();
                var id        = characteristic.Id;
                var value     = SourceCodeHelper.ToSourceCode(characteristic.ObjectValue);

                return($"Characteristic<{valueType}>.Create(\"{id}\").Mutate({value})");
            }
            public override string ToPresentation(JobMode jobMode, Characteristic characteristic)
            {
                // TODO: DO NOT hardcode Characteristic suffix
                var id    = characteristic.Id;
                var type  = characteristic.DeclaringType.FullName;
                var value = SourceCodeHelper.ToSourceCode(characteristic[jobMode]);

                return($"{type}.{id}Characteristic[job] = {value}");
            }
            public override string ToPresentation(object characteristicValue, Characteristic characteristic)
            {
                // TODO: DO NOT hardcode Characteristic suffix
                string id    = characteristic.Id;
                string type  = characteristic.DeclaringType.FullName;
                string value = SourceCodeHelper.ToSourceCode(characteristicValue);

                return($"{type}.{id}Characteristic[job] = {value}");
            }
Beispiel #4
0
        public void ToSourceCodeSimpleTest(object original, string expected)
        {
            string actual = SourceCodeHelper.ToSourceCode(original);

            output.WriteLine("ORIGINAL  : " + original + " (" + original?.GetType() + ")");
            output.WriteLine("ACTUAL    : " + actual);
            output.WriteLine("EXPRECTED : " + expected);
            Assert.Equal(expected, actual);
        }
 private static string GetParamsContent(Benchmark benchmark)
 {
     return(string.Join(
                string.Empty,
                benchmark.Parameters.Items.Select(
                    parameter =>
                    $"{(parameter.IsStatic ? "" : "instance.")}{parameter.Name} = {SourceCodeHelper.ToSourceCode(parameter.Value)};")));
 }
Beispiel #6
0
 public string ToSourceCode()
 => $"new {typeof(T).GetCorrectCSharpTypeName()}[] {{ {string.Join(", ", array.Select(item => toSourceCode?.Invoke(item) ?? SourceCodeHelper.ToSourceCode(item)))} }}";
 public string ToSourceCode()
 => $"new[] {{ {string.Join(", ", array.Select(item => toSourceCode?.Invoke(item) ?? SourceCodeHelper.ToSourceCode(item)))} }}";