Skip to content

Commit

Permalink
Merge pull request #8 from mskcc/develop
Browse files Browse the repository at this point in the history
Merging development into master.
  • Loading branch information
mattkoch614 authored Dec 12, 2017
2 parents cbbb08f + 3c08d1a commit cb2f681
Show file tree
Hide file tree
Showing 3 changed files with 79 additions and 0 deletions.
1 change: 1 addition & 0 deletions Medidata.RWS.NET/Core/Requests/RWSConnection.cs
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ public RwsConnection(string domain, string virtual_dir = "RaveWebServices")
this.domain = domain.ToLower().StartsWith("http") ? domain : string.Format("https://{0}.mdsol.com", domain);
this.base_url = string.Format("{0}/{1}", this.domain, virtual_dir);
this.request_time = TimeSpan.MinValue;
ServicePointManager.SecurityProtocol = ServicePointManager.SecurityProtocol|SecurityProtocolType.Tls12;
}


Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
using System;
using System.Net;
using Medidata.RWS.Core.Exceptions;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using Medidata.RWS.Core.Requests;
using Medidata.RWS.Core.Responses;

namespace Medidata.RWS.Tests.Integration
{
[TestClass]
public class SecurityProtocolTest_MedidataRAVE_06JAN18
{
readonly string MEDIDATA_RAVE_TLS_TEST_SITE = "secops-rave-test";
protected RwsConnection rws;
protected SecurityProtocolType defaultSecurityProtocolType;
[TestInitialize]
public void InitRwsConn()
{
defaultSecurityProtocolType = ServicePointManager.SecurityProtocol;
rws = new RwsConnection(MEDIDATA_RAVE_TLS_TEST_SITE);
}


[TestMethod]
[ExpectedException(typeof(RWSException))]
public void SSL_BasicRWSRequest_ShouldExceptionWithStatusCode0()
{
ServicePointManager.SecurityProtocol = SecurityProtocolType.Ssl3;
var response = rws.SendRequest(new VersionRequest()) as RWSTextResponse;
Assert.Fail();
}
[TestMethod]
[ExpectedException(typeof(RWSException))]
public void TLS10_BasicRWSRequest_ShouldExceptionWithStatusCode0()
{
ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls;
var response = rws.SendRequest(new VersionRequest()) as RWSTextResponse;
Assert.Fail();
}
[TestMethod]
[ExpectedException(typeof(RWSException))]
public void TLS11_BasicRWSRequest_ShouldExceptionWithStatusCode0()
{
ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls11;
var response = rws.SendRequest(new VersionRequest()) as RWSTextResponse;
Assert.Fail();
}

[TestMethod]
[ExpectedException(typeof(RWSException))]
public void DotNetDefault_BasicRWSRequest_ShouldExceptionWithStatusCode0()
{
ServicePointManager.SecurityProtocol = defaultSecurityProtocolType;
var response = rws.SendRequest(new VersionRequest()) as RWSTextResponse;
Assert.Fail();
}
[TestMethod]
public void TLS12_BasicRWSRequest_ShouldReturnTextResponse()
{
try
{
var response = rws.SendRequest(new VersionRequest()) as RWSTextResponse;
var expected = "1.16.0";
var actual = response.ResponseText;
Assert.AreEqual(expected, actual);
}
catch (RWSException rwse)
{
Assert.Fail(rwse.Message);
}


}


}
}
1 change: 1 addition & 0 deletions Medidata.RWS.Tests/Medidata.RWS.Tests.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,7 @@
<Compile Include="Extras\AuditEvent\AuditEventParserTests.cs" />
<Compile Include="Extras\AuditEvent\ODMAdapterTests.cs" />
<Compile Include="Helpers\Helpers.cs" />
<Compile Include="Integration\SecurityProtocolTest_MedidataRAVE_06JAN18.cs" />
<Compile Include="ODMTests.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="RWSHelpersTests.cs" />
Expand Down

0 comments on commit cb2f681

Please sign in to comment.