Compare commits
22 Commits
dataOnTabs
...
unittest-s
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
cd1a95ae85 | ||
|
|
cad1a508e6 | ||
|
|
06e1d1edee | ||
|
|
7c98aa6536 | ||
|
|
c1ee84fd2e | ||
|
|
acc2fddf82 | ||
|
|
a333d6cd8d | ||
|
|
c48e396e81 | ||
|
|
da9d3184a1 | ||
|
|
2b6ea121c9 | ||
|
|
478a2daab7 | ||
|
|
8b8dd901c7 | ||
|
|
aa5ea7a3e0 | ||
|
|
aeb5d59ce9 | ||
|
|
ab1662f0fe | ||
|
|
f07c3f9484 | ||
|
|
2adfcc5bd7 | ||
|
|
3acdc942bc | ||
|
|
84cbcb4a6d | ||
|
|
8385f09313 | ||
|
|
3ea42b65ed | ||
|
|
55d3dd4eee |
@@ -19,11 +19,11 @@
|
|||||||
</DataTemplate>
|
</DataTemplate>
|
||||||
|
|
||||||
<ResourceDictionary.MergedDictionaries>
|
<ResourceDictionary.MergedDictionaries>
|
||||||
<ResourceDictionary Source="Styles/Fonts.xaml"/>
|
<ResourceDictionary Source="WPFStuff/Styles/Fonts.xaml"/>
|
||||||
<ResourceDictionary Source="Styles/Colors.xaml"/>
|
<ResourceDictionary Source="WPFStuff/Styles/Colors.xaml"/>
|
||||||
<ResourceDictionary Source="Styles/Buttons.xaml"/>
|
<ResourceDictionary Source="WPFStuff/Styles/Buttons.xaml"/>
|
||||||
<ResourceDictionary Source="Styles/Texts.xaml"/>
|
<ResourceDictionary Source="WPFStuff/Styles/Texts.xaml"/>
|
||||||
<ResourceDictionary Source="Styles/Windows.xaml"/>
|
<ResourceDictionary Source="WPFStuff/Styles/Windows.xaml"/>
|
||||||
</ResourceDictionary.MergedDictionaries>
|
</ResourceDictionary.MergedDictionaries>
|
||||||
</ResourceDictionary>
|
</ResourceDictionary>
|
||||||
</Application.Resources>
|
</Application.Resources>
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
using RH_Engine;
|
using RH_Engine;
|
||||||
@@ -236,7 +236,7 @@ namespace ClientApp.Utils
|
|||||||
Write("Starting route follow...");
|
Write("Starting route follow...");
|
||||||
FollowingRoute = true;
|
FollowingRoute = true;
|
||||||
|
|
||||||
SendMessageAndOnResponse(mainCommand.AddBikeModel("bikeID"), "bikeID",
|
SendMessageAndOnResponse(mainCommand.AddBikeModelAnim("bikeID", 0.01f), "bikeID",
|
||||||
(message) =>
|
(message) =>
|
||||||
{
|
{
|
||||||
bikeId = JSONParser.GetResponseUuid(message);
|
bikeId = JSONParser.GetResponseUuid(message);
|
||||||
|
|||||||
@@ -5,6 +5,7 @@
|
|||||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||||
xmlns:local="clr-namespace:ClientApp.Views"
|
xmlns:local="clr-namespace:ClientApp.Views"
|
||||||
xmlns:viewModels="clr-namespace:ClientApp.ViewModels"
|
xmlns:viewModels="clr-namespace:ClientApp.ViewModels"
|
||||||
|
xmlns:Util="clr-namespace:Util.MagicCode"
|
||||||
mc:Ignorable="d"
|
mc:Ignorable="d"
|
||||||
ShowsNavigationUI="False"
|
ShowsNavigationUI="False"
|
||||||
d:DesignHeight="450" d:DesignWidth="800">
|
d:DesignHeight="450" d:DesignWidth="800">
|
||||||
@@ -14,9 +15,9 @@
|
|||||||
</DockPanel.Background>
|
</DockPanel.Background>
|
||||||
<StackPanel VerticalAlignment="Center" Width="auto">
|
<StackPanel VerticalAlignment="Center" Width="auto">
|
||||||
<Label Content="Username" HorizontalContentAlignment="Center" />
|
<Label Content="Username" HorizontalContentAlignment="Center" />
|
||||||
<TextBox x:Name="Username" Text="{Binding Username}" TextWrapping="Wrap" Width="120"/>
|
<TextBox x:Name="Username" Text="{Binding Username}" TextWrapping="Wrap" Width="120" Util:FocusAdvancement.AdvancesByEnterKey="True" />
|
||||||
<Label Content="Password" HorizontalContentAlignment="Center"/>
|
<Label Content="Password" HorizontalContentAlignment="Center"/>
|
||||||
<PasswordBox x:Name="Password" Width="120"/>
|
<PasswordBox x:Name="Password" Width="120" Util:FocusAdvancement.AdvancesByEnterKey="True"/>
|
||||||
<Button x:Name="Login" Content="Login" Command="{Binding LoginCommand}" CommandParameter="{Binding ElementName=Password}" Margin="0,20,0,0" Width="120"/>
|
<Button x:Name="Login" Content="Login" Command="{Binding LoginCommand}" CommandParameter="{Binding ElementName=Password}" Margin="0,20,0,0" Width="120"/>
|
||||||
<Popup IsOpen="{Binding InvertedLoginStatus}" PopupAnimation = "Slide" HorizontalAlignment="Center">
|
<Popup IsOpen="{Binding InvertedLoginStatus}" PopupAnimation = "Slide" HorizontalAlignment="Center">
|
||||||
<Label Content="Login failed" Foreground="Red" HorizontalAlignment="Center" HorizontalContentAlignment="Center" Background="Transparent"/>
|
<Label Content="Login failed" Foreground="Red" HorizontalAlignment="Center" HorizontalContentAlignment="Center" Background="Transparent"/>
|
||||||
|
|||||||
@@ -20,11 +20,11 @@
|
|||||||
</DataTemplate>
|
</DataTemplate>
|
||||||
|
|
||||||
<ResourceDictionary.MergedDictionaries>
|
<ResourceDictionary.MergedDictionaries>
|
||||||
<ResourceDictionary Source="Styles/Fonts.xaml"/>
|
<ResourceDictionary Source="WPFStuff/Styles/Fonts.xaml"/>
|
||||||
<ResourceDictionary Source="Styles/Colors.xaml"/>
|
<ResourceDictionary Source="WPFStuff/Styles/Colors.xaml"/>
|
||||||
<ResourceDictionary Source="Styles/Buttons.xaml"/>
|
<ResourceDictionary Source="WPFStuff/Styles/Buttons.xaml"/>
|
||||||
<ResourceDictionary Source="Styles/Texts.xaml"/>
|
<ResourceDictionary Source="WPFStuff/Styles/Texts.xaml"/>
|
||||||
<ResourceDictionary Source="Styles/Windows.xaml"/>
|
<ResourceDictionary Source="WPFStuff/Styles/Windows.xaml"/>
|
||||||
</ResourceDictionary.MergedDictionaries>
|
</ResourceDictionary.MergedDictionaries>
|
||||||
</ResourceDictionary>
|
</ResourceDictionary>
|
||||||
|
|
||||||
|
|||||||
@@ -129,7 +129,7 @@ namespace DoctorApp.Utils
|
|||||||
{
|
{
|
||||||
MainViewModel.TransferDataToClientBPM(payloadbytes);
|
MainViewModel.TransferDataToClientBPM(payloadbytes);
|
||||||
}
|
}
|
||||||
|
Array.Copy(totalBuffer, expectedMessageLength, totalBuffer, 0, (totalBufferReceived - expectedMessageLength)); //maybe unsafe idk
|
||||||
totalBufferReceived -= expectedMessageLength;
|
totalBufferReceived -= expectedMessageLength;
|
||||||
expectedMessageLength = BitConverter.ToInt32(totalBuffer, 0);
|
expectedMessageLength = BitConverter.ToInt32(totalBuffer, 0);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -87,11 +87,20 @@ namespace DoctorApp.ViewModels
|
|||||||
{
|
{
|
||||||
//TODO
|
//TODO
|
||||||
//Parsen van de data you fuck
|
//Parsen van de data you fuck
|
||||||
PatientInfo.BPM = bytes[1];
|
if(bytes[0] == 0x00)
|
||||||
if (MySelectedItem == "BPM")
|
|
||||||
{
|
{
|
||||||
Chart.NewValue(PatientInfo.BPM);
|
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
PatientInfo.BPM = bytes[1];
|
||||||
|
if (MySelectedItem == "BPM")
|
||||||
|
{
|
||||||
|
Chart.NewValue(PatientInfo.BPM);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -108,17 +117,18 @@ namespace DoctorApp.ViewModels
|
|||||||
}
|
}
|
||||||
PatientInfo.Distance = bytes[3];
|
PatientInfo.Distance = bytes[3];
|
||||||
PatientInfo.Speed = (bytes[4] | (bytes[5] << 8)) * 0.01;
|
PatientInfo.Speed = (bytes[4] | (bytes[5] << 8)) * 0.01;
|
||||||
|
if (MySelectedItem == "Speed")
|
||||||
|
{
|
||||||
|
Chart.NewValue(PatientInfo.Speed);
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
case 0x19:
|
case 0x19:
|
||||||
PatientInfo.Acc_Power = bytes[3] | (bytes[4] << 8);
|
PatientInfo.Acc_Power = bytes[3] | (bytes[4] << 8);
|
||||||
PatientInfo.Curr_Power = (bytes[5]) | (bytes[6] & 0b00001111) << 8;
|
PatientInfo.Curr_Power = (bytes[5]) | (bytes[6] & 0b00001111) << 8;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
throw new Exception();
|
Debug.WriteLine("rip");
|
||||||
}
|
break;
|
||||||
if (MySelectedItem == "Speed")
|
|
||||||
{
|
|
||||||
Chart.NewValue(PatientInfo.Speed);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -56,7 +56,7 @@ namespace DoctorApp.ViewModels
|
|||||||
{
|
{
|
||||||
if(item.PatientInfo.Username == username)
|
if(item.PatientInfo.Username == username)
|
||||||
{
|
{
|
||||||
item.BikeData(bytes);
|
item.BikeData(DataParser.getDataWithoutName(bytes,0,8));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -68,7 +68,7 @@ namespace DoctorApp.ViewModels
|
|||||||
{
|
{
|
||||||
if (item.PatientInfo.Username == username)
|
if (item.PatientInfo.Username == username)
|
||||||
{
|
{
|
||||||
item.BikeData(bytes);
|
item.BikeData(DataParser.getDataWithoutName(bytes, 0,2));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -5,6 +5,7 @@
|
|||||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||||
xmlns:local="clr-namespace:DoctorApp.Views"
|
xmlns:local="clr-namespace:DoctorApp.Views"
|
||||||
xmlns:viewModels="clr-namespace:DoctorApp.ViewModels"
|
xmlns:viewModels="clr-namespace:DoctorApp.ViewModels"
|
||||||
|
xmlns:Util="clr-namespace:Util.MagicCode"
|
||||||
mc:Ignorable="d"
|
mc:Ignorable="d"
|
||||||
d:DesignHeight="450" d:DesignWidth="800"
|
d:DesignHeight="450" d:DesignWidth="800"
|
||||||
>
|
>
|
||||||
@@ -12,9 +13,9 @@
|
|||||||
<DockPanel>
|
<DockPanel>
|
||||||
<StackPanel VerticalAlignment="Center" Width="auto">
|
<StackPanel VerticalAlignment="Center" Width="auto">
|
||||||
<Label Content="Username" HorizontalContentAlignment="Center" />
|
<Label Content="Username" HorizontalContentAlignment="Center" />
|
||||||
<TextBox x:Name="Username" Text="{Binding Username}" TextWrapping="Wrap" Width="120"/>
|
<TextBox x:Name="Username" Text="{Binding Username}" TextWrapping="Wrap" Width="120" Util:FocusAdvancement.AdvancesByEnterKey="True"/>
|
||||||
<Label Content="Password" HorizontalContentAlignment="Center"/>
|
<Label Content="Password" HorizontalContentAlignment="Center"/>
|
||||||
<PasswordBox x:Name="Password" Width="120"/>
|
<PasswordBox x:Name="Password" Width="120" Util:FocusAdvancement.AdvancesByEnterKey="True"/>
|
||||||
<Button x:Name="Login" Content="Login" Command="{Binding LoginCommand}" CommandParameter="{Binding ElementName=Password}" Margin="0,20,0,0" Width="120"/>
|
<Button x:Name="Login" Content="Login" Command="{Binding LoginCommand}" CommandParameter="{Binding ElementName=Password}" Margin="0,20,0,0" Width="120"/>
|
||||||
<Popup IsOpen="{Binding InvertedLoginStatus}" PopupAnimation = "Fade" HorizontalAlignment="Left">
|
<Popup IsOpen="{Binding InvertedLoginStatus}" PopupAnimation = "Fade" HorizontalAlignment="Left">
|
||||||
<Label Content="Login failed" Foreground="Red" Background="#FFFF" />
|
<Label Content="Login failed" Foreground="Red" Background="#FFFF" />
|
||||||
|
|||||||
@@ -4,9 +4,11 @@ using System;
|
|||||||
using System.Diagnostics;
|
using System.Diagnostics;
|
||||||
using System.Globalization;
|
using System.Globalization;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
|
using System.Printing.IndexedProperties;
|
||||||
using System.Runtime.InteropServices.WindowsRuntime;
|
using System.Runtime.InteropServices.WindowsRuntime;
|
||||||
using System.Security.Cryptography;
|
using System.Security.Cryptography;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
|
using System.Windows.Media.Animation;
|
||||||
|
|
||||||
namespace Util
|
namespace Util
|
||||||
{
|
{
|
||||||
@@ -41,6 +43,12 @@ namespace Util
|
|||||||
|
|
||||||
return Encoding.ASCII.GetBytes(JsonConvert.SerializeObject(json));
|
return Encoding.ASCII.GetBytes(JsonConvert.SerializeObject(json));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
internal static string getNameFromBytesBike(byte[] bytes)
|
||||||
|
{
|
||||||
|
return getName(bytes, 8, bytes.Length - 8);
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// converts the given string parameter into a message using our protocol.
|
/// converts the given string parameter into a message using our protocol.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@@ -59,6 +67,18 @@ namespace Util
|
|||||||
return Encoding.ASCII.GetBytes(JsonConvert.SerializeObject(json));
|
return Encoding.ASCII.GetBytes(JsonConvert.SerializeObject(json));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
internal static string getNameFromBytesBPM(byte[] bytes)
|
||||||
|
{
|
||||||
|
return getName(bytes, 2, bytes.Length - 2);
|
||||||
|
}
|
||||||
|
|
||||||
|
private static string getName(byte[] bytes , int offset, int lenght)
|
||||||
|
{
|
||||||
|
byte[] nameArray = new byte[lenght];
|
||||||
|
Array.Copy(bytes, offset, nameArray, 0, lenght);
|
||||||
|
return Encoding.UTF8.GetString(nameArray);
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// creates a message for when the doctor wants to log in.
|
/// creates a message for when the doctor wants to log in.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@@ -271,8 +291,12 @@ namespace Util
|
|||||||
|
|
||||||
private static byte[] GetRawDataDoctor(byte[] payload, string username, byte messageID)
|
private static byte[] GetRawDataDoctor(byte[] payload, string username, byte messageID)
|
||||||
{
|
{
|
||||||
|
Debug.WriteLine(BitConverter.ToString(Encoding.ASCII.GetBytes(username)));
|
||||||
return getMessage(payload.Concat(Encoding.ASCII.GetBytes(username)).ToArray(), messageID);
|
byte[] nameArray = Encoding.ASCII.GetBytes(username);
|
||||||
|
byte[] total = new byte[nameArray.Length + payload.Length];
|
||||||
|
Array.Copy(payload, 0, total, 0, payload.Length);
|
||||||
|
Array.Copy(nameArray,0,total,payload.Length,nameArray.Length);
|
||||||
|
return getMessage(total,messageID);
|
||||||
|
|
||||||
}
|
}
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -441,6 +465,13 @@ namespace Util
|
|||||||
return getJsonMessage(MESSAGE, data);
|
return getJsonMessage(MESSAGE, data);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static byte[] getDataWithoutName(byte[] bytes, int offset, int length)
|
||||||
|
{
|
||||||
|
byte[] data = new byte[length];
|
||||||
|
Array.Copy(bytes, offset, data, 0, length);
|
||||||
|
return data;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -11,27 +11,28 @@
|
|||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<Compile Include="$(MSBuildThisFileDirectory)DataParser.cs" />
|
<Compile Include="$(MSBuildThisFileDirectory)DataParser.cs" />
|
||||||
<Compile Include="$(MSBuildThisFileDirectory)Hasher.cs" />
|
<Compile Include="$(MSBuildThisFileDirectory)Hasher.cs" />
|
||||||
<Compile Include="$(MSBuildThisFileDirectory)MagicCode\WindowResizer.cs" />
|
<Compile Include="$(MSBuildThisFileDirectory)WPFStuff\MagicCode\FocusAdvancement.cs" />
|
||||||
<Compile Include="$(MSBuildThisFileDirectory)ObservableObject.cs" />
|
<Compile Include="$(MSBuildThisFileDirectory)WPFStuff\MagicCode\WindowResizer.cs" />
|
||||||
|
<Compile Include="$(MSBuildThisFileDirectory)WPFStuff\ObservableObject.cs" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<Page Include="$(MSBuildThisFileDirectory)Styles\Buttons.xaml">
|
<Page Include="$(MSBuildThisFileDirectory)WPFStuff\Styles\Buttons.xaml">
|
||||||
<SubType>Designer</SubType>
|
<SubType>Designer</SubType>
|
||||||
<Generator>MSBuild:Compile</Generator>
|
<Generator>MSBuild:Compile</Generator>
|
||||||
</Page>
|
</Page>
|
||||||
<Page Include="$(MSBuildThisFileDirectory)Styles\Colors.xaml">
|
<Page Include="$(MSBuildThisFileDirectory)WPFStuff\Styles\Colors.xaml">
|
||||||
<SubType>Designer</SubType>
|
<SubType>Designer</SubType>
|
||||||
<Generator>MSBuild:Compile</Generator>
|
<Generator>MSBuild:Compile</Generator>
|
||||||
</Page>
|
</Page>
|
||||||
<Page Include="$(MSBuildThisFileDirectory)Styles\Fonts.xaml">
|
<Page Include="$(MSBuildThisFileDirectory)WPFStuff\Styles\Fonts.xaml">
|
||||||
<SubType>Designer</SubType>
|
<SubType>Designer</SubType>
|
||||||
<Generator>MSBuild:Compile</Generator>
|
<Generator>MSBuild:Compile</Generator>
|
||||||
</Page>
|
</Page>
|
||||||
<Page Include="$(MSBuildThisFileDirectory)Styles\Texts.xaml">
|
<Page Include="$(MSBuildThisFileDirectory)WPFStuff\Styles\Texts.xaml">
|
||||||
<SubType>Designer</SubType>
|
<SubType>Designer</SubType>
|
||||||
<Generator>MSBuild:Compile</Generator>
|
<Generator>MSBuild:Compile</Generator>
|
||||||
</Page>
|
</Page>
|
||||||
<Page Include="$(MSBuildThisFileDirectory)Styles\Windows.xaml">
|
<Page Include="$(MSBuildThisFileDirectory)WPFStuff\Styles\Windows.xaml">
|
||||||
<SubType>Designer</SubType>
|
<SubType>Designer</SubType>
|
||||||
<Generator>MSBuild:Compile</Generator>
|
<Generator>MSBuild:Compile</Generator>
|
||||||
</Page>
|
</Page>
|
||||||
|
|||||||
40
Hashing/WPFStuff/MagicCode/FocusAdvancement.cs
Normal file
40
Hashing/WPFStuff/MagicCode/FocusAdvancement.cs
Normal file
@@ -0,0 +1,40 @@
|
|||||||
|
using System;
|
||||||
|
using System.Windows;
|
||||||
|
using System.Windows.Input;
|
||||||
|
|
||||||
|
namespace Util.MagicCode
|
||||||
|
{
|
||||||
|
public static class FocusAdvancement
|
||||||
|
{
|
||||||
|
public static bool GetAdvancesByEnterKey(DependencyObject obj)
|
||||||
|
{
|
||||||
|
return (bool)obj.GetValue(AdvancesByEnterKeyProperty);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void SetAdvancesByEnterKey(DependencyObject obj, bool value)
|
||||||
|
{
|
||||||
|
obj.SetValue(AdvancesByEnterKeyProperty, value);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static readonly DependencyProperty AdvancesByEnterKeyProperty =
|
||||||
|
DependencyProperty.RegisterAttached("AdvancesByEnterKey", typeof(bool), typeof(FocusAdvancement),
|
||||||
|
new UIPropertyMetadata(OnAdvancesByEnterKeyPropertyChanged));
|
||||||
|
|
||||||
|
static void OnAdvancesByEnterKeyPropertyChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
|
||||||
|
{
|
||||||
|
var element = d as UIElement;
|
||||||
|
if (element == null) return;
|
||||||
|
|
||||||
|
if ((bool)e.NewValue) element.KeyDown += Keydown;
|
||||||
|
else element.KeyDown -= Keydown;
|
||||||
|
}
|
||||||
|
|
||||||
|
static void Keydown(object sender, KeyEventArgs e)
|
||||||
|
{
|
||||||
|
if (!e.Key.Equals(Key.Enter)) return;
|
||||||
|
|
||||||
|
var element = sender as UIElement;
|
||||||
|
if (element != null) element.MoveFocus(new TraversalRequest(FocusNavigationDirection.Next));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
65
Hashing/WPFStuff/Styles/Buttons.xaml
Normal file
65
Hashing/WPFStuff/Styles/Buttons.xaml
Normal file
@@ -0,0 +1,65 @@
|
|||||||
|
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||||
|
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||||
|
xmlns:local="clr-namespace:ClientApp">
|
||||||
|
|
||||||
|
<ResourceDictionary.MergedDictionaries>
|
||||||
|
<ResourceDictionary Source="Colors.xaml"/>
|
||||||
|
</ResourceDictionary.MergedDictionaries>
|
||||||
|
|
||||||
|
<Style TargetType="{x:Type Button}" x:Key="Hoverless">
|
||||||
|
<Setter Property="Background" Value="Transparent"/>
|
||||||
|
<Setter Property="BorderThickness" Value="0"/>
|
||||||
|
<Setter Property="Template">
|
||||||
|
<Setter.Value>
|
||||||
|
<ControlTemplate TargetType="{x:Type Button}">
|
||||||
|
<Border Padding="{TemplateBinding Padding}" Background="{TemplateBinding Background}">
|
||||||
|
<ContentPresenter VerticalAlignment="Center" HorizontalAlignment="Center"/>
|
||||||
|
</Border>
|
||||||
|
</ControlTemplate>
|
||||||
|
</Setter.Value>
|
||||||
|
</Setter>
|
||||||
|
</Style>
|
||||||
|
|
||||||
|
<Style TargetType="{x:Type Button}" x:Key="SystemIconButton" BasedOn="{StaticResource Hoverless}" >
|
||||||
|
<Setter Property="WindowChrome.IsHitTestVisibleInChrome" Value="True"/>
|
||||||
|
<Setter Property="Padding" Value="4"/>
|
||||||
|
</Style>
|
||||||
|
|
||||||
|
<Style TargetType="{x:Type Button}" x:Key="WindowControlButton">
|
||||||
|
<Setter Property="WindowChrome.IsHitTestVisibleInChrome" Value="True"/>
|
||||||
|
<Setter Property="Background" Value="Transparent"/>
|
||||||
|
<Setter Property="VerticalAlignment" Value="Stretch"/>
|
||||||
|
<Setter Property="Foreground" Value="{StaticResource ForegroundMainBrush}"/>
|
||||||
|
<Setter Property="Padding" Value="6"/>
|
||||||
|
|
||||||
|
<Setter Property="LayoutTransform">
|
||||||
|
<Setter.Value>
|
||||||
|
<ScaleTransform ScaleX="2"/>
|
||||||
|
</Setter.Value>
|
||||||
|
</Setter>
|
||||||
|
|
||||||
|
<Setter Property="Template">
|
||||||
|
<Setter.Value>
|
||||||
|
<ControlTemplate TargetType="{x:Type Button}">
|
||||||
|
<Border Padding="{TemplateBinding Padding}" Background="{TemplateBinding Background}">
|
||||||
|
<ContentPresenter VerticalAlignment="Center" HorizontalAlignment="Center"/>
|
||||||
|
</Border>
|
||||||
|
</ControlTemplate>
|
||||||
|
</Setter.Value>
|
||||||
|
</Setter>
|
||||||
|
|
||||||
|
<Style.Triggers>
|
||||||
|
<Trigger Property="IsMouseOver" Value="True">
|
||||||
|
<Setter Property="Background" Value="{StaticResource BackgroundSemiLightBrush}"/>
|
||||||
|
</Trigger>
|
||||||
|
</Style.Triggers>
|
||||||
|
</Style>
|
||||||
|
|
||||||
|
<Style TargetType="{x:Type Button}" x:Key="WindowCloseButton" BasedOn="{StaticResource WindowControlButton}">
|
||||||
|
<Style.Triggers>
|
||||||
|
<Trigger Property="IsMouseOver" Value="True">
|
||||||
|
<Setter Property="Background" Value="Red"/>
|
||||||
|
</Trigger>
|
||||||
|
</Style.Triggers>
|
||||||
|
</Style>
|
||||||
|
</ResourceDictionary>
|
||||||
25
Hashing/WPFStuff/Styles/Colors.xaml
Normal file
25
Hashing/WPFStuff/Styles/Colors.xaml
Normal file
@@ -0,0 +1,25 @@
|
|||||||
|
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||||
|
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||||
|
xmlns:local="clr-namespace:ClientApp">
|
||||||
|
|
||||||
|
<Color x:Key="BackgroundLight">#efefef</Color>
|
||||||
|
<SolidColorBrush x:Key="BackgroundLightBrush" Color="{StaticResource BackgroundLight}"/>
|
||||||
|
|
||||||
|
|
||||||
|
<Color x:Key="BackgroundVeryLight">#fafafa</Color>
|
||||||
|
<SolidColorBrush x:Key="BackgroundVeryLightBrush" Color="{StaticResource BackgroundVeryLight}"/>
|
||||||
|
|
||||||
|
<Color x:Key="BackgroundSemiLight">#d7d7d7</Color>
|
||||||
|
<SolidColorBrush x:Key="BackgroundSemiLightBrush" Color="{StaticResource BackgroundSemiLight}"/>
|
||||||
|
|
||||||
|
<Color x:Key="ForegroundMain">#686868</Color>
|
||||||
|
<SolidColorBrush x:Key="ForegroundMainBrush" Color="{StaticResource ForegroundMain}"/>
|
||||||
|
|
||||||
|
<Color x:Key="ForegroundVeryDark">#000</Color>
|
||||||
|
<SolidColorBrush x:Key="ForegroundVeryDarkBrush" Color="{StaticResource ForegroundVeryDark}"/>
|
||||||
|
|
||||||
|
<Color x:Key="ForegroundWhite">#fff</Color>
|
||||||
|
<SolidColorBrush x:Key="ForegroundWhiteBrush" Color="{StaticResource ForegroundWhite}"/>
|
||||||
|
|
||||||
|
|
||||||
|
</ResourceDictionary>
|
||||||
5
Hashing/WPFStuff/Styles/Fonts.xaml
Normal file
5
Hashing/WPFStuff/Styles/Fonts.xaml
Normal file
@@ -0,0 +1,5 @@
|
|||||||
|
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||||
|
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||||
|
xmlns:local="clr-namespace:ClientApp">
|
||||||
|
|
||||||
|
</ResourceDictionary>
|
||||||
11
Hashing/WPFStuff/Styles/Texts.xaml
Normal file
11
Hashing/WPFStuff/Styles/Texts.xaml
Normal file
@@ -0,0 +1,11 @@
|
|||||||
|
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||||
|
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||||
|
xmlns:local="clr-namespace:ClientApp">
|
||||||
|
|
||||||
|
<Style TargetType="{x:Type TextBlock}" x:Key="HeaderText">
|
||||||
|
<Setter Property="Foreground" Value="{StaticResource ForegroundMainBrush}"/>
|
||||||
|
<Setter Property="VerticalAlignment" Value="Center"/>
|
||||||
|
<Setter Property="HorizontalAlignment" Value="Center"/>
|
||||||
|
<Setter Property="Margin" Value="0 4"/>
|
||||||
|
</Style>
|
||||||
|
</ResourceDictionary>
|
||||||
5
Hashing/WPFStuff/Styles/Windows.xaml
Normal file
5
Hashing/WPFStuff/Styles/Windows.xaml
Normal file
@@ -0,0 +1,5 @@
|
|||||||
|
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||||
|
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||||
|
xmlns:local="clr-namespace:ClientApp">
|
||||||
|
|
||||||
|
</ResourceDictionary>
|
||||||
@@ -109,7 +109,8 @@ namespace Hardware.Simulators
|
|||||||
|
|
||||||
private byte check(int value)
|
private byte check(int value)
|
||||||
{
|
{
|
||||||
return value > 255 ? Convert.ToByte(255) : Convert.ToByte(value);
|
|
||||||
|
return value > 255 ? Convert.ToByte(255) : value < 0 ? Convert.ToByte(0) : Convert.ToByte(value);
|
||||||
}
|
}
|
||||||
|
|
||||||
//Generate an ANT message for BPM
|
//Generate an ANT message for BPM
|
||||||
|
|||||||
@@ -15,8 +15,18 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Server", "..\Server\Server.
|
|||||||
EndProject
|
EndProject
|
||||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "DoctorApp", "..\DoctorApp\DoctorApp.csproj", "{A232F2D5-AF98-4777-BF3A-FBDDFBC02994}"
|
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "DoctorApp", "..\DoctorApp\DoctorApp.csproj", "{A232F2D5-AF98-4777-BF3A-FBDDFBC02994}"
|
||||||
EndProject
|
EndProject
|
||||||
|
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "UnitTestRH", "..\UnitTestRH\UnitTestRH.csproj", "{0B6CCC1D-5E76-420E-B54D-EB3E5FFEA6CB}"
|
||||||
|
ProjectSection(ProjectDependencies) = postProject
|
||||||
|
{BECC2E56-E65C-42A0-AF80-DDE32DCD5E0B} = {BECC2E56-E65C-42A0-AF80-DDE32DCD5E0B}
|
||||||
|
{7D751284-17E8-434C-A7F6-2EB37572E7AE} = {7D751284-17E8-434C-A7F6-2EB37572E7AE}
|
||||||
|
{7EF854C1-73EB-4099-A7D7-057CCEEE6F8F} = {7EF854C1-73EB-4099-A7D7-057CCEEE6F8F}
|
||||||
|
{A232F2D5-AF98-4777-BF3A-FBDDFBC02994} = {A232F2D5-AF98-4777-BF3A-FBDDFBC02994}
|
||||||
|
{C1A3CCE4-5FBB-4655-BFE1-7AF2B7D58CA3} = {C1A3CCE4-5FBB-4655-BFE1-7AF2B7D58CA3}
|
||||||
|
EndProjectSection
|
||||||
|
EndProject
|
||||||
Global
|
Global
|
||||||
GlobalSection(SharedMSBuildProjectFiles) = preSolution
|
GlobalSection(SharedMSBuildProjectFiles) = preSolution
|
||||||
|
..\Hashing\Hashing.projitems*{0b6ccc1d-5e76-420e-b54d-eb3e5ffea6cb}*SharedItemsImports = 5
|
||||||
..\Hashing\Hashing.projitems*{70277749-d423-4871-b692-2efc5a6ed932}*SharedItemsImports = 13
|
..\Hashing\Hashing.projitems*{70277749-d423-4871-b692-2efc5a6ed932}*SharedItemsImports = 13
|
||||||
..\Hashing\Hashing.projitems*{7d751284-17e8-434c-a7f6-2eb37572e7ae}*SharedItemsImports = 5
|
..\Hashing\Hashing.projitems*{7d751284-17e8-434c-a7f6-2eb37572e7ae}*SharedItemsImports = 5
|
||||||
..\Hashing\Hashing.projitems*{7ef854c1-73eb-4099-a7d7-057cceee6f8f}*SharedItemsImports = 5
|
..\Hashing\Hashing.projitems*{7ef854c1-73eb-4099-a7d7-057cceee6f8f}*SharedItemsImports = 5
|
||||||
@@ -47,6 +57,10 @@ Global
|
|||||||
{A232F2D5-AF98-4777-BF3A-FBDDFBC02994}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
{A232F2D5-AF98-4777-BF3A-FBDDFBC02994}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||||
{A232F2D5-AF98-4777-BF3A-FBDDFBC02994}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
{A232F2D5-AF98-4777-BF3A-FBDDFBC02994}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||||
{A232F2D5-AF98-4777-BF3A-FBDDFBC02994}.Release|Any CPU.Build.0 = Release|Any CPU
|
{A232F2D5-AF98-4777-BF3A-FBDDFBC02994}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||||
|
{0B6CCC1D-5E76-420E-B54D-EB3E5FFEA6CB}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||||
|
{0B6CCC1D-5E76-420E-B54D-EB3E5FFEA6CB}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||||
|
{0B6CCC1D-5E76-420E-B54D-EB3E5FFEA6CB}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||||
|
{0B6CCC1D-5E76-420E-B54D-EB3E5FFEA6CB}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||||
EndGlobalSection
|
EndGlobalSection
|
||||||
GlobalSection(SolutionProperties) = preSolution
|
GlobalSection(SolutionProperties) = preSolution
|
||||||
HideSolutionNode = FALSE
|
HideSolutionNode = FALSE
|
||||||
|
|||||||
@@ -174,7 +174,7 @@ namespace RH_Engine
|
|||||||
return JsonConvert.SerializeObject(Payload(payload));
|
return JsonConvert.SerializeObject(Payload(payload));
|
||||||
}
|
}
|
||||||
|
|
||||||
private string showOnPanel(string uuidPanel, string serialCode, string mText, int index)
|
public string showOnPanel(string uuidPanel, string serialCode, string mText, int index)
|
||||||
{
|
{
|
||||||
dynamic payload = new
|
dynamic payload = new
|
||||||
{
|
{
|
||||||
@@ -253,6 +253,11 @@ namespace RH_Engine
|
|||||||
return AddModel("bike", serial, "data\\NetworkEngine\\models\\bike\\bike.fbx");
|
return AddModel("bike", serial, "data\\NetworkEngine\\models\\bike\\bike.fbx");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public string AddBikeModelAnim(string serial, float scalar)
|
||||||
|
{
|
||||||
|
return AddModel("bike", serial, "data\\NetworkEngine\\models\\bike\\bike_anim.fbx", "Armature|Fietsen", new float[] { 0, 0, 0 }, scalar, new float[] { 0, 0, 0 });
|
||||||
|
}
|
||||||
|
|
||||||
public string AddModel(string nodeName, string serial, string fileLocation)
|
public string AddModel(string nodeName, string serial, string fileLocation)
|
||||||
{
|
{
|
||||||
return AddModel(nodeName, serial, fileLocation, null, new float[] { 0, 0, 0 }, 1, new float[] { 0, 0, 0 });
|
return AddModel(nodeName, serial, fileLocation, null, new float[] { 0, 0, 0 }, 1, new float[] { 0, 0, 0 });
|
||||||
|
|||||||
@@ -19,9 +19,9 @@ namespace RH_Engine
|
|||||||
//new PC("DESKTOP-M2CIH87", "Fabian"),
|
//new PC("DESKTOP-M2CIH87", "Fabian"),
|
||||||
//new PC("T470S", "Shinichi"),
|
//new PC("T470S", "Shinichi"),
|
||||||
//new PC("DESKTOP-DHS478C", "semme"),
|
//new PC("DESKTOP-DHS478C", "semme"),
|
||||||
new PC("HP-ZBOOK-SEM", "Sem"),
|
//new PC("HP-ZBOOK-SEM", "Sem"),
|
||||||
//new PC("DESKTOP-TV73FKO", "Wouter"),
|
//new PC("DESKTOP-TV73FKO", "Wouter"),
|
||||||
//new PC("DESKTOP-SINMKT1", "Ralf van Aert"),
|
new PC("DESKTOP-SINMKT1", "Ralf van Aert"),
|
||||||
//new PC("NA", "Bart")
|
//new PC("NA", "Bart")
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -185,7 +185,7 @@ namespace RH_Engine
|
|||||||
|
|
||||||
//Add route, bike and put camera and bike to follow route at same speed.
|
//Add route, bike and put camera and bike to follow route at same speed.
|
||||||
SendMessageAndOnResponse(stream, mainCommand.RouteCommand("routeID"), "routeID", (message) => routeId = JSONParser.GetResponseUuid(message));
|
SendMessageAndOnResponse(stream, mainCommand.RouteCommand("routeID"), "routeID", (message) => routeId = JSONParser.GetResponseUuid(message));
|
||||||
SendMessageAndOnResponse(stream, mainCommand.AddBikeModel("bikeID"), "bikeID",
|
SendMessageAndOnResponse(stream, mainCommand.AddBikeModelAnim("bikeID", 0.01f), "bikeID",
|
||||||
(message) =>
|
(message) =>
|
||||||
{
|
{
|
||||||
bikeId = JSONParser.GetResponseUuid(message);
|
bikeId = JSONParser.GetResponseUuid(message);
|
||||||
|
|||||||
@@ -1,9 +1,11 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
|
using System.Diagnostics;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Net.Sockets;
|
using System.Net.Sockets;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
|
using System.Timers;
|
||||||
using Newtonsoft.Json;
|
using Newtonsoft.Json;
|
||||||
using Util;
|
using Util;
|
||||||
|
|
||||||
@@ -21,6 +23,12 @@ namespace Server
|
|||||||
public string username = null;
|
public string username = null;
|
||||||
private DateTime sessionStart;
|
private DateTime sessionStart;
|
||||||
private string fileName;
|
private string fileName;
|
||||||
|
private Timer timer;
|
||||||
|
private volatile byte[] BikeDataBuffer;
|
||||||
|
private volatile byte[] BPMDataBuffer;
|
||||||
|
private bool BPMdata = false;
|
||||||
|
private bool Bikedata = false;
|
||||||
|
private object token = new object { };
|
||||||
|
|
||||||
public Client(Communication communication, TcpClient tcpClient)
|
public Client(Communication communication, TcpClient tcpClient)
|
||||||
{
|
{
|
||||||
@@ -29,6 +37,13 @@ namespace Server
|
|||||||
this.tcpClient = tcpClient;
|
this.tcpClient = tcpClient;
|
||||||
this.stream = this.tcpClient.GetStream();
|
this.stream = this.tcpClient.GetStream();
|
||||||
this.fileName = Directory.GetCurrentDirectory() + "/userInfo.dat";
|
this.fileName = Directory.GetCurrentDirectory() + "/userInfo.dat";
|
||||||
|
this.timer = new Timer();
|
||||||
|
this.BikeDataBuffer = new byte[16];
|
||||||
|
this.BPMDataBuffer = new byte[2];
|
||||||
|
this.timer.Interval = 1000;
|
||||||
|
this.timer.AutoReset = false;
|
||||||
|
this.timer.Elapsed += SendDataToDoctor;
|
||||||
|
Console.WriteLine("token is " + token);
|
||||||
stream.BeginRead(buffer, 0, buffer.Length, new AsyncCallback(OnRead), null);
|
stream.BeginRead(buffer, 0, buffer.Length, new AsyncCallback(OnRead), null);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -114,9 +129,11 @@ namespace Server
|
|||||||
break;
|
break;
|
||||||
case DataParser.START_SESSION:
|
case DataParser.START_SESSION:
|
||||||
this.communication.StartSessionUser(DataParser.getUsernameFromJson(payloadbytes));
|
this.communication.StartSessionUser(DataParser.getUsernameFromJson(payloadbytes));
|
||||||
|
this.timer.Start();
|
||||||
break;
|
break;
|
||||||
case DataParser.STOP_SESSION:
|
case DataParser.STOP_SESSION:
|
||||||
this.communication.StopSessionUser(DataParser.getUsernameFromJson(payloadbytes));
|
this.communication.StopSessionUser(DataParser.getUsernameFromJson(payloadbytes));
|
||||||
|
this.timer.Stop();
|
||||||
break;
|
break;
|
||||||
case DataParser.SET_RESISTANCE:
|
case DataParser.SET_RESISTANCE:
|
||||||
//bool worked = DataParser.getResistanceFromResponseJson(payloadbytes);
|
//bool worked = DataParser.getResistanceFromResponseJson(payloadbytes);
|
||||||
@@ -142,14 +159,26 @@ namespace Server
|
|||||||
}
|
}
|
||||||
else if (DataParser.isRawDataBikeServer(message))
|
else if (DataParser.isRawDataBikeServer(message))
|
||||||
{
|
{
|
||||||
|
//Bikedata = true;
|
||||||
saveData?.WriteDataRAWBike(payloadbytes);
|
saveData?.WriteDataRAWBike(payloadbytes);
|
||||||
|
lock (token)
|
||||||
|
{
|
||||||
|
Array.Copy(this.BikeDataBuffer, 0, this.BikeDataBuffer, 8, 8);
|
||||||
|
Array.Copy(payloadbytes, 0, this.BikeDataBuffer, 0, 8);
|
||||||
|
}
|
||||||
|
//this.communication.Doctor?.sendMessage(DataParser.GetRawBikeDataDoctor(payloadbytes, this.username));
|
||||||
}
|
}
|
||||||
else if (DataParser.isRawDataBPMServer(message))
|
else if (DataParser.isRawDataBPMServer(message))
|
||||||
{
|
{
|
||||||
|
//BPMdata = true;
|
||||||
saveData?.WriteDataRAWBPM(payloadbytes);
|
saveData?.WriteDataRAWBPM(payloadbytes);
|
||||||
|
lock (token)
|
||||||
|
{
|
||||||
|
Array.Copy(payloadbytes, 0, this.BPMDataBuffer, 0, 2);
|
||||||
|
}
|
||||||
|
//this.communication.Doctor?.sendMessage(DataParser.GetRawBPMDataDoctor(payloadbytes, this.username));
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private bool handleLogin(byte[] payloadbytes)
|
private bool handleLogin(byte[] payloadbytes)
|
||||||
@@ -247,5 +276,16 @@ namespace Server
|
|||||||
{
|
{
|
||||||
this.saveData = null;
|
this.saveData = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void SendDataToDoctor(object sender, ElapsedEventArgs e)
|
||||||
|
{
|
||||||
|
lock (token)
|
||||||
|
{
|
||||||
|
this.communication.Doctor?.sendMessage(DataParser.GetRawBikeDataDoctor(this.BikeDataBuffer.Take(8).ToArray(), this.username));
|
||||||
|
this.communication.Doctor?.sendMessage(DataParser.GetRawBikeDataDoctor(this.BikeDataBuffer.Skip(8).ToArray(), this.username));
|
||||||
|
this.communication.Doctor?.sendMessage(DataParser.GetRawBPMDataDoctor(this.BPMDataBuffer, this.username));
|
||||||
|
}
|
||||||
|
this.timer.Start();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
418
UnitTestRH/CommandTest.cs
Normal file
418
UnitTestRH/CommandTest.cs
Normal file
@@ -0,0 +1,418 @@
|
|||||||
|
using Microsoft.VisualStudio.TestTools.UnitTesting;
|
||||||
|
using Newtonsoft.Json;
|
||||||
|
using Newtonsoft.Json.Linq;
|
||||||
|
using ProftaakRH;
|
||||||
|
using RH_Engine;
|
||||||
|
using System;
|
||||||
|
using System.Linq;
|
||||||
|
|
||||||
|
namespace UnitTestRH
|
||||||
|
{
|
||||||
|
[TestClass]
|
||||||
|
public class CommandTest
|
||||||
|
{
|
||||||
|
[TestMethod]
|
||||||
|
public void TerrainAdd_TestMethod()
|
||||||
|
{
|
||||||
|
string testTunnelID = "dummyTunnelID";
|
||||||
|
string testSerial = "dummySerialCode";
|
||||||
|
|
||||||
|
string payloadId = "tunnel/send";
|
||||||
|
string messageId = "scene/terrain/add";
|
||||||
|
|
||||||
|
Command command = new Command(testTunnelID);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
int[] terrainSizeArray = new int[2] { 4, 4 };
|
||||||
|
float[] terrainHeightsArray = new float[16] { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
|
||||||
|
string terrainAddCommand = command.TerrainAdd(terrainSizeArray, terrainHeightsArray, testSerial);
|
||||||
|
|
||||||
|
dynamic json = JsonConvert.DeserializeObject(terrainAddCommand);
|
||||||
|
|
||||||
|
//Test payload
|
||||||
|
Assert.AreEqual(payloadId, (string)json.id);
|
||||||
|
Assert.AreEqual(testTunnelID, (string)json.data.dest);
|
||||||
|
|
||||||
|
//Test message
|
||||||
|
Assert.AreEqual(messageId, (string)json.data.data.id);
|
||||||
|
Assert.AreEqual(testSerial, (string)json.data.data.serial);
|
||||||
|
|
||||||
|
//Test terrain
|
||||||
|
JArray jArrayTerrainSize = (JArray)json.data.data.data.size;
|
||||||
|
JArray jArrayTerrainHeights = (JArray)json.data.data.data.heights;
|
||||||
|
|
||||||
|
int[] outSizeArray = jArrayTerrainSize.Select(ja => (int)ja).ToArray();
|
||||||
|
float[] outHeightsArray = jArrayTerrainHeights.Select(ja => (float)ja).ToArray();
|
||||||
|
|
||||||
|
CollectionAssert.AreEqual(terrainSizeArray, outSizeArray);
|
||||||
|
CollectionAssert.AreEqual(terrainHeightsArray, json.data.data.data.heights.ToObject<float[]>());
|
||||||
|
}
|
||||||
|
|
||||||
|
[TestMethod]
|
||||||
|
public void AddLayer_TestMethod()
|
||||||
|
{
|
||||||
|
string testTunnelID = "dummyTunnelID";
|
||||||
|
string testSerial = "dummySerialCode";
|
||||||
|
|
||||||
|
string payloadId = "tunnel/send";
|
||||||
|
string messageId = "scene/node/addlayer";
|
||||||
|
|
||||||
|
|
||||||
|
string testUuid = "dummyUuid";
|
||||||
|
string diffuseExpected = @"data\NetworkEngine\textures\terrain\grass_green_d.jpg";
|
||||||
|
string normalExpected = @"data\NetworkEngine\textures\terrain\grass_green_n.jpg";
|
||||||
|
int minHeightExpected = 0;
|
||||||
|
int maxHeightExpected = 10;
|
||||||
|
int fadeDistExpected = 1;
|
||||||
|
|
||||||
|
|
||||||
|
Command command = new Command(testTunnelID);
|
||||||
|
|
||||||
|
string terrainAddCommand = command.AddLayer(testUuid, testSerial);
|
||||||
|
|
||||||
|
dynamic json = JsonConvert.DeserializeObject(terrainAddCommand);
|
||||||
|
|
||||||
|
//Test payload
|
||||||
|
Assert.AreEqual(payloadId, (string)json.id);
|
||||||
|
Assert.AreEqual(testTunnelID, (string)json.data.dest);
|
||||||
|
|
||||||
|
//Test message
|
||||||
|
Assert.AreEqual(messageId, (string)json.data.data.id);
|
||||||
|
Assert.AreEqual(testSerial, (string)json.data.data.serial);
|
||||||
|
|
||||||
|
//Test AddLayer
|
||||||
|
Assert.AreEqual(testUuid, (string)json.data.data.data.id);
|
||||||
|
Assert.AreEqual(diffuseExpected, (string)json.data.data.data.diffuse);
|
||||||
|
Assert.AreEqual(normalExpected, (string)json.data.data.data.normal);
|
||||||
|
Assert.AreEqual(minHeightExpected, (int)json.data.data.data.minHeight);
|
||||||
|
Assert.AreEqual(maxHeightExpected, (int)json.data.data.data.maxHeight);
|
||||||
|
Assert.AreEqual(fadeDistExpected, (int)json.data.data.data.fadeDist);
|
||||||
|
}
|
||||||
|
|
||||||
|
[TestMethod]
|
||||||
|
public void UpdateTerrain_TestMethod()
|
||||||
|
{
|
||||||
|
string testTunnelID = "dummyTunnelID";
|
||||||
|
|
||||||
|
string payloadId = "tunnel/send";
|
||||||
|
string messageId = "scene/terrain/update";
|
||||||
|
|
||||||
|
Command command = new Command(testTunnelID);
|
||||||
|
|
||||||
|
string terrainAddCommand = command.UpdateTerrain();
|
||||||
|
|
||||||
|
dynamic json = JsonConvert.DeserializeObject(terrainAddCommand);
|
||||||
|
|
||||||
|
//Test payload
|
||||||
|
Assert.AreEqual(payloadId, (string)json.id);
|
||||||
|
Assert.AreEqual(testTunnelID, (string)json.data.dest);
|
||||||
|
|
||||||
|
//Test message
|
||||||
|
Assert.AreEqual(messageId, (string)json.data.data.id);
|
||||||
|
}
|
||||||
|
|
||||||
|
[TestMethod]
|
||||||
|
public void renderTerrain_TestMethod()
|
||||||
|
{
|
||||||
|
string testTunnelID = "dummyTunnelID";
|
||||||
|
string testSerial = "dummySerialCode";
|
||||||
|
|
||||||
|
string payloadId = "tunnel/send";
|
||||||
|
string messageId = "scene/node/add";
|
||||||
|
|
||||||
|
|
||||||
|
string nameExpected = "newNode";
|
||||||
|
int[] positionExpected = new int[] { -80, 0, -80 };
|
||||||
|
float scaleExpected = 1f;
|
||||||
|
int[] rotationExpected = new int[] { 0, 0, 0 };
|
||||||
|
|
||||||
|
bool smoothnormalsExpected = true;
|
||||||
|
|
||||||
|
|
||||||
|
Command command = new Command(testTunnelID);
|
||||||
|
|
||||||
|
string terrainAddCommand = command.renderTerrain(testSerial);
|
||||||
|
|
||||||
|
dynamic json = JsonConvert.DeserializeObject(terrainAddCommand);
|
||||||
|
|
||||||
|
|
||||||
|
//Test payload
|
||||||
|
Assert.AreEqual(payloadId, (string)json.id);
|
||||||
|
Assert.AreEqual(testTunnelID, (string)json.data.dest);
|
||||||
|
|
||||||
|
//Test message
|
||||||
|
Assert.AreEqual(messageId, (string)json.data.data.id);
|
||||||
|
Assert.AreEqual(testSerial, (string)json.data.data.serial);
|
||||||
|
|
||||||
|
//Test data
|
||||||
|
Assert.AreEqual(nameExpected, (string)json.data.data.data.name);
|
||||||
|
|
||||||
|
//Test data components
|
||||||
|
|
||||||
|
//Test transform
|
||||||
|
JArray jArrayPosition = (JArray)json.data.data.data.components.transform.position;
|
||||||
|
JArray jArrayRotation = (JArray)json.data.data.data.components.transform.rotation;
|
||||||
|
|
||||||
|
int[] outPositionArray = jArrayPosition.Select(ja => (int)ja).ToArray();
|
||||||
|
int[] outRotationArray = jArrayRotation.Select(ja => (int)ja).ToArray();
|
||||||
|
|
||||||
|
CollectionAssert.AreEqual(positionExpected, outPositionArray);
|
||||||
|
CollectionAssert.AreEqual(rotationExpected, outRotationArray);
|
||||||
|
|
||||||
|
|
||||||
|
//Test terrain
|
||||||
|
Assert.AreEqual(smoothnormalsExpected, (bool)json.data.data.data.components.terrain.smoothnormals);
|
||||||
|
}
|
||||||
|
|
||||||
|
[TestMethod]
|
||||||
|
public void DeleteNode_TestMethod()
|
||||||
|
{
|
||||||
|
string testTunnelID = "dummyTunnelID";
|
||||||
|
string testSerial = "dummySerialCode";
|
||||||
|
|
||||||
|
string payloadId = "tunnel/send";
|
||||||
|
string messageId = "scene/node/delete";
|
||||||
|
|
||||||
|
string uuid = "dummyUuid";
|
||||||
|
|
||||||
|
|
||||||
|
Command command = new Command(testTunnelID);
|
||||||
|
|
||||||
|
string terrainAddCommand = command.DeleteNode(uuid, testSerial);
|
||||||
|
|
||||||
|
dynamic json = JsonConvert.DeserializeObject(terrainAddCommand);
|
||||||
|
|
||||||
|
//Test payload
|
||||||
|
Assert.AreEqual(payloadId, (string)json.id);
|
||||||
|
Assert.AreEqual(testTunnelID, (string)json.data.dest);
|
||||||
|
|
||||||
|
//Test message
|
||||||
|
Assert.AreEqual(messageId, (string)json.data.data.id);
|
||||||
|
Assert.AreEqual(testSerial, (string)json.data.data.serial);
|
||||||
|
|
||||||
|
//Test data
|
||||||
|
Assert.AreEqual(uuid, (string)json.data.data.data.id);
|
||||||
|
}
|
||||||
|
|
||||||
|
[TestMethod]
|
||||||
|
public void addPanel_TestMethod()
|
||||||
|
{
|
||||||
|
string testTunnelID = "dummyTunnelID";
|
||||||
|
string testSerial = "dummySerialCode";
|
||||||
|
|
||||||
|
string payloadId = "tunnel/send";
|
||||||
|
string messageId = "scene/node/add";
|
||||||
|
|
||||||
|
string uuidBike = "dummyUuidBike";
|
||||||
|
|
||||||
|
string nameExpected = "dashboard";
|
||||||
|
|
||||||
|
//components
|
||||||
|
//transform
|
||||||
|
float[] positionExpected = new float[] { -1.5f, 1f, 0f };
|
||||||
|
int scaleExpected = 1;
|
||||||
|
int[] rotationExpected = new int[] { -30, 90, 0 };
|
||||||
|
|
||||||
|
//panel
|
||||||
|
int[] sizeExpected = new int[] { 1, 1 };
|
||||||
|
int[] resolutionExpected = new int[] { 512, 512 };
|
||||||
|
int[] backgroundExpected = new int[] { 1, 1, 1, 1 };
|
||||||
|
bool castShadowExpected = false;
|
||||||
|
|
||||||
|
Command command = new Command(testTunnelID);
|
||||||
|
|
||||||
|
string terrainAddCommand = command.addPanel(testSerial, uuidBike);
|
||||||
|
|
||||||
|
dynamic json = JsonConvert.DeserializeObject(terrainAddCommand);
|
||||||
|
|
||||||
|
//Test payload
|
||||||
|
Assert.AreEqual(payloadId, (string)json.id);
|
||||||
|
Assert.AreEqual(testTunnelID, (string)json.data.dest);
|
||||||
|
|
||||||
|
//Test message
|
||||||
|
Assert.AreEqual(messageId, (string)json.data.data.id);
|
||||||
|
Assert.AreEqual(testSerial, (string)json.data.data.serial);
|
||||||
|
|
||||||
|
//Test data
|
||||||
|
Assert.AreEqual(nameExpected, (string)json.data.data.data.name);
|
||||||
|
Assert.AreEqual(uuidBike, (string)json.data.data.data.parent);
|
||||||
|
|
||||||
|
//Test components
|
||||||
|
|
||||||
|
//Test transform
|
||||||
|
JArray jArrayPosition = (JArray)json.data.data.data.components.transform.position;
|
||||||
|
JArray jArrayRotation = (JArray)json.data.data.data.components.transform.rotation;
|
||||||
|
|
||||||
|
float[] outPositionArray = jArrayPosition.Select(ja => (float)ja).ToArray();
|
||||||
|
int[] outRotationArray = jArrayRotation.Select(ja => (int)ja).ToArray();
|
||||||
|
|
||||||
|
CollectionAssert.AreEqual(positionExpected, outPositionArray);
|
||||||
|
CollectionAssert.AreEqual(rotationExpected, outRotationArray);
|
||||||
|
|
||||||
|
Assert.AreEqual(scaleExpected, (int)json.data.data.data.components.transform.scale);
|
||||||
|
|
||||||
|
//Test panel
|
||||||
|
CollectionAssert.AreEqual(sizeExpected, ((JArray)json.data.data.data.components.panel.size).Select(ja => (int)ja).ToArray());
|
||||||
|
CollectionAssert.AreEqual(resolutionExpected, ((JArray)json.data.data.data.components.panel.resolution).Select(ja => (int)ja).ToArray());
|
||||||
|
CollectionAssert.AreEqual(backgroundExpected, ((JArray)json.data.data.data.components.panel.background).Select(ja => (int)ja).ToArray());
|
||||||
|
Assert.AreEqual(castShadowExpected, (bool)json.data.data.data.components.panel.castShadow);
|
||||||
|
}
|
||||||
|
|
||||||
|
[TestMethod]
|
||||||
|
public void ColorPanel_TestMethod()
|
||||||
|
{
|
||||||
|
string testTunnelID = "dummyTunnelID";
|
||||||
|
|
||||||
|
string payloadId = "tunnel/send";
|
||||||
|
string messageId = "scene/panel/setclearcolor";
|
||||||
|
|
||||||
|
string uuidPanel = "dummyUuidPanel";
|
||||||
|
|
||||||
|
float[] colorExpected = new float[] { 0f, 0f, 0f, 0f };
|
||||||
|
|
||||||
|
|
||||||
|
Command command = new Command(testTunnelID);
|
||||||
|
|
||||||
|
string terrainAddCommand = command.ColorPanel(uuidPanel);
|
||||||
|
|
||||||
|
dynamic json = JsonConvert.DeserializeObject(terrainAddCommand);
|
||||||
|
|
||||||
|
//Test payload
|
||||||
|
Assert.AreEqual(payloadId, (string)json.id);
|
||||||
|
Assert.AreEqual(testTunnelID, (string)json.data.dest);
|
||||||
|
|
||||||
|
//Test message
|
||||||
|
Assert.AreEqual(messageId, (string)json.data.data.id);
|
||||||
|
|
||||||
|
//Test data
|
||||||
|
Assert.AreEqual(uuidPanel, (string)json.data.data.data.id);
|
||||||
|
CollectionAssert.AreEqual(colorExpected, ((JArray)json.data.data.data.color).Select(ja => (float)ja).ToArray());
|
||||||
|
}
|
||||||
|
|
||||||
|
[TestMethod]
|
||||||
|
public void SwapPanel_TestMethod()
|
||||||
|
{
|
||||||
|
string testTunnelID = "dummyTunnelID";
|
||||||
|
|
||||||
|
string payloadId = "tunnel/send";
|
||||||
|
string messageId = "scene/panel/swap";
|
||||||
|
|
||||||
|
string uuid = "dummyUuid";
|
||||||
|
|
||||||
|
|
||||||
|
Command command = new Command(testTunnelID);
|
||||||
|
|
||||||
|
string terrainAddCommand = command.SwapPanel(uuid);
|
||||||
|
|
||||||
|
dynamic json = JsonConvert.DeserializeObject(terrainAddCommand);
|
||||||
|
|
||||||
|
//Test payload
|
||||||
|
Assert.AreEqual(payloadId, (string)json.id);
|
||||||
|
Assert.AreEqual(testTunnelID, (string)json.data.dest);
|
||||||
|
|
||||||
|
//Test message
|
||||||
|
Assert.AreEqual(messageId, (string)json.data.data.id);
|
||||||
|
|
||||||
|
//Test data
|
||||||
|
Assert.AreEqual(uuid, (string)json.data.data.data.id);
|
||||||
|
}
|
||||||
|
|
||||||
|
[TestMethod]
|
||||||
|
public void showOnPanel_TestMethod()
|
||||||
|
{
|
||||||
|
string testTunnelID = "dummyTunnelID";
|
||||||
|
string testSerial = "dummySerialCode";
|
||||||
|
|
||||||
|
string payloadId = "tunnel/send";
|
||||||
|
string messageId = "scene/panel/drawtext";
|
||||||
|
|
||||||
|
string uuidPanel = "dummyUuidPanel";
|
||||||
|
string text = "dummyText";
|
||||||
|
int index = 3;
|
||||||
|
int[] positionExpected = new int[] { 4, 24 + index * 32 };
|
||||||
|
double sizeExpected = 32.0;
|
||||||
|
int[] colorExpected = new int[] { 0, 0, 0, 1 };
|
||||||
|
string fontExpected = "segoeui";
|
||||||
|
|
||||||
|
|
||||||
|
Command command = new Command(testTunnelID);
|
||||||
|
|
||||||
|
string terrainAddCommand = command.showOnPanel(uuidPanel, testSerial, text, index);
|
||||||
|
|
||||||
|
dynamic json = JsonConvert.DeserializeObject(terrainAddCommand);
|
||||||
|
|
||||||
|
//Test payload
|
||||||
|
Assert.AreEqual(payloadId, (string)json.id);
|
||||||
|
Assert.AreEqual(testTunnelID, (string)json.data.dest);
|
||||||
|
|
||||||
|
//Test message
|
||||||
|
Assert.AreEqual(messageId, (string)json.data.data.id);
|
||||||
|
Assert.AreEqual(testSerial, (string)json.data.data.serial);
|
||||||
|
|
||||||
|
//Test data
|
||||||
|
Assert.AreEqual(uuidPanel, (string)json.data.data.data.id);
|
||||||
|
Assert.AreEqual(text, (string)json.data.data.data.text);
|
||||||
|
CollectionAssert.AreEqual(positionExpected, ((JArray)json.data.data.data.position).Select(ja => (int)ja).ToArray());
|
||||||
|
Assert.AreEqual(sizeExpected, (double)json.data.data.data.size);
|
||||||
|
CollectionAssert.AreEqual(colorExpected, ((JArray)json.data.data.data.color).Select(ja => (int)ja).ToArray());
|
||||||
|
Assert.AreEqual(fontExpected, (string)json.data.data.data.font);
|
||||||
|
}
|
||||||
|
|
||||||
|
[TestMethod]
|
||||||
|
public void SwapPanelCommand_TestMethod()
|
||||||
|
{
|
||||||
|
string testTunnelID = "dummyTunnelID";
|
||||||
|
|
||||||
|
string payloadId = "tunnel/send";
|
||||||
|
string messageId = "scene/panel/swap";
|
||||||
|
|
||||||
|
string uuid = "dummyUuid";
|
||||||
|
|
||||||
|
|
||||||
|
Command command = new Command(testTunnelID);
|
||||||
|
|
||||||
|
string terrainAddCommand = command.SwapPanelCommand(uuid);
|
||||||
|
|
||||||
|
dynamic json = JsonConvert.DeserializeObject(terrainAddCommand);
|
||||||
|
|
||||||
|
//Test payload
|
||||||
|
Assert.AreEqual(payloadId, (string)json.id);
|
||||||
|
Assert.AreEqual(testTunnelID, (string)json.data.dest);
|
||||||
|
|
||||||
|
//Test message
|
||||||
|
Assert.AreEqual(messageId, (string)json.data.data.id);
|
||||||
|
|
||||||
|
//Test data
|
||||||
|
Assert.AreEqual(uuid, (string)json.data.data.data.id);
|
||||||
|
}
|
||||||
|
|
||||||
|
[TestMethod]
|
||||||
|
public void ClearPanel_TestMethod()
|
||||||
|
{
|
||||||
|
string testTunnelID = "dummyTunnelID";
|
||||||
|
|
||||||
|
string payloadId = "tunnel/send";
|
||||||
|
string messageId = "scene/panel/clear";
|
||||||
|
|
||||||
|
string uuid = "dummyUuid";
|
||||||
|
|
||||||
|
|
||||||
|
Command command = new Command(testTunnelID);
|
||||||
|
|
||||||
|
string terrainAddCommand = command.ClearPanel(uuid);
|
||||||
|
|
||||||
|
dynamic json = JsonConvert.DeserializeObject(terrainAddCommand);
|
||||||
|
|
||||||
|
//Test payload
|
||||||
|
Assert.AreEqual(payloadId, (string)json.id);
|
||||||
|
Assert.AreEqual(testTunnelID, (string)json.data.dest);
|
||||||
|
|
||||||
|
//Test terrain
|
||||||
|
Assert.AreEqual(messageId, (string)json.data.data.id);
|
||||||
|
|
||||||
|
//Test data
|
||||||
|
Assert.AreEqual(uuid, (string)json.data.data.data.id);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
74
UnitTestRH/DataParserTest.cs
Normal file
74
UnitTestRH/DataParserTest.cs
Normal file
@@ -0,0 +1,74 @@
|
|||||||
|
using Microsoft.VisualStudio.TestTools.UnitTesting;
|
||||||
|
using Newtonsoft.Json;
|
||||||
|
using RH_Engine;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Text;
|
||||||
|
using Util;
|
||||||
|
|
||||||
|
namespace UnitTestRH
|
||||||
|
{
|
||||||
|
[TestClass]
|
||||||
|
public class DataParserTest
|
||||||
|
{
|
||||||
|
|
||||||
|
public byte[] GetPayload(byte[] message)
|
||||||
|
{
|
||||||
|
byte[] payload = new byte[message.Length - 5];
|
||||||
|
Array.Copy(message, 5, payload, 0, message.Length - 5);
|
||||||
|
return payload;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
[TestMethod]
|
||||||
|
public void TestGetMessageToSend()
|
||||||
|
{
|
||||||
|
byte[] toTest = DataParser.GetMessageToSend("test");
|
||||||
|
|
||||||
|
dynamic res = JsonConvert.DeserializeObject(Encoding.ASCII.GetString((toTest)));
|
||||||
|
Assert.AreEqual("MESSAGE", (string)res.identifier);
|
||||||
|
Assert.AreEqual("test", (string)res.data.message);
|
||||||
|
}
|
||||||
|
|
||||||
|
[TestMethod]
|
||||||
|
public void TestIsRawDataBikeServer()
|
||||||
|
{
|
||||||
|
byte[] testArr = { 0x34,0x00,0x00,0x00,0x02};
|
||||||
|
byte[] testArr2 = { 0x34, 0x00, 0x00, 0x00, 0x02,0x49,0x65 };
|
||||||
|
Assert.ThrowsException<ArgumentException>(() => DataParser.isRawDataBikeServer(testArr));
|
||||||
|
Assert.IsTrue(DataParser.isRawDataBikeServer(testArr2));
|
||||||
|
}
|
||||||
|
[TestMethod]
|
||||||
|
public void TestIsRawDataBikeDoctor()
|
||||||
|
{
|
||||||
|
byte[] testArr = { 0x34, 0x00, 0x00, 0x00, 0x04 };
|
||||||
|
byte[] testArr2 = { 0x34, 0x00, 0x00, 0x00, 0x04, 0x49, 0x65 };
|
||||||
|
Assert.ThrowsException<ArgumentException>(() => DataParser.isRawDataBikeDoctor(testArr));
|
||||||
|
Assert.IsTrue(DataParser.isRawDataBikeDoctor(testArr2));
|
||||||
|
}
|
||||||
|
|
||||||
|
[TestMethod]
|
||||||
|
public void TestIsRawDataBPMServer()
|
||||||
|
{
|
||||||
|
byte[] testArr = { 0x34, 0x00, 0x00, 0x00, 0x03};
|
||||||
|
byte[] testArr2 = { 0x34, 0x00, 0x00, 0x00, 0x03, 0x49, 0x65 };
|
||||||
|
Assert.ThrowsException<ArgumentException>(() => DataParser.isRawDataBPMServer(testArr));
|
||||||
|
Assert.IsTrue(DataParser.isRawDataBPMServer(testArr2));
|
||||||
|
}
|
||||||
|
|
||||||
|
[TestMethod]
|
||||||
|
public void TestIsRawDataBPMDoctor()
|
||||||
|
{
|
||||||
|
byte[] testArr = { 0x34, 0x00, 0x00, 0x00, 0x05 };
|
||||||
|
byte[] testArr2 = { 0x34, 0x00, 0x00, 0x00, 0x05, 0x49, 0x65 };
|
||||||
|
Assert.ThrowsException<ArgumentException>(() => DataParser.isRawDataBPMDoctor(testArr));
|
||||||
|
Assert.IsTrue(DataParser.isRawDataBPMDoctor(testArr2));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
26
UnitTestRH/UnitTestRH.csproj
Normal file
26
UnitTestRH/UnitTestRH.csproj
Normal file
@@ -0,0 +1,26 @@
|
|||||||
|
<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" />
|
||||||
|
</ItemGroup>
|
||||||
|
|
||||||
|
<ItemGroup>
|
||||||
|
<ProjectReference Include="..\ClientApp\ClientApp.csproj" />
|
||||||
|
<ProjectReference Include="..\DoctorApp\DoctorApp.csproj" />
|
||||||
|
<ProjectReference Include="..\ProftaakRH\ProftaakRH.csproj" />
|
||||||
|
<ProjectReference Include="..\RH-Engine\RH-Engine.csproj" />
|
||||||
|
<ProjectReference Include="..\Server\Server.csproj" />
|
||||||
|
</ItemGroup>
|
||||||
|
|
||||||
|
<Import Project="..\Hashing\Hashing.projitems" Label="Shared" />
|
||||||
|
|
||||||
|
</Project>
|
||||||
Reference in New Issue
Block a user