Skip to content

Commit 841ffb4

Browse files
Added console interaction and unit tests
1 parent a303d92 commit 841ffb4

File tree

13 files changed

+293
-0
lines changed

13 files changed

+293
-0
lines changed

Blog(Dirty)/Blog(Dirty).csproj

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
<Project Sdk="Microsoft.NET.Sdk">
2+
3+
<PropertyGroup>
4+
<OutputType>Exe</OutputType>
5+
<TargetFramework>net8.0</TargetFramework>
6+
<RootNamespace>Blog_Dirty_</RootNamespace>
7+
<ImplicitUsings>enable</ImplicitUsings>
8+
<Nullable>enable</Nullable>
9+
</PropertyGroup>
10+
11+
<ItemGroup>
12+
<Compile Remove="EFCoreAccess.cs" />
13+
<Compile Remove="UserRepository.cs" />
14+
</ItemGroup>
15+
16+
</Project>

Blog(Dirty)/Blog(Dirty).sln

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
2+
Microsoft Visual Studio Solution File, Format Version 12.00
3+
# Visual Studio Version 17
4+
VisualStudioVersion = 17.10.34928.147
5+
MinimumVisualStudioVersion = 10.0.40219.1
6+
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Blog(Dirty)", "Blog(Dirty).csproj", "{938B225D-009C-496D-867F-59C2DAE2EC0E}"
7+
EndProject
8+
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Blog.Tests", "..\Blog.Tests\Blog.Tests.csproj", "{D4E4187C-E3E2-491A-9BE4-EA653D99C39A}"
9+
EndProject
10+
Global
11+
GlobalSection(SolutionConfigurationPlatforms) = preSolution
12+
Debug|Any CPU = Debug|Any CPU
13+
Release|Any CPU = Release|Any CPU
14+
EndGlobalSection
15+
GlobalSection(ProjectConfigurationPlatforms) = postSolution
16+
{938B225D-009C-496D-867F-59C2DAE2EC0E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
17+
{938B225D-009C-496D-867F-59C2DAE2EC0E}.Debug|Any CPU.Build.0 = Debug|Any CPU
18+
{938B225D-009C-496D-867F-59C2DAE2EC0E}.Release|Any CPU.ActiveCfg = Release|Any CPU
19+
{938B225D-009C-496D-867F-59C2DAE2EC0E}.Release|Any CPU.Build.0 = Release|Any CPU
20+
{D4E4187C-E3E2-491A-9BE4-EA653D99C39A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
21+
{D4E4187C-E3E2-491A-9BE4-EA653D99C39A}.Debug|Any CPU.Build.0 = Debug|Any CPU
22+
{D4E4187C-E3E2-491A-9BE4-EA653D99C39A}.Release|Any CPU.ActiveCfg = Release|Any CPU
23+
{D4E4187C-E3E2-491A-9BE4-EA653D99C39A}.Release|Any CPU.Build.0 = Release|Any CPU
24+
EndGlobalSection
25+
GlobalSection(SolutionProperties) = preSolution
26+
HideSolutionNode = FALSE
27+
EndGlobalSection
28+
GlobalSection(ExtensibilityGlobals) = postSolution
29+
SolutionGuid = {D68B598A-04E0-47B0-92A7-F9AFBF3F8F45}
30+
EndGlobalSection
31+
EndGlobal

Blog(Dirty)/Program.cs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
using Blog_Dirty_;
2+
3+
Console.Write("Write a username: ");
4+
string username = Console.ReadLine();
5+
Console.Write("Write a password: ");
6+
string password = Console.ReadLine();
7+
8+

Blog(Dirty)/User.cs

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
using System;
2+
using System.Collections.Generic;
3+
using System.Linq;
4+
using System.Text;
5+
using System.Threading.Tasks;
6+
7+
namespace Blog_Dirty_
8+
{
9+
public class User
10+
{
11+
public User(string username, string password)
12+
{
13+
UserName = username;
14+
Password = password;
15+
}
16+
public string Password { get; set; }
17+
public string UserName { get; set; }
18+
}
19+
}

Blog.Tests/Blog.Tests.csproj

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
<Project Sdk="Microsoft.NET.Sdk">
2+
3+
<PropertyGroup>
4+
<TargetFramework>net8.0</TargetFramework>
5+
<ImplicitUsings>enable</ImplicitUsings>
6+
<Nullable>enable</Nullable>
7+
8+
<IsPackable>false</IsPackable>
9+
<IsTestProject>true</IsTestProject>
10+
</PropertyGroup>
11+
12+
<ItemGroup>
13+
<Compile Remove="UserRepositoryTest.cs" />
14+
</ItemGroup>
15+
16+
<ItemGroup>
17+
<PackageReference Include="coverlet.collector" Version="6.0.0" />
18+
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.8.0" />
19+
<PackageReference Include="NUnit" Version="3.14.0" />
20+
<PackageReference Include="NUnit.Analyzers" Version="3.9.0" />
21+
<PackageReference Include="NUnit3TestAdapter" Version="4.5.0" />
22+
</ItemGroup>
23+
24+
<ItemGroup>
25+
<ProjectReference Include="..\Blog(Dirty)\Blog(Dirty).csproj" />
26+
</ItemGroup>
27+
28+
<ItemGroup>
29+
<Using Include="NUnit.Framework" />
30+
</ItemGroup>
31+
32+
</Project>

Blog.Tests/UnitTest1.cs

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
using Blog_Dirty_;
2+
using Microsoft.VisualBasic.FileIO;
3+
4+
namespace Blog.Tests
5+
{
6+
[TestFixture]
7+
public class Tests
8+
{
9+
private string username = "username";
10+
private string password = "password";
11+
[SetUp]
12+
public void Setup()
13+
{
14+
}
15+
16+
17+
[Test]
18+
public void usernameTest()
19+
{
20+
User user = new User(username, password);
21+
22+
Assert.Pass(user.UserName = username);
23+
}
24+
[Test]
25+
public void passwordTest()
26+
{
27+
User user = new User(username, password);
28+
29+
Assert.Pass(user.Password = password);
30+
}
31+
}
32+
}

Blog/Blog.csproj

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
<Project Sdk="Microsoft.NET.Sdk.Web">
2+
3+
<PropertyGroup>
4+
<TargetFramework>net8.0</TargetFramework>
5+
<Nullable>enable</Nullable>
6+
<ImplicitUsings>enable</ImplicitUsings>
7+
</PropertyGroup>
8+
9+
</Project>

Blog/Blog.sln

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
2+
Microsoft Visual Studio Solution File, Format Version 12.00
3+
# Visual Studio Version 17
4+
VisualStudioVersion = 17.10.34928.147
5+
MinimumVisualStudioVersion = 10.0.40219.1
6+
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Blog", "Blog.csproj", "{FFC565F2-5DFF-45DD-B01E-3CABE9E59364}"
7+
EndProject
8+
Global
9+
GlobalSection(SolutionConfigurationPlatforms) = preSolution
10+
Debug|Any CPU = Debug|Any CPU
11+
Release|Any CPU = Release|Any CPU
12+
EndGlobalSection
13+
GlobalSection(ProjectConfigurationPlatforms) = postSolution
14+
{FFC565F2-5DFF-45DD-B01E-3CABE9E59364}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
15+
{FFC565F2-5DFF-45DD-B01E-3CABE9E59364}.Debug|Any CPU.Build.0 = Debug|Any CPU
16+
{FFC565F2-5DFF-45DD-B01E-3CABE9E59364}.Release|Any CPU.ActiveCfg = Release|Any CPU
17+
{FFC565F2-5DFF-45DD-B01E-3CABE9E59364}.Release|Any CPU.Build.0 = Release|Any CPU
18+
EndGlobalSection
19+
GlobalSection(SolutionProperties) = preSolution
20+
HideSolutionNode = FALSE
21+
EndGlobalSection
22+
GlobalSection(ExtensibilityGlobals) = postSolution
23+
SolutionGuid = {CDF2A8F4-F13E-4F42-8E8F-07494F83A2BB}
24+
EndGlobalSection
25+
EndGlobal

Blog/Program.cs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
var builder = WebApplication.CreateBuilder(args);
2+
var app = builder.Build();
3+
4+
app.MapGet("/", () => "Hello World!");
5+
6+
app.Run();
Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
{
2+
"$schema": "http://json.schemastore.org/launchsettings.json",
3+
"iisSettings": {
4+
"windowsAuthentication": false,
5+
"anonymousAuthentication": true,
6+
"iisExpress": {
7+
"applicationUrl": "http://localhost:25983",
8+
"sslPort": 44371
9+
}
10+
},
11+
"profiles": {
12+
"http": {
13+
"commandName": "Project",
14+
"dotnetRunMessages": true,
15+
"launchBrowser": true,
16+
"applicationUrl": "http://localhost:5057",
17+
"environmentVariables": {
18+
"ASPNETCORE_ENVIRONMENT": "Development"
19+
}
20+
},
21+
"https": {
22+
"commandName": "Project",
23+
"dotnetRunMessages": true,
24+
"launchBrowser": true,
25+
"applicationUrl": "https://localhost:7183;http://localhost:5057",
26+
"environmentVariables": {
27+
"ASPNETCORE_ENVIRONMENT": "Development"
28+
}
29+
},
30+
"IIS Express": {
31+
"commandName": "IISExpress",
32+
"launchBrowser": true,
33+
"environmentVariables": {
34+
"ASPNETCORE_ENVIRONMENT": "Development"
35+
}
36+
}
37+
}
38+
}

0 commit comments

Comments
 (0)