Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve transfer speed (sending) #178

Merged
merged 11 commits into from
Jul 30, 2024
Prev Previous commit
Next Next commit
Tests
  • Loading branch information
ShortDevelopment committed Jul 29, 2024
commit 9d5152b0674d066688b03cf82559e37d7146b599
4 changes: 4 additions & 0 deletions Directory.Build.targets
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,8 @@
<Using Include="ShortDev.IO.Input" />
<Using Include="ShortDev.IO.Output" />
</ItemGroup>

<ItemGroup Label="Tests">
<InternalsVisibleTo Include="ShortDev.Microsoft.ConnectedDevices.Test" />
</ItemGroup>
</Project>
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
using ShortDev.Microsoft.ConnectedDevices.Encryption;
using ShortDev.Microsoft.ConnectedDevices.Messages;
using ShortDev.Microsoft.ConnectedDevices.NearShare.Messages;
using ShortDev.Microsoft.ConnectedDevices.Serialization;
using System.Diagnostics;
using Xunit.Abstractions;

namespace ShortDev.Microsoft.ConnectedDevices.Test;
Expand Down Expand Up @@ -73,4 +76,22 @@ static void TestRun<T>(Endianness endianness) where T : ICdpSerializable<T>
Assert.True(writtenMemory1.Span.SequenceEqual(writtenMemory2.Span));
}
}

[Fact]
public void ValueSet()
{
ValueSet response = new();
response.Add("ControlMessage", (uint)NearShareControlMsgType.FetchDataResponse);
response.Add("ContentId", (uint)1);
response.Add("BlobPosition", (ulong)2);
response.Add("DataBlob", (List<byte>)[42]);

EndianWriter writer1 = new(Endianness.BigEndian);
response.Write(writer1);

EndianWriter writer2 = new(Endianness.BigEndian);
FetchDataResponse.Write(writer2, 1, 2, [42]);

Assert.Equal(writer1.Buffer.ToArray(), writer2.Buffer.ToArray());
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
</ItemGroup>

<ItemGroup>
<ProjectReference Include="..\..\lib\ShortDev.Microsoft.ConnectedDevices.NearShare\ShortDev.Microsoft.ConnectedDevices.NearShare.csproj" />
<ProjectReference Include="..\..\lib\ShortDev.Microsoft.ConnectedDevices\ShortDev.Microsoft.ConnectedDevices.csproj" />
</ItemGroup>

Expand Down