Skip to content

Commit b7245ef

Browse files
author
Ajay kumar
committed
Add Line component and update existing Razor files
1 parent 2c2dc17 commit b7245ef

5 files changed

Lines changed: 19 additions & 11 deletions

File tree

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
@inherits GithubGistSnippetBase
22

33
<section class="[ flex flex-col ]">
4-
<h4 class="[ bg-gray-200 ] [ p-2 ] [ font-semibold ] [ text-black ] [ flex items-center ]">
4+
<h5 class="[ bg-gray-200 ] [ p-2 ] [ font-semibold ] [ text-black ] [ flex items-center ]">
55
<svg xmlns="http://www.w3.org/2000/svg" class="[ icon icon-tabler icon-tabler-code ] [ text-purple-700 ] [ fill-purple-500 ]" width="20" height="20" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor" fill="none" stroke-linecap="round" stroke-linejoin="round">
66
<path stroke="none" d="M0 0h24v24H0z" fill="none"></path>
77
<polyline points="7 8 3 12 7 16"></polyline>
88
<polyline points="17 8 21 12 17 16"></polyline>
99
<line x1="14" y1="4" x2="10" y2="20"></line>
10-
</svg> Code Sample - @Title
11-
</h4>
10+
</svg><code>Code Sample - @Title</code>
11+
</h5>
1212
<article id="@Id" class="[ bg-gray-300 ]">
1313
</article>
1414
</section>
Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
1-
<h3>FailureMessage</h3>
2-
31
@code {
4-
5-
}
2+
[Parameter, EditorRequired] public RenderFragment ChildContent { get; set; } = default!;
3+
}
4+
<span class="text-danger">@ChildContent</span>
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
@code {
2+
[Parameter, EditorRequired] public int Number { get; set; }
3+
[Parameter] public string Text { get; set; } = "Line"!;
4+
5+
public string LineTextWithLineNumber => Text + " #" + Number;
6+
}
7+
<span class="text-success">@LineTextWithLineNumber</span>

TestArena/Blog/PactNet/Intro/FailureScenario.razor

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,18 @@
11
@using TestArena.Blog.Common
2+
@using TestArena.Blog.Common.TextDecorators
23

34
<Section Heading="Failure Scenario">
45
<ChildContent>
56

67
<p>To test out failure scenario, we will try to change the pact file manually and mimic a scenario such that the
7-
consumer is expecting another field called classId” (line 26) which, at the moment, our provider API does
8+
consumer is expecting another field called <code>classId</code> (<Line Number="22"/>) which, at the moment, our provider API does
89
not supports. After manually changing the pact file the response expected by consumer service will look like
910
below:</p>
1011
<GithubGistSnippet Title="Changing pact file manually to mimic fail scenario" UserId="ajaysskumar"
1112
FileName="5762614e542611588dacff1d77158bd8"/>
1213

1314
<p>After this, if we try to get this pact file verified by our provider unit test, we will get a failure result
14-
indicating why the test failed. The failure message ($ -> Actual map is missing the following keys: classId)
15+
indicating why the test failed. The failure message (<FailureMessage>$ -> Actual map is missing the following keys: classId</FailureMessage>)
1516
below indicates the field name that was not supported by the provider API but was expected by the consumer
1617
service.</p>
1718

TestArena/Blog/PactNet/Intro/ProviderSideTest.razor

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
@using TestArena.Blog.Common
2+
@using TestArena.Blog.Common.TextDecorators
23

34
<Section Heading="Provider side tests and verification of pact file:">
45
<ChildContent>
@@ -20,7 +21,7 @@
2021

2122
<p>In ProviderStateMiddleware class we are trying to setup the state of the system. It is to note that using Pact we can write complex test scenarios as well. For example lets say if student address anything other than Delhi then, consumer is expecting an additional field called City. These kind of scenarios can be handled by defining the state of the Provider API using state middlewares like below.</p>
2223

23-
<p>In the below middleware, we are adding a middleware that will add a student with id 1 in the system. If you correlate, then code (line #28) below is the same sentence that is mentioned in the pact file, provider state section.</p>
24+
<p>In the below middleware, we are adding a middleware that will add a student with id 1 in the system. If you correlate, then code (<Line Number="11"/>) below is the same sentence that is mentioned in the pact file, provider state section.</p>
2425

2526
<GithubGistSnippet Title="ProviderStateMiddleware class" UserId="ajaysskumar" FileName="1840eccd3ce4a945c78c0996f9bb45d3"/>
2627

@@ -30,7 +31,7 @@
3031

3132
<GithubGistSnippet Title="TestStartup class" UserId="ajaysskumar" FileName="8d26f9a989788452d1a50bc18a1da21d"/>
3233

33-
<p>Finally the test case. In the test case, instruct Pact verifier about which fixture class to use for setting up and running the host (line 16) and along with the path of the Pact file that was generated by the consumer. Pact verifier take all the required information about host and pact file and finally runs <code>Verify()</code> method.</p>
34+
<p>Finally the test case. In the test case, instruct Pact verifier about which fixture class to use for setting up and running the host (<Line Number="5"/>) and along with the path of the Pact file that was generated by the consumer (<Line Number="11"/>). Pact verifier take all the required information about host and pact file and finally runs <code>Verify()</code> method.</p>
3435

3536
<GithubGistSnippet Title="Provider test class" UserId="ajaysskumar" FileName="72d9859ec5c4b2f8cf82b684dc7ded6b"/>
3637

0 commit comments

Comments
 (0)