Skip to content

Commit

Permalink
major fixes for tests, removed auto publishing, switching to gitflow
Browse files Browse the repository at this point in the history
  • Loading branch information
a-legotin committed Jan 18, 2017
1 parent a4bea5c commit f39804c
Show file tree
Hide file tree
Showing 14 changed files with 91 additions and 80 deletions.
3 changes: 1 addition & 2 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,5 +14,4 @@ script:
- dotnet --verbose build
- cd ../InstaSharper.Tests
- dotnet --verbose build
- dotnet --verbose test -parallel none

- dotnet --verbose test -parallel none
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@
using Xunit;
using Xunit.Abstractions;

namespace InstaSharper.Tests.FactNTheories
namespace InstaSharper.Tests.Endpoints
{
[Collection("InstaSharper Tests")]
[Collection("Endpoints")]
public class AuthTest
{
public AuthTest(ITestOutputHelper output)
Expand All @@ -16,7 +16,7 @@ public AuthTest(ITestOutputHelper output)

private readonly ITestOutputHelper _output;

[Fact]
[RunnableInDebugOnlyFact]
public async void UserLoginFailTest()
{
var username = "alex_codegarage";
Expand All @@ -33,7 +33,7 @@ public async void UserLoginFailTest()
Assert.False(apiInstance.IsUserAuthenticated);
}

[Fact]
[RunnableInDebugOnlyFact]
public async void UserLoginSuccessTest()
{
var username = "alex_codegarage";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,21 +4,21 @@
using Xunit;
using Xunit.Abstractions;

namespace InstaSharper.Tests.FactNTheories
namespace InstaSharper.Tests.Endpoints
{
[Collection("InstaSharper Tests")]
[Collection("Endpoints")]
public class DiscoverTest
{
private readonly ITestOutputHelper _output;
private readonly string _password = Environment.GetEnvironmentVariable("instaapiuserpassword");
private readonly string _username = "alex_codegarage";

public DiscoverTest(ITestOutputHelper output)
{
_output = output;
}

private readonly ITestOutputHelper _output;
private readonly string _username = "alex_codegarage";
private readonly string _password = Environment.GetEnvironmentVariable("instaapiuserpassword");

[Fact]
[RunnableInDebugOnlyFact]
public async void ExploreTest()
{
//arrange
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,21 +4,21 @@
using Xunit;
using Xunit.Abstractions;

namespace InstaSharper.Tests.FactNTheories
namespace InstaSharper.Tests.Endpoints
{
[Collection("InstaSharper Tests")]
[Collection("Endpoints")]
public class FeedTest
{
private readonly ITestOutputHelper _output;
private readonly string _password = Environment.GetEnvironmentVariable("instaapiuserpassword");
private readonly string _username = "alex_codegarage";

public FeedTest(ITestOutputHelper output)
{
_output = output;
}

private readonly ITestOutputHelper _output;
private readonly string _username = "alex_codegarage";
private readonly string _password = Environment.GetEnvironmentVariable("instaapiuserpassword");

[Theory]
[RunnableInDebugOnlyTheory]
[InlineData("christmas")]
[InlineData("rock")]
public async void GetTagFeedTest(string tag)
Expand Down Expand Up @@ -49,7 +49,7 @@ public async void GetTagFeedTest(string tag)
}


[Theory]
[RunnableInDebugOnlyTheory]
[InlineData("rock")]
public async void GetUserTagFeedTest(string username)
{
Expand Down Expand Up @@ -78,7 +78,7 @@ public async void GetUserTagFeedTest(string username)
Assert.NotNull(tagFeed);
}

[Fact]
[RunnableInDebugOnlyFact]
public async void GetFollowingRecentActivityFeedTest()
{
//arrange
Expand Down Expand Up @@ -108,7 +108,7 @@ public async void GetFollowingRecentActivityFeedTest()
Assert.True(!folloowingRecentFeed.IsOwnActivity);
}

[Fact]
[RunnableInDebugOnlyFact]
public async void GetRecentActivityFeedTest()
{
//arrange
Expand Down Expand Up @@ -137,7 +137,7 @@ public async void GetRecentActivityFeedTest()
Assert.True(ownRecentFeed.IsOwnActivity);
}

[Fact]
[RunnableInDebugOnlyFact]
public async void GetUserFeedTest()
{
//arrange
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,19 +4,19 @@
using Xunit;
using Xunit.Abstractions;

namespace InstaSharper.Tests.FactNTheories
namespace InstaSharper.Tests.Endpoints
{
[Collection("InstaSharper Tests")]
[Collection("Endpoints")]
public class FollowersTest
{
private readonly ITestOutputHelper _output;

public FollowersTest(ITestOutputHelper output)
{
_output = output;
}

private readonly ITestOutputHelper _output;

[Theory]
[RunnableInDebugOnlyTheory]
[InlineData("discovery")]
public async void GetUserFollowersTest(string username)
{
Expand All @@ -35,7 +35,7 @@ public async void GetUserFollowersTest(string username)
Assert.NotNull(followers);
}

[Fact]
[RunnableInDebugOnlyFact]
public async void GetCurrentUserFollwersTest()
{
var username = "alex_codegarage";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@
using Xunit;
using Xunit.Abstractions;

namespace InstaSharper.Tests.FactNTheories
namespace InstaSharper.Tests.Endpoints
{
[Collection("InstaSharper Tests")]
[Collection("Endpoints")]
public class MediaTest
{
private readonly ITestOutputHelper _output;
Expand All @@ -16,7 +16,7 @@ public MediaTest(ITestOutputHelper output)
_output = output;
}

[Theory]
[RunnableInDebugOnlyTheory]
[InlineData("1379932752706850783")]
public async void GetMediaByCodeTest(string mediaId)
{
Expand All @@ -37,7 +37,7 @@ public async void GetMediaByCodeTest(string mediaId)
Assert.NotNull(media);
}

[Theory]
[RunnableInDebugOnlyTheory]
[InlineData("alex_codegarage")]
[InlineData("instagram")]
[InlineData("therock")]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,21 +4,21 @@
using Xunit;
using Xunit.Abstractions;

namespace InstaSharper.Tests.FactNTheories
namespace InstaSharper.Tests.Endpoints
{
[Collection("InstaSharper Tests")]
[Collection("Endpoints")]
public class MessagingTest
{
private readonly ITestOutputHelper _output;
private readonly string _password = Environment.GetEnvironmentVariable("instaapiuserpassword");
private readonly string _username = "alex_codegarage";

public MessagingTest(ITestOutputHelper output)
{
_output = output;
}

private readonly ITestOutputHelper _output;
private readonly string _username = "alex_codegarage";
private readonly string _password = Environment.GetEnvironmentVariable("instaapiuserpassword");

[Theory]
[RunnableInDebugOnlyTheory]
[InlineData("340282366841710300949128137443944319108")]
public async void GetDirectInboxThreadByIdTest(string threadId)
{
Expand All @@ -38,7 +38,7 @@ public async void GetDirectInboxThreadByIdTest(string threadId)
Assert.NotNull(thread);
}

[Fact]
[RunnableInDebugOnlyFact]
public async void GetDirectInboxTest()
{
//arrange
Expand All @@ -57,7 +57,7 @@ public async void GetDirectInboxTest()
Assert.NotNull(inbox);
}

[Fact]
[RunnableInDebugOnlyFact]
public async void GetRankedeRecipientsTest()
{
//arrange
Expand All @@ -82,7 +82,7 @@ public async void GetRankedeRecipientsTest()
Assert.True(result.Succeeded);
}

[Fact]
[RunnableInDebugOnlyFact]
public async void GetRecentRecipientsTest()
{
//arrange
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,21 +4,21 @@
using Xunit;
using Xunit.Abstractions;

namespace InstaSharper.Tests.FactNTheories
namespace InstaSharper.Tests.Endpoints
{
[Collection("InstaSharper Tests")]
[Collection("Endpoints")]
public class UserInfoTest
{
private readonly ITestOutputHelper _output;
private readonly string _password = Environment.GetEnvironmentVariable("instaapiuserpassword");
private readonly string _username = "alex_codegarage";

public UserInfoTest(ITestOutputHelper output)
{
_output = output;
}

private readonly ITestOutputHelper _output;
private readonly string _username = "alex_codegarage";
private readonly string _password = Environment.GetEnvironmentVariable("instaapiuserpassword");

[Fact]
[RunnableInDebugOnlyFact]
public async void GetCurrentUserTest()
{
//arrange
Expand All @@ -38,7 +38,7 @@ public async void GetCurrentUserTest()
Assert.Equal(user.UserName, _username);
}

[Fact]
[RunnableInDebugOnlyFact]
public async void GetUserTest()
{
//arrange
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@
using InstaSharper.Tests.Utils;
using Xunit;

namespace InstaSharper.Tests.FactNTheories
namespace InstaSharper.Tests.Infrastructure
{
[Collection("InstaSharper Tests")]
[Collection("Infrastructure")]
public class ApiInstanceBuilderTest
{
[Fact]
Expand Down
14 changes: 14 additions & 0 deletions InstaSharper.Tests/Utils/RunnableInDebugOnlyFact.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
using System.Diagnostics;
using Xunit;

namespace InstaSharper.Tests.Utils
{
public sealed class RunnableInDebugOnlyFact : FactAttribute
{
public RunnableInDebugOnlyFact()
{
if (!Debugger.IsAttached)
Skip = "This fact only running in interactive mode.";
}
}
}
14 changes: 14 additions & 0 deletions InstaSharper.Tests/Utils/RunnableInDebugOnlyTheory.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
using System.Diagnostics;
using Xunit;

namespace InstaSharper.Tests.Utils
{
public sealed class RunnableInDebugOnlyTheory : TheoryAttribute
{
public RunnableInDebugOnlyTheory()
{
if (!Debugger.IsAttached)
Skip = "This theory only running in interactive mode.";
}
}
}
5 changes: 5 additions & 0 deletions InstaSharper.Tests/project.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,5 +15,10 @@
}
}
}
},
"buildOptions": {
"copyToOutput": {
"include": ["xunit.runner.json"]
}
}
}
5 changes: 5 additions & 0 deletions InstaSharper.Tests/xunit.runner.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"parallelizeTestCollections": false,
"diagnosticMessages": true,
"maxParallelThreads": 1
}
26 changes: 0 additions & 26 deletions appveyor.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,31 +32,5 @@ build_script:
environment:
instaapiuserpassword:
secure: 7eAl+O5i5BxXWexd26z+wg==

artifacts:

- path: InstaSharper\bin\$(configuration)\netstandard1.6\*.dll
name: dlls

- path: '**\*.nupkg'

deploy:
- provider: GitHub
auth_token:
secure: FE6k4kAwz++t3+H7UvZkUELVZsx8DIjSOM1R3ZVT7YgqwQXuMKFQpDM5HmQobF22
artifact: /.*\.nupkg/, dlls
draft: false
prerelease: false
on:
branch: release
platform: Any CPU
configuration: Release
- provider: NuGet
api_key:
secure: At3FDhivtW6bQz/WXdwE6RzuFeouCMag3htqBE/1uuTJnFmHB8hU9gCy31ORFWtS
artifact: /.*\.nupkg/
on:
branch: release
platform: Any CPU
configuration: Release
test: off

0 comments on commit f39804c

Please sign in to comment.