Skip to content
This repository was archived by the owner on Apr 24, 2024. It is now read-only.

Target netstandard 1.3 #51

Merged
merged 22 commits into from
Jul 4, 2017
Merged
Changes from 1 commit
Commits
Show all changes
22 commits
Select commit Hold shift + click to select a range
afbb43f
Add an editorconfig file to maintain the current tab indentation sett…
spewu Jun 15, 2017
0355b05
Add ncrunch stuff to gitignore
spewu Jun 15, 2017
633becd
Change Analytics to target netstandard 1.6
spewu Jun 15, 2017
270c284
Cleaned usings, as System.Runtime.Serialization.Json is not used and …
spewu Jun 15, 2017
fb12486
Changed Encoding.Default to Encoding.GetEncoding(0), as that is the w…
spewu Jun 15, 2017
31345dd
Format file to align on tabs and brace positioning
spewu Jun 15, 2017
ca07e74
Make client readonly
spewu Jun 15, 2017
c529e97
Rewrite BlockingRequestHandler to use HttpClient instead of HttpWebRe…
spewu Jun 15, 2017
0f178f9
Deleted some classes that are not used
spewu Jun 15, 2017
2a306c4
In the async flush handler that runs on its own thread, make sure to …
spewu Jun 15, 2017
e437edf
In the blocking flush handler use async/await - so change it to retur…
spewu Jun 15, 2017
65dcc7e
Make all the client methods async
spewu Jun 15, 2017
bdb0a9f
Retarget towards netstandard 1.3
spewu Jun 15, 2017
6589636
Change the Test project to a netcoreapp library
spewu Jun 15, 2017
50373dc
Format files to align on tab indentation and brace allignment
spewu Jun 15, 2017
8275627
Updated Actions to be async
spewu Jun 15, 2017
0ec746a
Updated ActionTests to be async
spewu Jun 15, 2017
97a027b
Updated FlushTests to be async
spewu Jun 15, 2017
a606b27
Add note in History.md about new changes
spewu Jun 15, 2017
9a34a6c
Content type encoding should be specified on the StringContent object
spewu Jun 16, 2017
c46113b
Make client operations syncronous
spewu Jun 20, 2017
2e7d43d
Update history
spewu Jun 20, 2017
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Updated FlushTests to be async
  • Loading branch information
spewu committed Jun 15, 2017
commit 97a027bd29298e3a9b0cc7499fa6f00d3a74468e
23 changes: 11 additions & 12 deletions Test/FlushTests.cs
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
using NUnit.Framework;
using System;
using System;
using System.Collections.Generic;
using System.Threading;

using Segment;
using System.Threading.Tasks;
using NUnit.Framework;
using Segment.Model;

namespace Segment.Test
Expand All @@ -19,23 +18,23 @@ public void Init()
}

[Test()]
public void SynchronousFlushTest()
public async Task SynchronousFlushTest()
{
Analytics.Initialize(Constants.WRITE_KEY, new Config().SetAsync(false));
Analytics.Client.Succeeded += Client_Succeeded;
Analytics.Client.Failed += Client_Failed;

int trials = 10;

RunTests(Analytics.Client, trials);
await RunTests(Analytics.Client, trials);

Assert.AreEqual(trials, Analytics.Client.Statistics.Submitted);
Assert.AreEqual(trials, Analytics.Client.Statistics.Succeeded);
Assert.AreEqual(0, Analytics.Client.Statistics.Failed);
}

[Test()]
public void AsynchronousFlushTest()
public async Task AsynchronousFlushTest()
{
Analytics.Initialize(Constants.WRITE_KEY, new Config().SetAsync(true));

Expand All @@ -44,7 +43,7 @@ public void AsynchronousFlushTest()

int trials = 10;

RunTests(Analytics.Client, trials);
await RunTests(Analytics.Client, trials);

Thread.Sleep(1000); // cant use flush to wait during asynchronous flushing

Expand All @@ -54,7 +53,7 @@ public void AsynchronousFlushTest()
}

[Test()]
public void PerformanceTest()
public async Task PerformanceTest()
{
Analytics.Initialize(Constants.WRITE_KEY);

Expand All @@ -65,7 +64,7 @@ public void PerformanceTest()

DateTime start = DateTime.Now;

RunTests(Analytics.Client, trials);
await RunTests(Analytics.Client, trials);

Analytics.Client.Flush();

Expand All @@ -78,11 +77,11 @@ public void PerformanceTest()
Assert.IsTrue(duration.CompareTo(TimeSpan.FromSeconds(20)) < 0);
}

private void RunTests(Client client, int trials)
private async Task RunTests(Client client, int trials)
{
for (int i = 0; i < trials; i += 1)
{
Actions.Random(client);
await Actions.Random(client);
}
}

Expand Down