Skip to content

Commit

Permalink
[Update] unittest categories add WebServicesDependent
Browse files Browse the repository at this point in the history
  • Loading branch information
sam.gerene committed Feb 18, 2018
1 parent 8a821cb commit fc64b2e
Show file tree
Hide file tree
Showing 7 changed files with 30 additions and 27 deletions.
8 changes: 5 additions & 3 deletions CDP4ServicesDal.NetCore.Tests/CdpServicesDalTestFixture.cs
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,7 @@ public void VerifyThatCdpServicesDalCanBeConstructed()
}

[Test]
[Category("WebServicesDependent")]
public async Task VerifyThatOpenReturnsDTOs()
{
var uriBuilder = new UriBuilder(this.credentials.Uri) { Path = "/Data/Restore" };
Expand All @@ -143,6 +144,7 @@ public async Task VerifyThatOpenReturnsDTOs()
}

[Test]
[Category("WebServicesDependent")]
public async Task VerifThatAClosedDalCannotBeClosedAgain()
{
var dal = new CdpServicesDal();
Expand Down Expand Up @@ -522,6 +524,7 @@ public void VerifyThatWritingMultipleOperationContainersIsNotSupported()
}

[Test]
[Category("WebServicesDependent")]
public async Task Verify_that_opens_returns_expected_result()
{
var uri = new Uri("https://cdp4services-test.rheagroup.com");
Expand All @@ -532,10 +535,9 @@ public async Task Verify_that_opens_returns_expected_result()

Assert.NotNull(result);
}

///EngineeringModel/9ec982e4-ef72-4953-aa85-b158a95d8d56/iteration


[Test]
[Category("WebServicesDependent")]
public async Task Verify_that_multiple_read_requests_can_be_made_in_parallel()
{
var uri = new Uri("https://cdp4services-test.rheagroup.com");
Expand Down
8 changes: 5 additions & 3 deletions CDP4ServicesDal.Tests/CdpServicesDalTestFixture.cs
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,7 @@ public void VerifyThatCdpServicesDalCanBeConstructed()
}

[Test]
[Category("WebServicesDependent")]
public async Task VerifyThatOpenReturnsDTOs()
{
var uriBuilder = new UriBuilder(this.credentials.Uri) { Path = "/Data/Restore" };
Expand All @@ -143,6 +144,7 @@ public async Task VerifyThatOpenReturnsDTOs()
}

[Test]
[Category("WebServicesDependent")]
public async Task VerifThatAClosedDalCannotBeClosedAgain()
{
var dal = new CdpServicesDal();
Expand Down Expand Up @@ -522,6 +524,7 @@ public void VerifyThatWritingMultipleOperationContainersIsNotSupported()
}

[Test]
[Category("WebServicesDependent")]
public async Task Verify_that_opens_returns_expected_result()
{
var uri = new Uri("https://cdp4services-test.rheagroup.com");
Expand All @@ -532,10 +535,9 @@ public async Task Verify_that_opens_returns_expected_result()

Assert.NotNull(result);
}

///EngineeringModel/9ec982e4-ef72-4953-aa85-b158a95d8d56/iteration


[Test]
[Category("WebServicesDependent")]
public async Task Verify_that_multiple_read_requests_can_be_made_in_parallel()
{
var uri = new Uri("https://cdp4services-test.rheagroup.com");
Expand Down
2 changes: 1 addition & 1 deletion CDP4WspDal.NetCore.Tests/SessionTestFixture.cs
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ public void TearDown()
/// The <see cref="Task"/>.
/// </returns>
[Test]
[Category("WSP_dependent")]
[Category("WebServicesDependent")]
public async Task Verify_That_Session_Open_Populates_cache()
{
var dal = new WspDal();
Expand Down
34 changes: 15 additions & 19 deletions CDP4WspDal.NetCore.Tests/WSPDalTestFixture.cs
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,9 @@ namespace CDP4WspDal.Tests
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Net.Http;
using System.Net.Http.Headers;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
using CDP4Common.CommonData;
Expand Down Expand Up @@ -126,8 +128,14 @@ public void VerifyThatCdpServicesDalCanBeConstructed()
}

[Test]
[Category("WebServicesDependent")]
public async Task VerifyThatOpenReturnsDTOs()
{
var uriBuilder = new UriBuilder(this.credentials.Uri) { Path = "/Data/Restore" };
var httpClient = new HttpClient();
httpClient.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Basic", Convert.ToBase64String(ASCIIEncoding.ASCII.GetBytes($"{credentials.UserName}:{credentials.Password}")));
await httpClient.PostAsync(uriBuilder.Uri, null);

var dal = new WspDal();
var result = await dal.Open(this.credentials, new CancellationToken());

Expand All @@ -137,6 +145,7 @@ public async Task VerifyThatOpenReturnsDTOs()
}

[Test]
[Category("WebServicesDependent")]
public async Task VerifThatAClosedDalCannotBeClosedAgain()
{
var dal = new WspDal();
Expand Down Expand Up @@ -207,7 +216,7 @@ public void VerifyThatAWspThatIsNotOpenCannotBeClosed()
}

[Test]
[Category("WSP_dependent")]
[Category("WebServicesDependent")]
public async Task VerifyThatReadReturnsCorrectDTO()
{
this.dal = new WspDal();
Expand Down Expand Up @@ -244,7 +253,7 @@ public async Task VerifyThatReadReturnsCorrectDTO()
/// Verify that the App does not crash
/// </summary>
[Test]
[Category("WSP_dependent")]
[Category("WebServicesDependent")]
public async Task IntegrationTest()
{
this.dal = new WspDal();
Expand Down Expand Up @@ -359,7 +368,7 @@ public void VerifyThatWSPPostBodyIsCorrectlyResolves()
}

[Test]
[Category("WSP_dependent")]
[Category("WebServicesDependent")]
public async Task VerifyThatReadIterationWorks()
{
var dal = new WspDal { Session = this.session };
Expand Down Expand Up @@ -388,7 +397,7 @@ public async Task VerifyThatReadIterationWorks()
}

[Test]
[Category("WSP_dependent")]
[Category("WebServicesDependent")]
[Category("Performance")]
public async Task AssemblerSynchronizePerformanceTest()
{
Expand Down Expand Up @@ -501,7 +510,7 @@ public void VerifyThatWritingMultipleOperationContainersIsNotSupported()
}

[Test]
[Category("WSP_dependent")]
[Category("WebServicesDependent")]
public async Task Verify_that_person_can_be_Posted()
{
var uri = new Uri("http://ocdt-dev.rheagroup.com");
Expand Down Expand Up @@ -547,18 +556,5 @@ private void SetDalToBeOpen(WspDal dal)
var credentialsProperty = typeof(WspDal).GetProperty("Credentials");
credentialsProperty.SetValue(dal, this.credentials);
}

/// <summary>
/// Gets the directory of the executing assembly
/// </summary>
/// <returns></returns>
private string GetAssemblyDirectory()
{
string codeBase = Assembly.GetExecutingAssembly().CodeBase;
var uri = new UriBuilder(codeBase);
string path = Uri.UnescapeDataString(uri.Path);
var directory = Path.GetDirectoryName(path);
return directory;
}
}
}
2 changes: 1 addition & 1 deletion CDP4WspDal.Tests/SessionTestFixture.cs
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ public void TearDown()
/// The <see cref="Task"/>.
/// </returns>
[Test]
[Category("WSP_dependent")]
[Category("WebServicesDependent")]
public async Task Verify_That_Session_Open_Populates_cache()
{
var dal = new WspDal();
Expand Down
2 changes: 2 additions & 0 deletions CDP4WspDal.Tests/WSPDalTestFixture.cs
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,7 @@ public void VerifyThatCdpServicesDalCanBeConstructed()
}

[Test]
[Category("WebServicesDependent")]
public async Task VerifyThatOpenReturnsDTOs()
{
var uriBuilder = new UriBuilder(this.credentials.Uri) { Path = "/Data/Restore" };
Expand All @@ -144,6 +145,7 @@ public async Task VerifyThatOpenReturnsDTOs()
}

[Test]
[Category("WebServicesDependent")]
public async Task VerifThatAClosedDalCannotBeClosedAgain()
{
var dal = new WspDal();
Expand Down
1 change: 1 addition & 0 deletions appveyor.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ test:
categories:
except:
- WebServicesDependent
- AppVeyorExclusion
after_test:
- .\tools\OpenCover.4.6.519\tools\OpenCover.Console.exe -register:user -target:".\tools\NUnit.ConsoleRunner.3.7.0\tools\nunit3-console.exe" -targetargs:".\CDP4Common.Tests\bin\Debug\net462\CDP4Common.Tests.dll .\CDP4JsonSerializer.Tests\bin\Debug\net462\CDP4JsonSerializer.Tests.dll " -filter:"+[CDP4Common*]* -[CDP4Common.Tests*]* +[CDP4JsonSerializer*]* -[CDP4JsonSerializer.Tests*]* " -output:"coverage.xml"
- codecov -f "coverage.xml" -t b8924a0f-355e-4a9a-b304-f403231a6bcb

0 comments on commit fc64b2e

Please sign in to comment.