Sha256: 03ae971b8c35bc83cf3e512127ccc43f81cdb9296cf8931804db24181f801f4e

Contents?: true

Size: 1.15 KB

Versions: 86

Compression:

Stored size: 1.15 KB

Contents

using System.Collections;
using Generators.Input;
using Generators.Output;
namespace Generators.Exercises
{
    public class Triangle : GeneratorExercise
    {
        protected override void UpdateCanonicalData(CanonicalData canonicalData)
        {
            foreach (var data in canonicalData.Cases)
            {
                if (data.Property == "equilateral")
                    data.Property = "IsEquilateral";
                else if (data.Property == "isosceles")
                    data.Property = "IsIsosceles";
                else if (data.Property == "scalene")
                    data.Property = "IsScalene";

                data.Properties["sides"] = SplitArrayToValues(data.Properties["sides"]);
                data.SetInputParameters("sides");
                data.UseFullDescriptionPath = true;

            }
        }

        private UnescapedValue SplitArrayToValues(IEnumerable input)
        {
            const string template = "{% for item in {{input}} %}{{item}}{% if forloop.last == false %}, {% endif %}{% endfor %}";

            return new UnescapedValue(TemplateRenderer.RenderInline(template, new { input }));
        }


    }
}

Version data entries

86 entries across 86 versions & 1 rubygems

Version Path
trackler-2.2.1.131 tracks/csharp/generators/Exercises/Triangle.cs
trackler-2.2.1.130 tracks/csharp/generators/Exercises/Triangle.cs
trackler-2.2.1.129 tracks/csharp/generators/Exercises/Triangle.cs
trackler-2.2.1.128 tracks/csharp/generators/Exercises/Triangle.cs
trackler-2.2.1.127 tracks/csharp/generators/Exercises/Triangle.cs
trackler-2.2.1.126 tracks/csharp/generators/Exercises/Triangle.cs
trackler-2.2.1.125 tracks/csharp/generators/Exercises/Triangle.cs
trackler-2.2.1.124 tracks/csharp/generators/Exercises/Triangle.cs
trackler-2.2.1.123 tracks/csharp/generators/Exercises/Triangle.cs
trackler-2.2.1.122 tracks/csharp/generators/Exercises/Triangle.cs
trackler-2.2.1.121 tracks/csharp/generators/Exercises/Triangle.cs
trackler-2.2.1.120 tracks/csharp/generators/Exercises/Triangle.cs
trackler-2.2.1.119 tracks/csharp/generators/Exercises/Triangle.cs
trackler-2.2.1.118 tracks/csharp/generators/Exercises/Triangle.cs
trackler-2.2.1.117 tracks/csharp/generators/Exercises/Triangle.cs
trackler-2.2.1.116 tracks/csharp/generators/Exercises/Triangle.cs
trackler-2.2.1.115 tracks/csharp/generators/Exercises/Triangle.cs
trackler-2.2.1.114 tracks/csharp/generators/Exercises/Triangle.cs
trackler-2.2.1.113 tracks/csharp/generators/Exercises/Triangle.cs
trackler-2.2.1.111 tracks/csharp/generators/Exercises/Triangle.cs