Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 01df90c

Browse files
committed
updated snippets
1 parent c21b8a8 commit 01df90c

17 files changed

+349
-2
lines changed

VisualStudio2022/csharp/aines.snippet

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
<Default>actual</Default>
1818
</Literal>
1919
</Declarations>
20-
<Code Language="csharp"><![CDATA[Assert.IsTrue(String.IsNullOrEmpty($actual$), "$actual$ should be null or empty.");$end$]]></Code>
20+
<Code Language="csharp"><![CDATA[Assert.IsTrue(String.IsNullOrEmpty($actual$), "${1:variableName} should be null or empty.");$end$]]></Code>
2121
</Snippet>
2222
</CodeSnippet>
2323
</CodeSnippets>
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
<CodeSnippets xmlns="http://schemas.microsoft.com/VisualStudio/2005/CodeSnippet">
2+
<CodeSnippet Format="1.0.0">
3+
<Header>
4+
<Title>Add Entity Framework Core for registering DbContext for ASP.NET dependency injection</Title>
5+
<Shortcut>dbcdi</Shortcut>
6+
<Description>Add Entity Framework Core for registering DbContext for ASP.NET dependency injection</Description>
7+
<Author>Benjamin Day</Author>
8+
<SnippetTypes>
9+
<SnippetType>Expansion</SnippetType>
10+
</SnippetTypes>
11+
</Header>
12+
<Snippet>
13+
<Declarations></Declarations>
14+
<Code Language="csharp"><![CDATA[services.AddDbContext<MyDbContext>(options =>
15+
{
16+
options.UseSqlServer(Configuration.GetConnectionString("default"));
17+
options.EnableSensitiveDataLogging(true);
18+
});$end$]]></Code>
19+
</Snippet>
20+
</CodeSnippet>
21+
</CodeSnippets>
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
<CodeSnippets xmlns="http://schemas.microsoft.com/VisualStudio/2005/CodeSnippet">
2+
<CodeSnippet Format="1.0.0">
3+
<Header>
4+
<Title>Add usings for Entity Framework Core stuff</Title>
5+
<Shortcut>dbcu</Shortcut>
6+
<Description>Add usings for Entity Framework Core stuff</Description>
7+
<Author>Benjamin Day</Author>
8+
<SnippetTypes>
9+
<SnippetType>Expansion</SnippetType>
10+
</SnippetTypes>
11+
</Header>
12+
<Snippet>
13+
<Declarations></Declarations>
14+
<Code Language="csharp"><![CDATA[using System;
15+
using System.IO;
16+
using Microsoft.EntityFrameworkCore;
17+
using Microsoft.EntityFrameworkCore.Design;
18+
using Microsoft.Extensions.Configuration;$end$]]></Code>
19+
</Snippet>
20+
</CodeSnippet>
21+
</CodeSnippets>
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
<CodeSnippets xmlns="http://schemas.microsoft.com/VisualStudio/2005/CodeSnippet">
2+
<CodeSnippet Format="1.0.0">
3+
<Header>
4+
<Title>Auto-implemented bool property with json property attribute</Title>
5+
<Shortcut>jpb</Shortcut>
6+
<Description>Auto-implemented bool property with json property attribute</Description>
7+
<Author>Benjamin Day</Author>
8+
<SnippetTypes>
9+
<SnippetType>Expansion</SnippetType>
10+
</SnippetTypes>
11+
</Header>
12+
<Snippet>
13+
<Declarations>
14+
<Literal>
15+
<ID>PropertyName</ID>
16+
<ToolTip></ToolTip>
17+
<Default>PropertyName</Default>
18+
</Literal>
19+
</Declarations>
20+
<Code Language="csharp"><![CDATA[[JsonPropertyName("$PropertyName$")]
21+
public bool $PropertyName$ { get; set; }
22+
$end$]]></Code>
23+
</Snippet>
24+
</CodeSnippet>
25+
</CodeSnippets>
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
<CodeSnippets xmlns="http://schemas.microsoft.com/VisualStudio/2005/CodeSnippet">
2+
<CodeSnippet Format="1.0.0">
3+
<Header>
4+
<Title>Auto-implemented datetime property with json property attribute</Title>
5+
<Shortcut>jpd8</Shortcut>
6+
<Description>Auto-implemented datetime property with json property attribute</Description>
7+
<Author>Benjamin Day</Author>
8+
<SnippetTypes>
9+
<SnippetType>Expansion</SnippetType>
10+
</SnippetTypes>
11+
</Header>
12+
<Snippet>
13+
<Declarations>
14+
<Literal>
15+
<ID>PropertyName</ID>
16+
<ToolTip></ToolTip>
17+
<Default>PropertyName</Default>
18+
</Literal>
19+
</Declarations>
20+
<Code Language="csharp"><![CDATA[[JsonPropertyName("$PropertyName$")]
21+
public DateTime $PropertyName$ { get; set; }
22+
$end$]]></Code>
23+
</Snippet>
24+
</CodeSnippet>
25+
</CodeSnippets>
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
<CodeSnippets xmlns="http://schemas.microsoft.com/VisualStudio/2005/CodeSnippet">
2+
<CodeSnippet Format="1.0.0">
3+
<Header>
4+
<Title>Auto-implemented int property with json property attribute</Title>
5+
<Shortcut>jpi</Shortcut>
6+
<Description>Auto-implemented int property with json property attribute</Description>
7+
<Author>Benjamin Day</Author>
8+
<SnippetTypes>
9+
<SnippetType>Expansion</SnippetType>
10+
</SnippetTypes>
11+
</Header>
12+
<Snippet>
13+
<Declarations>
14+
<Literal>
15+
<ID>PropertyName</ID>
16+
<ToolTip></ToolTip>
17+
<Default>PropertyName</Default>
18+
</Literal>
19+
</Declarations>
20+
<Code Language="csharp"><![CDATA[[JsonPropertyName("$PropertyName$")]
21+
public int $PropertyName$ { get; set; }
22+
$end$]]></Code>
23+
</Snippet>
24+
</CodeSnippet>
25+
</CodeSnippets>
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
<CodeSnippets xmlns="http://schemas.microsoft.com/VisualStudio/2005/CodeSnippet">
2+
<CodeSnippet Format="1.0.0">
3+
<Header>
4+
<Title>Auto-implemented string property with json property attribute</Title>
5+
<Shortcut>jps</Shortcut>
6+
<Description>Auto-implemented string property with json property attribute</Description>
7+
<Author>Benjamin Day</Author>
8+
<SnippetTypes>
9+
<SnippetType>Expansion</SnippetType>
10+
</SnippetTypes>
11+
</Header>
12+
<Snippet>
13+
<Declarations>
14+
<Literal>
15+
<ID>PropertyName</ID>
16+
<ToolTip></ToolTip>
17+
<Default>PropertyName</Default>
18+
</Literal>
19+
</Declarations>
20+
<Code Language="csharp"><![CDATA[[JsonPropertyName("$PropertyName$")]
21+
public string $PropertyName$ { get; set; }
22+
$end$]]></Code>
23+
</Snippet>
24+
</CodeSnippet>
25+
</CodeSnippets>

VisualStudio2022/csharp/tfsut.snippet

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ public class $TestClassName$Fixture
2626
_SystemUnderTest = null;
2727
}
2828

29-
private $TestClassName$? _SystemUnderTest;
29+
private $TestClassName$ _SystemUnderTest;
3030

3131
private $TestClassName$ SystemUnderTest
3232
{

VisualStudioCode/csharp.json

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@
3636
],
3737
"description": "DbContext class"
3838
},
39+
3940
"dbcu": {
4041
"prefix": "dbcu",
4142
"body": [
@@ -712,6 +713,49 @@
712713
],
713714
"description": "Public interface"
714715
},
716+
717+
718+
"Auto-implemented string property with json property attribute": {
719+
"prefix": "jps",
720+
"body": [
721+
"[JsonPropertyName(\"${1/(.*)/${1:/camelcase}/}\")]",
722+
"public string ${1:PropertyName} { get; set; }",
723+
"$0"
724+
],
725+
"description": "Auto-implemented string property with json property attribute"
726+
},
727+
728+
"Auto-implemented bool property with json property attribute": {
729+
"prefix": "jpb",
730+
"body": [
731+
"[JsonPropertyName(\"${1/(.*)/${1:/camelcase}/}\")]",
732+
"public bool ${1:PropertyName} { get; set; }",
733+
"$0"
734+
],
735+
"description": "Auto-implemented bool property with json property attribute"
736+
},
737+
738+
"Auto-implemented int property with json property attribute": {
739+
"prefix": "jpi",
740+
"body": [
741+
"[JsonPropertyName(\"${1/(.*)/${1:/camelcase}/}\")]",
742+
"public int ${1:PropertyName} { get; set; }",
743+
"$0"
744+
],
745+
"description": "Auto-implemented int property with json property attribute"
746+
},
747+
748+
"Auto-implemented datetime property with json property attribute": {
749+
"prefix": "jpd8",
750+
"body": [
751+
"[JsonPropertyName(\"${1/(.*)/${1:/camelcase}/}\")]",
752+
"public DateTime ${1:PropertyName} { get; set; }",
753+
"$0"
754+
],
755+
"description": "Auto-implemented datetime property with json property attribute"
756+
},
757+
758+
715759
"Auto-implemented string property": {
716760
"prefix": "aps",
717761
"body": [

VisualStudioCode/typescript.json

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,4 +24,30 @@
2424
],
2525
"description": "String.Format"
2626
},
27+
"angular field": {
28+
"prefix": "ngf",
29+
"body": [
30+
"public readonly fieldName${1/(.*)/${1:/pascalcase}/}: string = '${1/(.*)/${1:/camelcase}/}';",
31+
"public get ${1/(.*)/${1:/camelcase}/}(): AbstractControl | null {",
32+
"return this.theForm.get(this.fieldName${1/(.*)/${1:/pascalcase}/});",
33+
"}",
34+
"$0"
35+
],
36+
"description": "angular field definition in a component"
37+
},
38+
"angular field assertion": {
39+
"prefix": "ngaf",
40+
"body": [
41+
"it('should have a form control for ${1/(.*)/${1:/camelcase}/}', () => {",
42+
"systemUnderTest.ngOnInit();",
43+
"",
44+
"TestUtilities.assertFormControl(",
45+
"systemUnderTest.${1/(.*)/${1:/camelcase}/},",
46+
"systemUnderTest.theForm.get(systemUnderTest.fieldName${1/(.*)/${1:/pascalcase}/})",
47+
");",
48+
"});",
49+
"$0"
50+
],
51+
"description": "angular field definition assertion in spec"
52+
},
2753
}

0 commit comments

Comments
 (0)