[ADD] added test project for real

This commit is contained in:
Sem van der Hoeven
2020-10-23 21:05:05 +02:00
parent 898b579ca9
commit 052f07db93
5 changed files with 97 additions and 0 deletions

View 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();
});
};
}
}
}

View 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>

View File

@@ -0,0 +1,14 @@
using System;
namespace Client2
{
class Program
{
static void Main(string[] args)
{
Client.App app = new Client.App();
app.Run();
}
}
}

View 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()
{
}
}
}

View 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>