Skip to content
This repository has been archived by the owner on Dec 28, 2017. It is now read-only.

Commit

Permalink
Merge branch 'release/0.3.0'
Browse files Browse the repository at this point in the history
  • Loading branch information
pascalberger committed Apr 12, 2017
2 parents eb103bc + e8fecf4 commit 1a7dddc
Show file tree
Hide file tree
Showing 26 changed files with 312 additions and 350 deletions.
35 changes: 35 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
# Contribution Guidelines

This repository uses [GitFlow] with default configuration.
Development is happening on `develop` branch.

To contribute:

* Fork this repository.
* Create a feature branch from `develop`.
* Implement your changes.
* Push your feature branch.
* Create a pull request.

## Build

To build this package we are using Cake.

On Windows PowerShell run:

```powershell
./build
```

On OSX/Linux run:

```bash
./build.sh
```

## Release

See [Cake.Recipe documentation] how to create a new release of this addin.

[GitFlow]: (http://nvie.com/posts/a-successful-git-branching-model/)
[Cake.Recipe documentation]: https://cake-contrib.github.io/Cake.Recipe/docs/usage/creating-release
20 changes: 5 additions & 15 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ More about Cake at http://cakebuild.net

|Develop|Master|
|:--:|:--:|
|[![Build status](https://ci.appveyor.com/api/projects/status/xxx/branch/develop?svg=true)](https://ci.appveyor.com/project/cakecontrib/cake-prca-pullrequests-tfs/branch/develop)|[![Build status](https://ci.appveyor.com/api/projects/status/xxx/branch/develop?svg=true)](https://ci.appveyor.com/project/cakecontrib/cake-prca-pullrequests-tfs/branch/master)|
|[![Build status](https://ci.appveyor.com/api/projects/status/dkrcp7kxms885j3m/branch/develop?svg=true)](https://ci.appveyor.com/project/cakecontrib/cake-prca-pullrequests-tfs/branch/develop)|[![Build status](https://ci.appveyor.com/api/projects/status/dkrcp7kxms885j3m/branch/develop?svg=true)](https://ci.appveyor.com/project/cakecontrib/cake-prca-pullrequests-tfs/branch/master)|

## Code Coverage

Expand All @@ -34,19 +34,9 @@ Come join in the conversation about Cake Pull Request Code Analysis in our Gitte

[![Join the chat at https://gitter.im/cake-contrib/Lobby](https://badges.gitter.im/cake-contrib/Lobby.svg)](https://gitter.im/cake-contrib/Lobby?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)

## Build
## Contributing

To build this package we are using Cake.

On Windows PowerShell run:

```powershell
./build
```

On OSX/Linux run:

```bash
./build.sh
```
Contributions are welcome. See [Contribution Guidelines].

[Cake Pull Request Code Analysis Addin]: https://github.com/cake-contrib/Cake.Prca
[Contribution Guidelines]: CONTRIBUTING.md
6 changes: 3 additions & 3 deletions nuspec/nuget/Cake.Prca.PullRequests.Tfs.nuspec
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<package xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<metadata xmlns="http://schemas.microsoft.com/packaging/2010/07/nuspec.xsd">
<id>Cake.Prca.PullRequests.Tfs</id>
<title>TFS and VSTS support for Cake Pull Request Code Analysis</title>
<title>Cake.Prca.PullRequests.Tfs</title>
<version>0.0.0</version>
<authors>BBT Software AG</authors>
<owners>bbtsoftware, pascalberger, cake-contrib</owners>
Expand All @@ -14,9 +14,9 @@
<requireLicenseAcceptance>false</requireLicenseAcceptance>
<copyright>Copyright © 2017 BBT Software AG, Root/Zermatt, Switzerland</copyright>
<tags>Cake Script PullRequest CodeAnalysis Cake-Prca-PullRequestSystem TFS VSTS Linting</tags>
<releaseNotes>https://github.com/cake-contrib/Cake.Prca.PullRequests.Tfs/releases/tag/0.2.2</releaseNotes>
<releaseNotes>https://github.com/cake-contrib/Cake.Prca.PullRequests.Tfs/releases/tag/0.3.0</releaseNotes>
<dependencies>
<dependency id="Cake.Prca" version="[0.2,0.3)" />
<dependency id="Cake.Prca" version="[0.3,0.4)" />
</dependencies>
</metadata>
<files>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ public void Should_Return_PrcaNtlmCredentials_Object()
var credentials = AuthenticationProvider.AuthenticationNtlm();

// Then
credentials.ShouldBeOfType<PrcaNtlmCredentials>();
credentials.ShouldBeOfType<TfsNtlmCredentials>();
}
}

Expand Down Expand Up @@ -88,7 +88,7 @@ public void Should_Return_PrcaBasicCredentials_Object()
var credentials = AuthenticationProvider.AuthenticationBasic("foo", "bar");

// Then
credentials.ShouldBeOfType<PrcaBasicCredentials>();
credentials.ShouldBeOfType<TfsBasicCredentials>();
}

[Fact]
Expand All @@ -101,8 +101,8 @@ public void Should_Set_User_Name()
var credentials = AuthenticationProvider.AuthenticationBasic(userName, "bar");

// Then
credentials.ShouldBeOfType<PrcaBasicCredentials>();
((PrcaBasicCredentials)credentials).UserName.ShouldBe(userName);
credentials.ShouldBeOfType<TfsBasicCredentials>();
((TfsBasicCredentials)credentials).UserName.ShouldBe(userName);
}

[Fact]
Expand All @@ -115,8 +115,8 @@ public void Should_Set_Password()
var credentials = AuthenticationProvider.AuthenticationBasic("foo", password);

// Then
credentials.ShouldBeOfType<PrcaBasicCredentials>();
((PrcaBasicCredentials)credentials).Password.ShouldBe(password);
credentials.ShouldBeOfType<TfsBasicCredentials>();
((TfsBasicCredentials)credentials).Password.ShouldBe(password);
}
}

Expand Down Expand Up @@ -159,7 +159,7 @@ public void Should_Return_PrcaBasicCredentials_Object()
var credentials = AuthenticationProvider.AuthenticationPersonalAccessToken("foo");

// Then
credentials.ShouldBeOfType<PrcaBasicCredentials>();
credentials.ShouldBeOfType<TfsBasicCredentials>();
}

[Fact]
Expand All @@ -172,9 +172,9 @@ public void Should_Set_Personal_Access_Token()
var credentials = AuthenticationProvider.AuthenticationPersonalAccessToken(personalAccessToken);

// Then
credentials.ShouldBeOfType<PrcaBasicCredentials>();
((PrcaBasicCredentials)credentials).UserName.ShouldBe(string.Empty);
((PrcaBasicCredentials)credentials).Password.ShouldBe(personalAccessToken);
credentials.ShouldBeOfType<TfsBasicCredentials>();
((TfsBasicCredentials)credentials).UserName.ShouldBe(string.Empty);
((TfsBasicCredentials)credentials).Password.ShouldBe(personalAccessToken);
}
}

Expand Down Expand Up @@ -217,7 +217,7 @@ public void Should_Return_PrcaOAuthCredentials_Object()
var credentials = AuthenticationProvider.AuthenticationOAuth("foo");

// Then
credentials.ShouldBeOfType<PrcaOAuthCredentials>();
credentials.ShouldBeOfType<TfsOAuthCredentials>();
}

[Fact]
Expand All @@ -230,8 +230,8 @@ public void Should_Set_Access_Token()
var credentials = AuthenticationProvider.AuthenticationOAuth(accessToken);

// Then
credentials.ShouldBeOfType<PrcaOAuthCredentials>();
((PrcaOAuthCredentials)credentials).AccessToken.ShouldBe(accessToken);
credentials.ShouldBeOfType<TfsOAuthCredentials>();
((TfsOAuthCredentials)credentials).AccessToken.ShouldBe(accessToken);
}
}

Expand Down Expand Up @@ -304,7 +304,7 @@ public void Should_Return_PrcaAadCredentials_Object()
var credentials = AuthenticationProvider.AuthenticationAzureActiveDirectory("foo", "bar");

// Then
credentials.ShouldBeOfType<PrcaAadCredentials>();
credentials.ShouldBeOfType<TfsAadCredentials>();
}

[Fact]
Expand All @@ -317,8 +317,8 @@ public void Should_Set_User_Name()
var credentials = AuthenticationProvider.AuthenticationAzureActiveDirectory(userName, "bar");

// Then
credentials.ShouldBeOfType<PrcaAadCredentials>();
((PrcaAadCredentials)credentials).UserName.ShouldBe(userName);
credentials.ShouldBeOfType<TfsAadCredentials>();
((TfsAadCredentials)credentials).UserName.ShouldBe(userName);
}

[Fact]
Expand All @@ -331,8 +331,8 @@ public void Should_Set_Password()
var credentials = AuthenticationProvider.AuthenticationAzureActiveDirectory("foo", password);

// Then
credentials.ShouldBeOfType<PrcaAadCredentials>();
((PrcaAadCredentials)credentials).Password.ShouldBe(password);
credentials.ShouldBeOfType<TfsAadCredentials>();
((TfsAadCredentials)credentials).Password.ShouldBe(password);
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ public sealed class ThePrcaAadCredentialsCtor
public void Should_Set_User_Name(string userName)
{
// When
var credentials = new PrcaAadCredentials(userName, "bar");
var credentials = new TfsAadCredentials(userName, "bar");

// Then
credentials.UserName.ShouldBe(userName);
Expand All @@ -30,7 +30,7 @@ public void Should_Set_User_Name(string userName)
public void Should_Set_Password_Name(string password)
{
// When
var credentials = new PrcaAadCredentials("foo", password);
var credentials = new TfsAadCredentials("foo", password);

// Then
credentials.Password.ShouldBe(password);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ public sealed class ThePrcaBasicCredentialsCtor
public void Should_Set_User_Name(string userName)
{
// When
var credentials = new PrcaBasicCredentials(userName, "bar");
var credentials = new TfsBasicCredentials(userName, "bar");

// Then
credentials.UserName.ShouldBe(userName);
Expand All @@ -30,7 +30,7 @@ public void Should_Set_User_Name(string userName)
public void Should_Set_Password_Name(string password)
{
// When
var credentials = new PrcaBasicCredentials("foo", password);
var credentials = new TfsBasicCredentials("foo", password);

// Then
credentials.Password.ShouldBe(password);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,10 @@ public sealed class ThePrcaNtlmCredentialsCtor
public void Should_Not_Throw()
{
// Given / When
var credentials = new PrcaNtlmCredentials();
var credentials = new TfsNtlmCredentials();

// Then
credentials.ShouldBeOfType<PrcaNtlmCredentials>();
credentials.ShouldBeOfType<TfsNtlmCredentials>();
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ public sealed class ThePrcaOAuthCredentialsCtor
public void Should_Throw_If_Access_Token_Is_Null()
{
// Given / When
var result = Record.Exception(() => new PrcaOAuthCredentials(null));
var result = Record.Exception(() => new TfsOAuthCredentials(null));

// Then
result.IsArgumentNullException("accessToken");
Expand All @@ -22,7 +22,7 @@ public void Should_Throw_If_Access_Token_Is_Null()
public void Should_Throw_If_Access_Token_Is_Empty()
{
// Given / When
var result = Record.Exception(() => new PrcaOAuthCredentials(string.Empty));
var result = Record.Exception(() => new TfsOAuthCredentials(string.Empty));

// Then
result.IsArgumentOutOfRangeException("accessToken");
Expand All @@ -32,7 +32,7 @@ public void Should_Throw_If_Access_Token_Is_Empty()
public void Should_Throw_If_Access_Token_Is_WhiteSpace()
{
// Given / When
var result = Record.Exception(() => new PrcaOAuthCredentials(" "));
var result = Record.Exception(() => new TfsOAuthCredentials(" "));

// Then
result.IsArgumentOutOfRangeException("accessToken");
Expand All @@ -45,7 +45,7 @@ public void Should_Set_Access_Token()
const string accessToken = "foo";

// When
var credentials = new PrcaOAuthCredentials(accessToken);
var credentials = new TfsOAuthCredentials(accessToken);

// Then
credentials.AccessToken.ShouldBe(accessToken);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,10 @@
<HintPath>..\packages\Cake.Core.0.16.2\lib\net45\Cake.Core.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="Cake.Prca, Version=1.0.0.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\Cake.Prca.0.3.0\lib\net45\Cake.Prca.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="Cake.Testing, Version=0.16.2.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\Cake.Testing.0.16.2\lib\net45\Cake.Testing.dll</HintPath>
<Private>True</Private>
Expand Down Expand Up @@ -78,9 +82,9 @@
<Compile Include="Authentication\PrcaNtlmCredentialsTests.cs" />
<Compile Include="Authentication\PrcaOAuthCredentialsTests.cs" />
<Compile Include="Authentication\PrcaBasicCredentialsTests.cs" />
<Compile Include="ContentProviderTests.cs" />
<Compile Include="ExceptionAssertExtensions.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="RepositoryDescriptionTests.cs" />
<Compile Include="TfsPullRequestSettingsTests.cs" />
</ItemGroup>
<ItemGroup>
Expand Down
71 changes: 71 additions & 0 deletions src/Cake.Prca.PullRequests.Tfs.Tests/ContentProviderTests.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
namespace Cake.Prca.PullRequests.Tfs.Tests
{
using System;
using Issues;
using Shouldly;
using Xunit;

public class ContentProviderTests
{
public sealed class TheGetContentClass
{
[Theory]
[InlineData(
@"foo.cs",
123,
"Some message",
1,
"foo",
null,
"foo: Some message")]
[InlineData(
@"foo.cs",
123,
"Some message",
1,
"",
null,
"Some message")]
[InlineData(
@"foo.cs",
123,
"Some message",
1,
" ",
null,
"Some message")]
[InlineData(
@"foo.cs",
123,
"Some message",
1,
"foo",
"http://google.com",
"[foo](http://google.com/): Some message")]
public void Should_Return_Correct_Value(
string filePath,
int? line,
string message,
int priority,
string rule,
string ruleUrl,
string expectedResult)
{
// Given
Uri ruleUri = null;
if (!string.IsNullOrWhiteSpace(ruleUrl))
{
ruleUri = new Uri(ruleUrl);
}

var issue = new CodeAnalysisIssue(filePath, line, message, priority, rule, ruleUri, "Foo");

// When
var result = ContentProvider.GetContent(issue);

// Then
result.ShouldBe(expectedResult);
}
}
}
}

0 comments on commit 1a7dddc

Please sign in to comment.