[ADD] added test project for real
This commit is contained in:
37
Client/ViewModels/LoginViewModel.cs
Normal file
37
Client/ViewModels/LoginViewModel.cs
Normal file
@@ -0,0 +1,37 @@
|
||||
using SharedClientServer;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
using System.Windows;
|
||||
|
||||
namespace Client.ViewModels
|
||||
{
|
||||
|
||||
class LoginViewModel
|
||||
{
|
||||
ClientData data = ClientData.Instance;
|
||||
private Window window;
|
||||
|
||||
public LoginViewModel(Window window)
|
||||
{
|
||||
this.window = window;
|
||||
}
|
||||
public void UsernameEntered(string name) {
|
||||
User user = new User(name);
|
||||
|
||||
Client client = new Client(user.Username);
|
||||
client.OnSuccessfullConnect = () =>
|
||||
{
|
||||
// because we need to start the main window on a UI thread, we need to let the dispatcher handle it, which will execute the code on the ui thread
|
||||
Application.Current.Dispatcher.Invoke(delegate {
|
||||
data.User = user;
|
||||
data.Client = client;
|
||||
client.SendMessage(JSONConvert.ConstructLobbyRequestMessage());
|
||||
MainWindow startWindow = new MainWindow();
|
||||
startWindow.Show();
|
||||
window.Close();
|
||||
});
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
||||
12
Eindproject/Client2/Client2.csproj
Normal file
12
Eindproject/Client2/Client2.csproj
Normal file
@@ -0,0 +1,12 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<OutputType>Exe</OutputType>
|
||||
<TargetFramework>netcoreapp3.1</TargetFramework>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\..\Client\Client.csproj" />
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
||||
14
Eindproject/Client2/Program.cs
Normal file
14
Eindproject/Client2/Program.cs
Normal file
@@ -0,0 +1,14 @@
|
||||
using System;
|
||||
|
||||
namespace Client2
|
||||
{
|
||||
class Program
|
||||
{
|
||||
static void Main(string[] args)
|
||||
{
|
||||
Client.App app = new Client.App();
|
||||
app.Run();
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
15
Eindproject/Tests/JSONConvertTest.cs
Normal file
15
Eindproject/Tests/JSONConvertTest.cs
Normal file
@@ -0,0 +1,15 @@
|
||||
using Microsoft.VisualStudio.TestTools.UnitTesting;
|
||||
using SharedClientServer;
|
||||
using Xunit.Sdk;
|
||||
|
||||
namespace Tests
|
||||
{
|
||||
[TestClass]
|
||||
public class JSONConvertTest
|
||||
{
|
||||
[TestMethod]
|
||||
public void TestMethod1()
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
19
Eindproject/Tests/Tests.csproj
Normal file
19
Eindproject/Tests/Tests.csproj
Normal file
@@ -0,0 +1,19 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFramework>netcoreapp3.1</TargetFramework>
|
||||
|
||||
<IsPackable>false</IsPackable>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.5.0" />
|
||||
<PackageReference Include="MSTest.TestAdapter" Version="2.1.0" />
|
||||
<PackageReference Include="MSTest.TestFramework" Version="2.1.0" />
|
||||
<PackageReference Include="coverlet.collector" Version="1.2.0" />
|
||||
<PackageReference Include="xunit.extensibility.execution" Version="2.4.1" />
|
||||
</ItemGroup>
|
||||
|
||||
<Import Project="..\..\SharedClientServer\SharedClientServer.projitems" Label="Shared" />
|
||||
|
||||
</Project>
|
||||
Reference in New Issue
Block a user