Skip to content

Commit 24a2b04

Browse files
committed
class naming correction not to confuse anyone
1 parent 9abdefb commit 24a2b04

File tree

5 files changed

+41
-24
lines changed

5 files changed

+41
-24
lines changed

RazorEngineCore.Tests/Models/TestModel1.cs renamed to RazorEngineCore.Tests/Models/TestModel.cs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,12 @@
33

44
namespace RazorEngineCore.Tests.Models
55
{
6-
public class TestModel1 : RazorEngineTemplateBase
6+
public class TestModel
77
{
88
public int A { get; set; }
99
public int B { get; set; }
1010
public string C { get; set; }
1111
public DateTime D { get; set; }
12-
1312
public IList<int> Numbers { get; set; }
1413

1514
public string Decorator(string text)

RazorEngineCore.Tests/Models/TestModel2.cs

Lines changed: 0 additions & 12 deletions
This file was deleted.
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
using System;
2+
using System.Collections.Generic;
3+
4+
namespace RazorEngineCore.Tests.Models
5+
{
6+
public class TestTemplate1 : RazorEngineTemplateBase
7+
{
8+
public int A { get; set; }
9+
public int B { get; set; }
10+
public string C { get; set; }
11+
public DateTime D { get; set; }
12+
13+
public IList<int> Numbers { get; set; }
14+
15+
public string Decorator(string text)
16+
{
17+
return "-=" + text + "=-";
18+
}
19+
}
20+
}
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
namespace RazorEngineCore.Tests.Models
2+
{
3+
public class TestTemplate2 : RazorEngineTemplateBase<TestModel>
4+
{
5+
public void Initialize(TestModel model)
6+
{
7+
this.Model = model;
8+
}
9+
}
10+
}

RazorEngineCore.Tests/TestCompileAndRun.cs

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -339,7 +339,7 @@ void RecursionTest(int level)
339339
public void TestCompileAndRun_TypedModel1()
340340
{
341341
RazorEngine razorEngine = new RazorEngine();
342-
IRazorEngineCompiledTemplate<TestModel1> template = razorEngine.Compile<TestModel1>("Hello @A @B @(A + B) @C @Decorator(\"777\")");
342+
IRazorEngineCompiledTemplate<TestTemplate1> template = razorEngine.Compile<TestTemplate1>("Hello @A @B @(A + B) @C @Decorator(\"777\")");
343343

344344
string actual = template.Run(instance =>
345345
{
@@ -355,7 +355,7 @@ public void TestCompileAndRun_TypedModel1()
355355
public async Task TestCompileAndRun_TypedModel1Async()
356356
{
357357
RazorEngine razorEngine = new RazorEngine();
358-
IRazorEngineCompiledTemplate<TestModel1> template = await razorEngine.CompileAsync<TestModel1>("Hello @A @B @(A + B) @C @Decorator(\"777\")");
358+
IRazorEngineCompiledTemplate<TestTemplate1> template = await razorEngine.CompileAsync<TestTemplate1>("Hello @A @B @(A + B) @C @Decorator(\"777\")");
359359

360360
string actual = await template.RunAsync(instance =>
361361
{
@@ -371,11 +371,11 @@ public async Task TestCompileAndRun_TypedModel1Async()
371371
public void TestCompileAndRun_TypedModel2()
372372
{
373373
RazorEngine razorEngine = new RazorEngine();
374-
IRazorEngineCompiledTemplate<TestModel2> template = razorEngine.Compile<TestModel2>("Hello @Model.Decorator(Model.C)");
374+
IRazorEngineCompiledTemplate<TestTemplate2> template = razorEngine.Compile<TestTemplate2>("Hello @Model.Decorator(Model.C)");
375375

376376
string actual = template.Run(instance =>
377377
{
378-
instance.Initialize(new TestModel1()
378+
instance.Initialize(new TestModel
379379
{
380380
C = "Alex"
381381
});
@@ -388,11 +388,11 @@ public void TestCompileAndRun_TypedModel2()
388388
public async Task TestCompileAndRun_TypedModel2Async()
389389
{
390390
RazorEngine razorEngine = new RazorEngine();
391-
IRazorEngineCompiledTemplate<TestModel2> template = await razorEngine.CompileAsync<TestModel2>("Hello @Model.Decorator(Model.C)");
391+
IRazorEngineCompiledTemplate<TestTemplate2> template = await razorEngine.CompileAsync<TestTemplate2>("Hello @Model.Decorator(Model.C)");
392392

393393
string actual = await template.RunAsync(instance =>
394394
{
395-
instance.Initialize(new TestModel1()
395+
instance.Initialize(new TestModel
396396
{
397397
C = "Alex"
398398
});
@@ -405,7 +405,7 @@ public async Task TestCompileAndRun_TypedModel2Async()
405405
public void TestCompileAndRun_Linq()
406406
{
407407
RazorEngine razorEngine = new RazorEngine();
408-
IRazorEngineCompiledTemplate<TestModel2> template = razorEngine.Compile<TestModel2>(
408+
IRazorEngineCompiledTemplate<TestTemplate2> template = razorEngine.Compile<TestTemplate2>(
409409
@"
410410
@foreach (var item in Model.Numbers.OrderByDescending(x => x))
411411
{
@@ -419,7 +419,7 @@ public void TestCompileAndRun_Linq()
419419
";
420420
string actual = template.Run(instance =>
421421
{
422-
instance.Initialize(new TestModel1()
422+
instance.Initialize(new TestModel
423423
{
424424
Numbers = new[] {2, 1, 3}
425425
});
@@ -432,7 +432,7 @@ public void TestCompileAndRun_Linq()
432432
public async Task TestCompileAndRun_LinqAsync()
433433
{
434434
RazorEngine razorEngine = new RazorEngine();
435-
IRazorEngineCompiledTemplate<TestModel2> template = await razorEngine.CompileAsync<TestModel2>(
435+
IRazorEngineCompiledTemplate<TestTemplate2> template = await razorEngine.CompileAsync<TestTemplate2>(
436436
@"
437437
@foreach (var item in Model.Numbers.OrderByDescending(x => x))
438438
{
@@ -446,7 +446,7 @@ public async Task TestCompileAndRun_LinqAsync()
446446
";
447447
string actual = await template.RunAsync(instance =>
448448
{
449-
instance.Initialize(new TestModel1()
449+
instance.Initialize(new TestModel
450450
{
451451
Numbers = new[] {2, 1, 3}
452452
});

0 commit comments

Comments
 (0)