Sha256: b0928c1a63f1b325ab9ce041f22b153236650e42ff9fd836ae8acedf0f5b6427

Contents?: true

Size: 1.94 KB

Versions: 166

Compression:

Stored size: 1.94 KB

Contents

using Generators.Input;

namespace Generators.Output
{
    public abstract class TestMethodBody
    {
        protected TestMethodBody(CanonicalDataCase canonicalDataCase, CanonicalData canonicalData)
        {
            CanonicalDataCase = canonicalDataCase;
            CanonicalData = canonicalData;

            Data = new TestMethodBodyData(this);
            InitializeTemplateParameters();
        }

        public string TemplateName { get; set; } = "TestMethodBody";

        public CanonicalDataCase CanonicalDataCase { get; }
        public CanonicalData CanonicalData { get; }
        public TestMethodBodyData Data { get; }

        public virtual bool UseVariablesForInput => CanonicalDataCase.UseVariablesForInput;
        public virtual bool UseVariablesForConstructorParameters => CanonicalDataCase.UseVariablesForConstructorParameters;
        public virtual bool UseVariableForExpected => CanonicalDataCase.UseVariableForExpected;
        public virtual bool UseVariableForTested => CanonicalDataCase.UseVariableForTested;
        
        public string ArrangeTemplateName { get; set; } = "Arrange";
        public object ArrangeTemplateParameters { get; set; }
        
        public string ActTemplateName { get; set; } = "Act";
        public object ActTemplateParameters { get; set; }
        
        public string AssertTemplateName { get; set; } = "AssertEqual";
        public object AssertTemplateParameters { get; set; }

        public string Act { get; set; }
        public string Arrange { get; set; }
        public string Assert { get; set; }
        
        public virtual string Render() => TemplateRenderer.RenderPartial(TemplateName, new { Arrange, Act, Assert });

        private void InitializeTemplateParameters()
        {
            ArrangeTemplateParameters = new { Data.Variables };
            ActTemplateParameters = new { };
            AssertTemplateParameters = new { Data.ExpectedParameter, Data.TestedValue };
        }
    }
}

Version data entries

166 entries across 166 versions & 1 rubygems

Version Path
trackler-2.2.1.180 tracks/csharp/generators/Output/TestMethodBody.cs
trackler-2.2.1.179 tracks/csharp/generators/Output/TestMethodBody.cs
trackler-2.2.1.178 tracks/csharp/generators/Output/TestMethodBody.cs
trackler-2.2.1.177 tracks/csharp/generators/Output/TestMethodBody.cs
trackler-2.2.1.176 tracks/csharp/generators/Output/TestMethodBody.cs
trackler-2.2.1.175 tracks/csharp/generators/Output/TestMethodBody.cs
trackler-2.2.1.174 tracks/csharp/generators/Output/TestMethodBody.cs
trackler-2.2.1.173 tracks/csharp/generators/Output/TestMethodBody.cs
trackler-2.2.1.172 tracks/csharp/generators/Output/TestMethodBody.cs
trackler-2.2.1.171 tracks/csharp/generators/Output/TestMethodBody.cs
trackler-2.2.1.170 tracks/csharp/generators/Output/TestMethodBody.cs
trackler-2.2.1.169 tracks/csharp/generators/Output/TestMethodBody.cs
trackler-2.2.1.167 tracks/csharp/generators/Output/TestMethodBody.cs
trackler-2.2.1.166 tracks/csharp/generators/Output/TestMethodBody.cs
trackler-2.2.1.165 tracks/csharp/generators/Output/TestMethodBody.cs
trackler-2.2.1.164 tracks/csharp/generators/Output/TestMethodBody.cs
trackler-2.2.1.163 tracks/csharp/generators/Output/TestMethodBody.cs
trackler-2.2.1.162 tracks/csharp/generators/Output/TestMethodBody.cs
trackler-2.2.1.161 tracks/csharp/generators/Output/TestMethodBody.cs
trackler-2.2.1.160 tracks/csharp/generators/Output/TestMethodBody.cs