Skip to content

Commit 27581de

Browse files
authored
Merge pull request #16 from NightAngell/development
Development
2 parents 21f15a9 + 256b827 commit 27581de

File tree

19 files changed

+170
-86
lines changed

19 files changed

+170
-86
lines changed

ExampleSignalRCoreProject/ExampleSignalRCoreProject.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
<Project Sdk="Microsoft.NET.Sdk.Web">
1+
<Project Sdk="Microsoft.NET.Sdk.Web">
22

33
<PropertyGroup>
44
<TargetFramework>netcoreapp2.1</TargetFramework>

ExampleSignalRCoreProject/Hubs/ExampleHub.cs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,14 +4,13 @@
44
using Microsoft.AspNetCore.SignalR;
55
using System;
66
using System.Collections.Generic;
7-
using System.Linq;
87
using System.Threading.Tasks;
98

109
namespace ExampleSignalRCoreProject.Hubs
1110
{
1211
public class ExampleHub : Hub<ExampleHubResponses>
1312
{
14-
Db _db;
13+
readonly Db _db;
1514

1615
public ExampleHub(Db db)
1716
{

ExampleSignalRCoreProject/Hubs/ExampleNonGenericHub.cs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
using Microsoft.AspNetCore.SignalR;
2-
using System;
32
using System.Collections.Generic;
4-
using System.Linq;
53
using System.Threading.Tasks;
64

75
namespace ExampleSignalRCoreProject.Hubs

ExampleSignalRCoreProject/Hubs/Interfaces/ExampleHubResponses.cs

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,4 @@
1-
using System;
2-
using System.Collections.Generic;
3-
using System.Linq;
4-
using System.Threading.Tasks;
1+
using System.Threading.Tasks;
52

63
namespace ExampleSignalRCoreProject.Hubs.Interfaces
74
{

ExampleSignalRCoreProject/Hubs/V101FeaturesHub.cs

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,4 @@
11
using Microsoft.AspNetCore.SignalR;
2-
using System;
3-
using System.Collections.Generic;
4-
using System.Linq;
5-
using System.Threading.Tasks;
62

73
namespace ExampleSignalRCoreProject.Hubs
84
{

ExampleSignalRCoreProject/Migrations/20190821193025_Init.Designer.cs

Lines changed: 38 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
using Microsoft.EntityFrameworkCore.Metadata;
2+
using Microsoft.EntityFrameworkCore.Migrations;
3+
4+
namespace ExampleSignalRCoreProject.Migrations
5+
{
6+
public partial class Init : Migration
7+
{
8+
protected override void Up(MigrationBuilder migrationBuilder)
9+
{
10+
migrationBuilder.CreateTable(
11+
name: "Note",
12+
columns: table => new
13+
{
14+
Id = table.Column<int>(nullable: false)
15+
.Annotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn),
16+
Content = table.Column<string>(nullable: true)
17+
},
18+
constraints: table =>
19+
{
20+
table.PrimaryKey("PK_Note", x => x.Id);
21+
});
22+
}
23+
24+
protected override void Down(MigrationBuilder migrationBuilder)
25+
{
26+
migrationBuilder.DropTable(
27+
name: "Note");
28+
}
29+
}
30+
}
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
// <auto-generated />
2+
using ExampleSignalRCoreProject.Databases;
3+
using Microsoft.EntityFrameworkCore;
4+
using Microsoft.EntityFrameworkCore.Infrastructure;
5+
using Microsoft.EntityFrameworkCore.Metadata;
6+
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
7+
8+
namespace ExampleSignalRCoreProject.Migrations
9+
{
10+
[DbContext(typeof(Db))]
11+
partial class DbModelSnapshot : ModelSnapshot
12+
{
13+
protected override void BuildModel(ModelBuilder modelBuilder)
14+
{
15+
#pragma warning disable 612, 618
16+
modelBuilder
17+
.HasAnnotation("ProductVersion", "2.2.4-servicing-10062")
18+
.HasAnnotation("Relational:MaxIdentifierLength", 128)
19+
.HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
20+
21+
modelBuilder.Entity("ExampleSignalRCoreProject.Models.Note", b =>
22+
{
23+
b.Property<int>("Id")
24+
.ValueGeneratedOnAdd()
25+
.HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
26+
27+
b.Property<string>("Content");
28+
29+
b.HasKey("Id");
30+
31+
b.ToTable("Note");
32+
});
33+
#pragma warning restore 612, 618
34+
}
35+
}
36+
}

ExampleSignalRCoreProject/Models/Note.cs

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,4 @@
1-
using System;
2-
using System.Collections.Generic;
3-
using System.Linq;
4-
using System.Threading.Tasks;
5-
6-
namespace ExampleSignalRCoreProject.Models
1+
namespace ExampleSignalRCoreProject.Models
72
{
83
public class Note
94
{

ExampleSignalRCoreProject/Services/ServiceWhichUserGenericIHubContext.cs

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,7 @@
11
using ExampleSignalRCoreProject.Hubs;
22
using ExampleSignalRCoreProject.Hubs.Interfaces;
33
using Microsoft.AspNetCore.SignalR;
4-
using System;
54
using System.Collections.Generic;
6-
using System.Linq;
7-
using System.Threading.Tasks;
85

96
namespace ExampleSignalRCoreProject.Services
107
{

SignalR_UnitTestingSupport/SignalR_UnitTestingSupport.csproj

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,23 @@
11
<Project Sdk="Microsoft.NET.Sdk">
22

33
<PropertyGroup>
4-
<TargetFramework>netcoreapp2.1</TargetFramework>
4+
<TargetFramework>netstandard2.0</TargetFramework>
55

66
<IsPackable>true</IsPackable>
77

88
<PackageRequireLicenseAcceptance>true</PackageRequireLicenseAcceptance>
99

1010
<Copyright>Mateusz Soboń (NightAngell)</Copyright>
1111

12-
<PackageLicenseUrl>https://github.com/NightAngell/SignalR_UnitTestingSupport/blob/master/LICENSE</PackageLicenseUrl>
12+
<PackageLicenseUrl></PackageLicenseUrl>
1313

1414
<PackageProjectUrl>https://github.com/NightAngell/SignalR_UnitTestingSupport</PackageProjectUrl>
1515

1616
<RepositoryUrl>https://github.com/NightAngell/SignalR_UnitTestingSupport</RepositoryUrl>
1717

1818
<PackageTags>SignalR SignalRCore SignalRUnitTest SignalRCoreUnitTest SignalRUnitTesting SignalRCoreUnitTesting SignalRUnitTests SignalRCoreUnitTests Unit Test Tests Testing NUnit SignalRUnitTestingSupport SignalRCoreUnitTestingSupport AspNetCore AspNetCore.SignalR aspnetcore "AspNetCore SignalR Unit Test" "AspNetCore SignalR Unit Tests" "AspNetCore SignalR Unit Testing"</PackageTags>
1919

20-
<PackageReleaseNotes>Easy to use, small, SignalR Core unit testing support with NUnit and Moq.
21-
*Separate common code</PackageReleaseNotes>
20+
<PackageReleaseNotes>Updated dependencies</PackageReleaseNotes>
2221

2322
<PackageId>SignalR.UnitTestingSupport.NUnit</PackageId>
2423

@@ -38,24 +37,26 @@
3837

3938
<GeneratePackageOnBuild>false</GeneratePackageOnBuild>
4039

41-
<Version>1.1.1</Version>
40+
<Version>2.0.0</Version>
4241

43-
<AssemblyVersion>1.1.1.0</AssemblyVersion>
42+
<AssemblyVersion>2.0.0.0</AssemblyVersion>
4443

45-
<FileVersion>1.1.1.0</FileVersion>
44+
<FileVersion>2.0.0.0</FileVersion>
45+
46+
<PackageLicenseExpression>MIT</PackageLicenseExpression>
4647
</PropertyGroup>
4748

4849
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|AnyCPU'">
49-
<DocumentationFile>C:\Users\Mateusz Sobo\Desktop\UnitTestingSupport\SignalR_UnitTestingSupport\SignalR_UnitTestingSupport\SignalR_UnitTestingSupport.xml</DocumentationFile>
50+
<DocumentationFile>C:\Users\sobta\Desktop\update\SignalR_UnitTestingSupport\SignalR_UnitTestingSupport\SignalR_UnitTestingSupport.xml</DocumentationFile>
5051
</PropertyGroup>
5152

5253
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'">
5354
<DocumentationFile></DocumentationFile>
5455
</PropertyGroup>
5556

5657
<ItemGroup>
57-
<PackageReference Include="AspNetCore.SignalR.UnitTestingSupport.Common" Version="1.1.0" />
58-
<PackageReference Include="nunit" Version="3.10.1" />
58+
<PackageReference Include="AspNetCore.SignalR.UnitTestingSupport.Common" Version="2.0.0" />
59+
<PackageReference Include="nunit" Version="3.12.0" />
5960
</ItemGroup>
6061

6162
</Project>

SignalR_UnitTestingSupportCommon/EFSupport/DbMockAndInMemoryProvider.cs

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -116,10 +116,7 @@ private TDbContext _initInMemorySqlite()
116116
.ConfigureWarnings(x => x.Ignore(RelationalEventId.QueryClientEvaluationWarning))
117117
.Options;
118118

119-
var dbContext = (TDbContext)Activator.CreateInstance(typeof(TDbContext), dbContextSqliteOptions);
120-
dbContext.Database.EnsureCreated();
121-
122-
return dbContext;
119+
return _createDb(dbContextSqliteOptions);
123120
}
124121

125122
private TDbContext _initInMemoryInMemory()
@@ -129,7 +126,12 @@ private TDbContext _initInMemoryInMemory()
129126
.ConfigureWarnings(x => x.Ignore(RelationalEventId.QueryClientEvaluationWarning))
130127
.Options;
131128

132-
var dbContext = (TDbContext)Activator.CreateInstance(typeof(TDbContext), dbContextInMemoryOptions);
129+
return _createDb(dbContextInMemoryOptions);
130+
}
131+
132+
private TDbContext _createDb(DbContextOptions<TDbContext> dbContextOptions)
133+
{
134+
var dbContext = (TDbContext)Activator.CreateInstance(typeof(TDbContext), dbContextOptions);
133135
dbContext.Database.EnsureCreated();
134136

135137
return dbContext;
Lines changed: 11 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,8 @@
1-
<Project Sdk="Microsoft.NET.Sdk">
1+
<Project Sdk="Microsoft.NET.Sdk">
22

33
<PropertyGroup>
4-
<TargetFramework>netcoreapp2.1</TargetFramework>
5-
<PackageReleaseNotes>*Added support for IHubContext and moved all common code to AspNetCore.SignalR.UnitTestingSupport.Common
6-
7-
*Added possibility to implement my lib for custom (different than NUnit, xUnit, MsTest) testing framework (See: https://github.com/NightAngell/SignalR_UnitTestingSupport/wiki/How-implement-testing-support-for-different-than-NUnit,-xUnit-or-MsTest-Framework).</PackageReleaseNotes>
4+
<TargetFramework>netstandard2.0</TargetFramework>
5+
<PackageReleaseNotes>Ported to .Net standard.</PackageReleaseNotes>
86
<Authors>Mateusz Soboń (NightAngell)</Authors>
97
<Company />
108
<Description>Common code for all SignalR.UnitTestingSupport.* nugets . If you want support for unit testing signalR core (Hub and IHubContext) use one of this packages (NUnit, xUnit, MsTest version):
@@ -23,23 +21,24 @@ https://github.com/NightAngell/SignalR_UnitTestingSupport/wiki/How-implement-tes
2321
</Description>
2422
<Copyright>MIT License (Mateusz Soboń)</Copyright>
2523
<PackageRequireLicenseAcceptance>true</PackageRequireLicenseAcceptance>
26-
<PackageLicenseUrl>https://github.com/NightAngell/SignalR_UnitTestingSupport/blob/master/LICENSE</PackageLicenseUrl>
2724
<PackageProjectUrl>https://github.com/NightAngell/SignalR_UnitTestingSupport</PackageProjectUrl>
2825
<RepositoryUrl>https://github.com/NightAngell/SignalR_UnitTestingSupport</RepositoryUrl>
2926
<PackageTags>UnitTestingSupport UnitTestSupport UnitTestsSupport Unit test tests testing UnitTesting UnitTest UnitTests SignalR.UnitTestingSupport AspNetCore NUnit xUnit MsTest SignalR Core</PackageTags>
3027
<PackageId>AspNetCore.SignalR.UnitTestingSupport.Common</PackageId>
31-
<Version>1.1.0</Version>
28+
<Version>2.0.0</Version>
29+
<PackageLicenseExpression>MIT</PackageLicenseExpression>
30+
<AssemblyVersion>2.0.0.0</AssemblyVersion>
31+
<GeneratePackageOnBuild>true</GeneratePackageOnBuild>
3232
</PropertyGroup>
3333

3434
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|AnyCPU'">
35-
<DocumentationFile>C:\Users\Mateusz Sobo\Desktop\UnitTestingSupport\SignalR_UnitTestingSupport\SignalR_UnitTestingSupportCommon\SignalR_UnitTestingSupportCommon.xml</DocumentationFile>
35+
<DocumentationFile>C:\Users\sobta\Desktop\update\SignalR_UnitTestingSupport\SignalR_UnitTestingSupportCommon\SignalR_UnitTestingSupportCommon.xml</DocumentationFile>
3636
</PropertyGroup>
3737

3838
<ItemGroup>
3939
<PackageReference Include="Microsoft.AspNetCore.SignalR.Core" Version="1.1.0" />
40-
<PackageReference Include="Microsoft.EntityFrameworkCore.InMemory" Version="2.2.1" />
41-
<PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite" Version="2.2.1" />
42-
<PackageReference Include="Moq" Version="4.10.1" />
40+
<PackageReference Include="Microsoft.EntityFrameworkCore.InMemory" Version="2.2.6" />
41+
<PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite" Version="2.2.6" />
42+
<PackageReference Include="Moq" Version="4.12.0" />
4343
</ItemGroup>
44-
4544
</Project>
Lines changed: 11 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,23 @@
11
<Project Sdk="Microsoft.NET.Sdk">
22

33
<PropertyGroup>
4-
<TargetFramework>netcoreapp2.1</TargetFramework>
4+
<TargetFramework>netstandard2.0</TargetFramework>
55

66
<IsPackable>true</IsPackable>
77

88
<PackageRequireLicenseAcceptance>true</PackageRequireLicenseAcceptance>
99

1010
<Copyright>Mateusz Soboń (NightAngell)</Copyright>
1111

12-
<PackageLicenseUrl>https://github.com/NightAngell/SignalR_UnitTestingSupport/blob/master/LICENSE</PackageLicenseUrl>
12+
<PackageLicenseUrl></PackageLicenseUrl>
1313

1414
<PackageProjectUrl>https://github.com/NightAngell/SignalR_UnitTestingSupport</PackageProjectUrl>
1515

1616
<RepositoryUrl>https://github.com/NightAngell/SignalR_UnitTestingSupport</RepositoryUrl>
1717

1818
<PackageTags>SignalR SignalRCore SignalRUnitTest SignalRCoreUnitTest SignalRUnitTesting SignalRCoreUnitTesting SignalRUnitTests SignalRCoreUnitTests Unit Test Tests Testing MSTest SignalRUnitTestingSupport SignalRCoreUnitTestingSupport AspNetCore AspNetCore.SignalR aspnetcore "AspNetCore SignalR Unit Test" "AspNetCore SignalR Unit Tests" "AspNetCore SignalR Unit Testing"</PackageTags>
1919

20-
<PackageReleaseNotes>Easy to use, small, SignalR Core unit testing support with MSTest and Moq. For Nunit or xUnit version see my github.
21-
*Separate common code</PackageReleaseNotes>
20+
<PackageReleaseNotes>Ported to .net standard.</PackageReleaseNotes>
2221

2322
<PackageId>SignalR.UnitTestingSupport.MSTest</PackageId>
2423

@@ -38,28 +37,23 @@
3837

3938
<GeneratePackageOnBuild>false</GeneratePackageOnBuild>
4039

41-
<Version>1.0.0</Version>
40+
<Version>2.0.0</Version>
4241

43-
<AssemblyVersion>1.0.0.0</AssemblyVersion>
42+
<AssemblyVersion>2.0.0.0</AssemblyVersion>
4443

45-
<FileVersion>1.0.0.0</FileVersion>
44+
<FileVersion>2.0.0.0</FileVersion>
45+
46+
<PackageLicenseExpression>MIT</PackageLicenseExpression>
4647
</PropertyGroup>
4748

4849
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|AnyCPU'">
49-
<DocumentationFile>C:\Users\Mateusz Sobo\Desktop\UnitTestingSupport\SignalR_UnitTestingSupport\SignalR_UnitTestingSupportMSTest\SignalR_UnitTestingSupportMSTest.xml</DocumentationFile>
50+
<DocumentationFile>C:\Users\sobta\Desktop\update\SignalR_UnitTestingSupport\SignalR_UnitTestingSupportMSTest\SignalR_UnitTestingSupportMSTest.xml</DocumentationFile>
5051
</PropertyGroup>
5152

5253
<ItemGroup>
53-
<PackageReference Include="Microsoft.AspNetCore.SignalR.Core" Version="1.1.0" />
54-
<PackageReference Include="Microsoft.EntityFrameworkCore.InMemory" Version="2.2.1" />
55-
<PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite" Version="2.2.1" />
56-
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="15.8.0" />
57-
<PackageReference Include="Moq" Version="4.10.1" />
54+
<PackageReference Include="AspNetCore.SignalR.UnitTestingSupport.Common" Version="2.0.0" />
55+
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.2.0" />
5856
<PackageReference Include="MSTest.TestFramework" Version="1.4.0" />
5957
</ItemGroup>
6058

61-
<ItemGroup>
62-
<ProjectReference Include="..\SignalR_UnitTestingSupportCommon\SignalR_UnitTestingSupportCommon.csproj" />
63-
</ItemGroup>
64-
6559
</Project>

0 commit comments

Comments
 (0)