Skip to content

Commit

Permalink
Update identifier formats. Merge #46
Browse files Browse the repository at this point in the history
  • Loading branch information
zyro committed Nov 6, 2017
1 parent 945e0cd commit 5291abd
Show file tree
Hide file tree
Showing 110 changed files with 491 additions and 686 deletions.
4 changes: 2 additions & 2 deletions Nakama.Tests/FriendTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ public class FriendTest
private static readonly string DefaultServerKey = "defaultkey";
private static readonly string DeviceId = random.GetString();

private static byte[] FriendUserId;
private static string FriendUserId;
private static string FriendHandle = "";
private INClient client;

Expand Down Expand Up @@ -108,7 +108,7 @@ public void AddFriend()
ManualResetEvent evt = new ManualResetEvent(false);
var committed = false;

var message = NFriendAddMessage.Default(FriendUserId);
var message = NFriendAddMessage.ById(FriendUserId);
client.Send(message, (bool completed) => {
committed = completed;
evt.Set();
Expand Down
6 changes: 3 additions & 3 deletions Nakama.Tests/GroupTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,8 @@ public class GroupTest
private static readonly string GroupDescription = "testGroupDescription";
private static readonly bool PrivateGroup = true;

private static byte[] FriendUserId;
private static byte[] MyUserId;
private static string FriendUserId;
private static string MyUserId;
private static INGroup FriendGroup;
private INClient client;
private INGroup myGroup;
Expand Down Expand Up @@ -247,7 +247,7 @@ public void GroupsFetch()
INError error = null;
INResultSet<INGroup> groups = null;

var message = new NGroupsFetchMessage.Builder(FriendGroup.Id).Build();
var message = NGroupsFetchMessage.Builder.ById(FriendGroup.Id).Build();
client.Send(message, (INResultSet<INGroup> results) =>
{
groups = results;
Expand Down
8 changes: 4 additions & 4 deletions Nakama.Tests/LeaderboardTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ public class LeaderboardTest
private static readonly string LeaderboardIdName = "testLeaderboard";
private static readonly string LeaderboardId = Convert.ToBase64String(System.Text.Encoding.UTF8.GetBytes(LeaderboardIdName));

private byte[] serverLeaderboardId;
private string serverLeaderboardId;
private INSelf self;
private INClient client;

Expand All @@ -58,7 +58,7 @@ public void CheckTestLeaderboardExists()
bool found = false;
foreach (var leaderboard in results.Results)
{
if (LeaderboardId.Equals(Convert.ToBase64String(leaderboard.Id)))
if (LeaderboardId.Equals(leaderboard.Id))
{
serverLeaderboardId = leaderboard.Id;
found = true;
Expand Down Expand Up @@ -118,7 +118,7 @@ public void LeaderboardsList()
ManualResetEvent evt = new ManualResetEvent(false);
INResultSet<INLeaderboard> res = null;

var message= new NLeaderboardsListMessage.Builder().Add(Encoding.UTF8.GetBytes(LeaderboardIdName)).Build();
var message= new NLeaderboardsListMessage.Builder().Add(LeaderboardIdName).Build();
client.Send(message, (INResultSet<INLeaderboard> results) =>
{
res = results;
Expand All @@ -130,7 +130,7 @@ public void LeaderboardsList()
evt.WaitOne(1000, false);
Assert.IsNotNull(res);
Assert.IsNotEmpty(res.Results);
Assert.AreEqual(Convert.ToBase64String(res.Results[0].Id), LeaderboardId);
Assert.AreEqual(res.Results[0].Id, LeaderboardId);
Assert.GreaterOrEqual(res.Results[0].Count, 0);
}

Expand Down
8 changes: 4 additions & 4 deletions Nakama.Tests/MatchTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,8 @@ public class MatchTest
private static INClient client1;
private static INClient client2;

private static byte[] userId1;
private static byte[] userId2;
private static string userId1;
private static string userId2;

[SetUp]
public void SetUp()
Expand Down Expand Up @@ -170,7 +170,7 @@ public void PresenceUpdateJoinMatch()
Assert.IsNotNull(m);

ManualResetEvent evt2 = new ManualResetEvent(false);
byte[] joinedUserId = null;
string joinedUserId = null;
client1.OnMatchPresence = (INMatchPresence presence) =>
{
joinedUserId = presence.Join[0].UserId;
Expand Down Expand Up @@ -217,7 +217,7 @@ public void PresenceUpdateLeaveMatch()
Assert.IsNotNull(m);

ManualResetEvent evt2 = new ManualResetEvent(false);
byte[] leftUserId = null;
string leftUserId = null;
client1.OnMatchPresence = (INMatchPresence presence) =>
{
leftUserId = presence.Leave[0].UserId;
Expand Down
4 changes: 2 additions & 2 deletions Nakama.Tests/MatchmakeTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ public class MatchmakeTest
private static INClient client1;
private static INClient client2;

private static byte[] userId2;
private static string userId2;

[SetUp]
public void SetUp()
Expand Down Expand Up @@ -166,7 +166,7 @@ public void MatchmakeMatched()
Assert.AreEqual(res1.Token.Token, res2.Token.Token);

var c1Props = res1.UserProperties[0];
if (!NIds.Equals(res1.Self.UserId,res1.UserProperties[0].Id))
if (res1.Self.UserId != res1.UserProperties[0].Id)
{
c1Props = res1.UserProperties[1];
}
Expand Down
55 changes: 0 additions & 55 deletions Nakama.Tests/NIdsTest.cs

This file was deleted.

3 changes: 1 addition & 2 deletions Nakama.Tests/Nakama.Tests.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,6 @@
<Compile Include="LeaderboardTest.cs" />
<Compile Include="MatchmakeTest.cs" />
<Compile Include="MatchTest.cs" />
<Compile Include="NIdsTest.cs" />
<Compile Include="NotificationTest.cs" />
<Compile Include="PurchaseTest.cs" />
<Compile Include="RuntimeTest.cs" />
Expand All @@ -62,4 +61,4 @@
</ProjectReference>
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
</Project>
</Project>
4 changes: 2 additions & 2 deletions Nakama.Tests/NotificationTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ public class NotificationTest
private static readonly string DeviceId = random.GetString();
private static readonly string DefaultServerKey = "defaultkey";
private INClient client;
private byte[] userId;
private string userId;

private static IList<INNotification> notifications;

Expand Down Expand Up @@ -120,7 +120,7 @@ public void RemoveNotifications()
ManualResetEvent evt = new ManualResetEvent(false);
INError err = null;

var ids = new List<byte[]>();
var ids = new List<string>();
foreach (var n in notifications)
{
ids.Add(n.Id);
Expand Down
2 changes: 1 addition & 1 deletion Nakama.Tests/PurchaseTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ public class PurchaseTest
private static readonly string DeviceId = random.GetString();
private static readonly string DefaultServerKey = "defaultkey";
private INClient client;
private byte[] userId;
private string userId;

[SetUp]
public void SetUp()
Expand Down
3 changes: 1 addition & 2 deletions Nakama.Tests/RuntimeTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@
* limitations under the License.
*/

using System.Text;
using System.Threading;
using NUnit.Framework;

Expand Down Expand Up @@ -65,7 +64,7 @@ public void RpcLoopback()
ManualResetEvent evt = new ManualResetEvent(false);
INRuntimeRpc rpc = null;

byte[] payload = Encoding.ASCII.GetBytes("payload-data");
string payload = "payload-data";
var message = new NRuntimeRpcMessage.Builder("loopback").Payload(payload).Build();
client.Send(message, (INRuntimeRpc result) =>
{
Expand Down
7 changes: 3 additions & 4 deletions Nakama.Tests/SelfTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@
* limitations under the License.
*/

using System.Text;
using System.Threading;
using NUnit.Framework;

Expand Down Expand Up @@ -83,7 +82,7 @@ public void FetchUsers()
ManualResetEvent evt = new ManualResetEvent(false);
INResultSet<INUser> users = null;

var message = NUsersFetchMessage.Default(session.Id);
var message = NUsersFetchMessage.ById(session.Id);
client.Send(message, (INResultSet<INUser> results) => {
users = results;
evt.Set();
Expand All @@ -109,7 +108,7 @@ public void UpdateUser()
.Handle(Handle)
.Lang("en")
.Location("San Francisco")
.Metadata(Encoding.UTF8.GetBytes("{}"))
.Metadata("{}")
.Timezone("Pacific Time")
.Build();
client.Send(message, (bool completed) => {
Expand All @@ -129,7 +128,7 @@ public void FetchUsersHandle()
ManualResetEvent evt = new ManualResetEvent(false);
INResultSet<INUser> users = null;

var message = NUsersFetchMessage.Default(Handle);
var message = NUsersFetchMessage.ByHandle(Handle);
client.Send(message, (INResultSet<INUser> results) => {
users = results;
evt.Set();
Expand Down
12 changes: 5 additions & 7 deletions Nakama.Tests/StorageTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@

using System;
using System.Linq;
using System.Text;
using System.Threading;
using NUnit.Framework;
using NUnit.Framework.Internal;
Expand All @@ -34,11 +33,11 @@ public class StorageTest
private static readonly string Bucket = "testBucket";
private static readonly string Collection = "testCollection";
private static readonly string Record = "testRecord";
private static readonly byte[] StorageValue = Encoding.UTF8.GetBytes("{\"jsonkey\":\"jsonvalue\"}");
private static readonly byte[] IfNoneMatchVersion = Encoding.UTF8.GetBytes("*");
private static readonly byte[] InvalidVersion = Encoding.UTF8.GetBytes("InvalidIfMatch");
private static readonly string StorageValue = "{\"jsonkey\":\"jsonvalue\"}";
private static readonly string IfNoneMatchVersion = "*";
private static readonly string InvalidVersion = "InvalidIfMatch";

private static byte[] UserId;
private static string UserId;

private INClient client;

Expand Down Expand Up @@ -410,8 +409,7 @@ public void UpdateStorage()
ManualResetEvent evt = new ManualResetEvent(false);
INResultSet<INStorageKey> res = null;

var jsonString = "{\"coins\": 100, \"gems\": 10, \"artifacts\": 0}";
byte[] json = Encoding.UTF8.GetBytes(jsonString);
var json = "{\"coins\": 100, \"gems\": 10, \"artifacts\": 0}";

var message = new NStorageUpdateMessage.Builder()
.Update(Bucket, Collection, Record, new NStorageUpdateMessage.StorageUpdateBuilder()
Expand Down
Loading

0 comments on commit 5291abd

Please sign in to comment.