diff --git a/.travis.yml b/.travis.yml
index 7a76bd5..b863c6c 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -1,2 +1,2 @@
language: csharp
-solution: src/DynWWW.sln
+solution: src/DynaWeb.sln
diff --git a/README.md b/README.md
index 9954c8b..d712757 100644
--- a/README.md
+++ b/README.md
@@ -1,5 +1,5 @@
# DynaWeb
-[![Build Status](https://travis-ci.org/radumg/DynWWW.svg?branch=master)](https://travis-ci.org/radumg/DynWWW) [![GitHub version](https://badge.fury.io/gh/radumg%2FDynaWeb.svg)](https://badge.fury.io/gh/radumg%2FDynaWeb) [![contributions welcome](https://img.shields.io/badge/contributions-welcome-brightgreen.svg?style=flat)](https://github.com/radumg/DynaWeb/blob/master/CONTRIBUTING.md)
+[![Build Status](https://travis-ci.org/radumg/DynaWeb.svg?branch=master)](https://travis-ci.org/radumg/DynaWeb) [![GitHub version](https://badge.fury.io/gh/radumg%2FDynaWeb.svg)](https://badge.fury.io/gh/radumg%2FDynaWeb) [![contributions welcome](https://img.shields.io/badge/contributions-welcome-brightgreen.svg?style=flat)](https://github.com/radumg/DynaWeb/blob/master/CONTRIBUTING.md) [![Codacy Badge](https://api.codacy.com/project/badge/Grade/f482d6c8bb27468e916bba4471511615)](https://www.codacy.com/project/radugidei/DynaWeb/dashboard?utm_source=github.com&utm_medium=referral&utm_content=radumg/DynaWeb&utm_campaign=Badge_Grade_Dashboard)
---
__DynaWeb__ is a [Dynamo](http://www.dynamobim.org) package providing support for interaction with the interwebz in general and with REST APIs in particular.
diff --git a/src/DebugApp/App.config b/src/DebugApp/App.config
deleted file mode 100644
index 88fa402..0000000
--- a/src/DebugApp/App.config
+++ /dev/null
@@ -1,6 +0,0 @@
-
-
-
-
-
-
\ No newline at end of file
diff --git a/src/DebugApp/DebugApp.csproj b/src/DebugApp/DebugApp.csproj
deleted file mode 100644
index 61a4e9f..0000000
--- a/src/DebugApp/DebugApp.csproj
+++ /dev/null
@@ -1,59 +0,0 @@
-
-
-
-
- Debug
- AnyCPU
- {F2D82A82-100B-4594-B50F-7C7C815C4370}
- Exe
- DebugApp
- DebugApp
- v4.5.2
- 512
- true
-
-
- AnyCPU
- true
- full
- false
- bin\Debug\
- DEBUG;TRACE
- prompt
- 4
-
-
- AnyCPU
- pdbonly
- true
- bin\Release\
- TRACE
- prompt
- 4
-
-
-
- ..\packages\Newtonsoft.Json.10.0.3\lib\net45\Newtonsoft.Json.dll
-
-
- ..\packages\RestSharp.105.2.3\lib\net452\RestSharp.dll
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/src/DebugApp/Program.cs b/src/DebugApp/Program.cs
deleted file mode 100644
index 69c7c5d..0000000
--- a/src/DebugApp/Program.cs
+++ /dev/null
@@ -1,15 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
-
-namespace DebugApp
-{
- class Program
- {
- static void Main(string[] args)
- {
- }
- }
-}
diff --git a/src/DebugApp/packages.config b/src/DebugApp/packages.config
deleted file mode 100644
index d186dc1..0000000
--- a/src/DebugApp/packages.config
+++ /dev/null
@@ -1,5 +0,0 @@
-
-
-
-
-
\ No newline at end of file
diff --git a/src/DynaWeb.All.sln b/src/DynaWeb.sln
similarity index 53%
rename from src/DynaWeb.All.sln
rename to src/DynaWeb.sln
index ae074cc..12ed51f 100644
--- a/src/DynaWeb.All.sln
+++ b/src/DynaWeb.sln
@@ -5,9 +5,7 @@ VisualStudioVersion = 15.0.26430.16
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "DynaWeb", "DynaWeb\DynaWeb.csproj", "{CE19C882-1AAC-434C-99AF-4A285DA053BA}"
EndProject
-Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "DebugApp", "DebugApp\DebugApp.csproj", "{F2D82A82-100B-4594-B50F-7C7C815C4370}"
-EndProject
-Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "DynaWeb.Core.Tests", "..\test\DynaWeb.Core.Tests\DynaWeb.Core.Tests.csproj", "{50A649C6-FB32-4C6D-A7B6-6EB99DE8547D}"
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "DynaWeb.Tests", "..\test\DynaWeb.Tests\DynaWeb.Tests.csproj", "{86015C9C-DEBA-4C2E-B9EF-872C88ED7D6C}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
@@ -19,16 +17,15 @@ Global
{CE19C882-1AAC-434C-99AF-4A285DA053BA}.Debug|Any CPU.Build.0 = Debug|Any CPU
{CE19C882-1AAC-434C-99AF-4A285DA053BA}.Release|Any CPU.ActiveCfg = Release|Any CPU
{CE19C882-1AAC-434C-99AF-4A285DA053BA}.Release|Any CPU.Build.0 = Release|Any CPU
- {F2D82A82-100B-4594-B50F-7C7C815C4370}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
- {F2D82A82-100B-4594-B50F-7C7C815C4370}.Debug|Any CPU.Build.0 = Debug|Any CPU
- {F2D82A82-100B-4594-B50F-7C7C815C4370}.Release|Any CPU.ActiveCfg = Release|Any CPU
- {F2D82A82-100B-4594-B50F-7C7C815C4370}.Release|Any CPU.Build.0 = Release|Any CPU
- {50A649C6-FB32-4C6D-A7B6-6EB99DE8547D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
- {50A649C6-FB32-4C6D-A7B6-6EB99DE8547D}.Debug|Any CPU.Build.0 = Debug|Any CPU
- {50A649C6-FB32-4C6D-A7B6-6EB99DE8547D}.Release|Any CPU.ActiveCfg = Release|Any CPU
- {50A649C6-FB32-4C6D-A7B6-6EB99DE8547D}.Release|Any CPU.Build.0 = Release|Any CPU
+ {86015C9C-DEBA-4C2E-B9EF-872C88ED7D6C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {86015C9C-DEBA-4C2E-B9EF-872C88ED7D6C}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {86015C9C-DEBA-4C2E-B9EF-872C88ED7D6C}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {86015C9C-DEBA-4C2E-B9EF-872C88ED7D6C}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
+ GlobalSection(ExtensibilityGlobals) = postSolution
+ SolutionGuid = {17904F06-2926-4867-BF32-DB627052F52D}
+ EndGlobalSection
EndGlobal
diff --git a/src/DynaWeb/Classes/Execution.cs b/src/DynaWeb/Classes/Execution.cs
index fbb9dd7..a011bd9 100644
--- a/src/DynaWeb/Classes/Execution.cs
+++ b/src/DynaWeb/Classes/Execution.cs
@@ -1,10 +1,7 @@
-using RestSharp;
+using DynaWeb.Properties;
+using RestSharp;
using System;
-using System.Collections.Generic;
-using System.Linq;
using System.Net;
-using System.Text;
-using System.Threading.Tasks;
namespace DynaWeb
{
@@ -16,7 +13,7 @@ public static class Execute
#region internal methods
private static WebResponse ClientRequestMethod(WebClient webClient, WebRequest webRequest)
{
- if (webRequest == null) throw new ArgumentNullException(DynaWeb.Properties.Resources.WebClientRequestNullMessage);
+ if (webRequest == null) throw new ArgumentNullException(Resources.WebClientRequestNullMessage);
// build a client & request to execute
WebClient client;
WebRequest request = webRequest;
@@ -39,16 +36,15 @@ private static WebResponse ClientRequestMethod(WebClient webClient, WebRequest w
try
{
var uri = WebClient.BuildUri(client, request);
- if (string.IsNullOrEmpty(uri) || DynaWeb.Helpers.CheckURI(Helpers.ParseUriFromString(uri)) != true)
+ if (string.IsNullOrEmpty(uri) || !Helpers.IsUrlValid(Helpers.ParseUriFromString(uri)))
{
- //TODO : error handling here is limited, needs checking and expanding.
- throw new InvalidOperationException("Malformed URL.");
+ throw new InvalidOperationException();
}
}
catch (Exception e)
{
throw new InvalidOperationException(
- DynaWeb.Properties.Resources.WebClientBuildUrlFailed +
+ Resources.WebClientBuildUrlFailed +
Environment.NewLine +
"Error returned was :" + Environment.NewLine +
e.Message);
@@ -70,13 +66,12 @@ private static WebResponse ClientRequestMethod(WebClient webClient, WebRequest w
switch (responseFromServer.ResponseStatus)
{
case ResponseStatus.None:
- throw new InvalidOperationException(DynaWeb.Properties.Resources.WebResponseNetworkErrorMessage);
case ResponseStatus.Error:
- throw new InvalidOperationException(DynaWeb.Properties.Resources.WebResponseNetworkErrorMessage);
+ throw new InvalidOperationException(Resources.WebResponseNetworkErrorMessage);
case ResponseStatus.TimedOut:
- throw new InvalidOperationException(DynaWeb.Properties.Resources.WebRequestTimedOutMessage);
+ throw new InvalidOperationException(Resources.WebRequestTimedOutMessage);
case ResponseStatus.Aborted:
- throw new InvalidOperationException(DynaWeb.Properties.Resources.WebResponseAbortedMessage);
+ throw new InvalidOperationException(Resources.WebResponseAbortedMessage);
default:
break;
}
diff --git a/src/DynaWeb/Classes/WebClient.cs b/src/DynaWeb/Classes/WebClient.cs
index c5ea67e..695661b 100644
--- a/src/DynaWeb/Classes/WebClient.cs
+++ b/src/DynaWeb/Classes/WebClient.cs
@@ -1,6 +1,7 @@
using Autodesk.DesignScript.Runtime;
using RestSharp;
using System;
+using DynaWeb.Properties;
namespace DynaWeb
{
@@ -164,7 +165,7 @@ public static WebResponse Execute(WebClient client, WebRequest request)
/// A string representation of the assembly Uri
public static string BuildUri(WebClient client, WebRequest request)
{
- if (request == null) throw new ArgumentNullException(DynaWeb.Properties.Resources.WebClientRequestNullMessage);
+ if (request == null) throw new ArgumentNullException(Resources.WebClientRequestNullMessage);
return client.restClient.BuildUri(request.restRequest).ToString();
}
@@ -178,7 +179,7 @@ public static string BuildUri(WebClient client, WebRequest request)
public WebClient SetBaseURL(string url)
{
if (string.IsNullOrEmpty(url)) throw new ArgumentNullException(DynaWeb.Properties.Resources.WebClientUrlNullMessage);
- if (!Helpers.CheckURI(Helpers.ParseUriFromString(url))) throw new ArgumentNullException(DynaWeb.Properties.Resources.WebUrlInvalidMessage);
+ if (!Helpers.IsUrlValid(Helpers.ParseUriFromString(url))) throw new ArgumentNullException(DynaWeb.Properties.Resources.WebUrlInvalidMessage);
this.BaseUrl = Helpers.ParseUriFromString(url);
return this;
}
diff --git a/src/DynaWeb/Classes/WebRequest.cs b/src/DynaWeb/Classes/WebRequest.cs
index 99a38ef..8bbbe8a 100644
--- a/src/DynaWeb/Classes/WebRequest.cs
+++ b/src/DynaWeb/Classes/WebRequest.cs
@@ -5,6 +5,7 @@
using System.Net;
using System.Collections.Specialized;
using System.IO;
+using DynaWeb.Properties;
namespace DynaWeb
{
@@ -414,11 +415,11 @@ public WebRequest AddObject(object obj)
public WebRequest AddParameter(string name, object value, string parameterType)
{
if (string.IsNullOrEmpty(name))
- throw new ArgumentNullException("Name parameter cannot be null.");
+ throw new ArgumentNullException("name");
if (value.Equals(null))
- throw new ArgumentNullException("Value parameter cannot be null.");
+ throw new ArgumentNullException("value");
if (Enum.TryParse(parameterType, true, out ParameterType pType) == false)
- throw new ArgumentException("Could not parse the supplied value into a valid Parameter Type.");
+ throw new ArgumentException("value", Resources.WebRequestParameterValueInvalid);
try
{
diff --git a/src/DynaWeb/Classes/WebResponse.cs b/src/DynaWeb/Classes/WebResponse.cs
index 10cdb86..17de132 100644
--- a/src/DynaWeb/Classes/WebResponse.cs
+++ b/src/DynaWeb/Classes/WebResponse.cs
@@ -67,7 +67,7 @@ public List> Cookies
values.Add(cookie.Value);
values.Add(cookie.TimeStamp.ToString());
- result.Add(new List() { "Name", "Value", "TimeStamp" });
+ result.Add(new List { "Name", "Value", "TimeStamp" });
result.Add(values);
}
diff --git a/src/DynaWeb/DynaWeb.csproj b/src/DynaWeb/DynaWeb.csproj
index 7183d69..4b12ab3 100644
--- a/src/DynaWeb/DynaWeb.csproj
+++ b/src/DynaWeb/DynaWeb.csproj
@@ -1,5 +1,6 @@
+
Debug
@@ -11,6 +12,8 @@
DynaWeb
v4.5.2
512
+
+
true
@@ -31,49 +34,44 @@
4
-
- packages\DynamoVisualProgramming.DynamoCoreNodes.1.3.0\lib\net45\Analysis.dll
- False
+
+ ..\packages\DynamoVisualProgramming.DynamoCoreNodes.2.0.1.5055\lib\net45\Analysis.dll
-
- packages\DynamoVisualProgramming.DynamoCoreNodes.1.3.0\lib\net45\Display.dll
- False
+
+ ..\packages\CommonServiceLocator.2.0.4\lib\net45\CommonServiceLocator.dll
-
- packages\DynamoVisualProgramming.DynamoCoreNodes.1.3.0\lib\net45\DSCoreNodes.dll
- False
+
+ ..\packages\DynamoVisualProgramming.Core.2.0.1.5055\lib\net45\DesignScriptBuiltin.dll
-
- packages\DynamoVisualProgramming.Core.1.3.0\lib\net45\DSIronPython.dll
- False
+
+ ..\packages\DynamoVisualProgramming.DynamoCoreNodes.2.0.1.5055\lib\net45\DSCoreNodes.dll
-
- packages\DynamoVisualProgramming.Core.1.3.0\lib\net45\DynamoApplications.dll
- False
+
+ ..\packages\DynamoVisualProgramming.Core.2.0.1.5055\lib\net45\DSIronPython.dll
-
- packages\DynamoVisualProgramming.Core.1.3.0\lib\net45\DynamoCore.dll
- False
+
+ ..\packages\DynamoVisualProgramming.Core.2.0.1.5055\lib\net45\DynamoApplications.dll
-
- packages\DynamoVisualProgramming.Core.1.3.0\lib\net45\DynamoInstallDetective.dll
- False
+
+ ..\packages\DynamoVisualProgramming.Core.2.0.1.5055\lib\net45\DynamoCore.dll
-
- packages\DynamoVisualProgramming.DynamoServices.1.3.0\lib\net45\DynamoServices.dll
- False
+
+ ..\packages\DynamoVisualProgramming.Core.2.0.1.5055\lib\net45\DynamoInstallDetective.dll
-
- packages\DynamoVisualProgramming.Core.1.3.0\lib\net45\DynamoShapeManager.dll
- False
+
+ ..\packages\DynamoVisualProgramming.DynamoServices.2.0.1.5055\lib\net45\DynamoServices.dll
-
- packages\DynamoVisualProgramming.ZeroTouchLibrary.1.3.0\lib\net45\DynamoUnits.dll
- False
+
+ ..\packages\DynamoVisualProgramming.Core.2.0.1.5055\lib\net45\DynamoShapeManager.dll
-
- packages\DynamoVisualProgramming.Core.1.3.0\lib\net45\DynamoUtilities.dll
- False
+
+ ..\packages\DynamoVisualProgramming.ZeroTouchLibrary.2.0.1.5055\lib\net45\DynamoUnits.dll
+
+
+ ..\packages\DynamoVisualProgramming.Core.2.0.1.5055\lib\net45\DynamoUtilities.dll
+
+
+ ..\packages\DynamoVisualProgramming.DynamoCoreNodes.2.0.1.5055\lib\net45\GeometryColor.dll
..\packages\Prism.Composition.5.0.0\lib\NET45\Microsoft.Practices.Prism.Composition.dll
@@ -99,45 +97,32 @@
..\packages\Prism.Mvvm.1.0.0\lib\net45\Microsoft.Practices.Prism.SharedInterfaces.dll
False
-
- ..\packages\CommonServiceLocator.1.3\lib\portable-net4+sl5+netcore45+wpa81+wp8\Microsoft.Practices.ServiceLocation.dll
- False
-
-
- ..\packages\Newtonsoft.Json.10.0.3\lib\net45\Newtonsoft.Json.dll
- False
+
+ ..\packages\Newtonsoft.Json.11.0.2\lib\net45\Newtonsoft.Json.dll
-
- packages\DynamoVisualProgramming.DynamoServices.1.3.0\lib\net45\NodeServices2.dll
- False
+
+ ..\packages\NUnit.3.10.1\lib\net45\nunit.framework.dll
-
- ..\packages\NUnit.3.7.1\lib\net45\nunit.framework.dll
- False
-
-
- packages\DynamoVisualProgramming.Core.1.3.0\lib\net45\ProtoCore.dll
- False
+
+ ..\packages\DynamoVisualProgramming.Core.2.0.1.5055\lib\net45\ProtoCore.dll
- packages\DynamoVisualProgramming.ZeroTouchLibrary.1.3.0\lib\net45\ProtoGeometry.dll
- False
+ ..\packages\DynamoVisualProgramming.ZeroTouchLibrary.2.0.1.5055\lib\net45\ProtoGeometry.dll
-
- ..\packages\RestSharp.105.2.3\lib\net452\RestSharp.dll
- False
+
+ ..\packages\RestSharp.106.3.1\lib\net452\RestSharp.dll
+
-
- packages\DynamoVisualProgramming.Core.1.3.0\lib\net45\VMDataBridge.dll
- False
+
+ ..\packages\DynamoVisualProgramming.Core.2.0.1.5055\lib\net45\VMDataBridge.dll
@@ -146,7 +131,6 @@
-
True
@@ -169,6 +153,13 @@
- (robocopy $(OutDir) C:\users\radug\desktop\testing /W:3 /R:3 /IT /IS /XF *.tmp) ^& IF %25ERRORLEVEL%25 LEQ 4 exit /B 0
+
+
+
+
+ This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}.
+
+
+
\ No newline at end of file
diff --git a/src/DynaWeb/Helpers/WebHelpers.cs b/src/DynaWeb/Helpers/WebHelpers.cs
index bff7d57..408a2fd 100644
--- a/src/DynaWeb/Helpers/WebHelpers.cs
+++ b/src/DynaWeb/Helpers/WebHelpers.cs
@@ -1,19 +1,16 @@
using System;
using System.Collections.Generic;
using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
using DynaWeb.Properties;
using Autodesk.DesignScript.Runtime;
-using DynaWeb;
using Newtonsoft.Json;
using Newtonsoft.Json.Linq;
-using System.Reflection;
-using Newtonsoft.Json.Converters;
-using System.Dynamic;
namespace DynaWeb
{
+ ///
+ /// A set of utility methods used throughout the DynaWeb package.
+ ///
public static class Helpers
{
#region URL & Uri handling
@@ -26,17 +23,16 @@ public static Uri ParseUriFromString(string url)
{
if (string.IsNullOrEmpty(url))
{
- throw new ArgumentException(DynaWeb.Properties.Resources.WebUrlNullMessage);
+ throw new ArgumentException(Resources.WebUrlNullMessage);
}
Uri uriResult;
var result = Uri.TryCreate(url, UriKind.Absolute, out uriResult)
- && (uriResult.Scheme == Uri.UriSchemeHttp
- || uriResult.Scheme == Uri.UriSchemeHttps);
+ && (uriResult.Scheme == Uri.UriSchemeHttp || uriResult.Scheme == Uri.UriSchemeHttps);
if (!result)
{
- throw new UriFormatException(DynaWeb.Properties.Resources.WebUrlInvalidMessage);
+ throw new UriFormatException(Resources.WebUrlInvalidMessage);
}
return uriResult;
@@ -45,9 +41,9 @@ public static Uri ParseUriFromString(string url)
/// Check the URI is valid
/// The URI to check
/// True if is valid, False otherwise
- public static Boolean CheckURI(Uri uriToCheck)
+ public static Boolean IsUrlValid(Uri uriToCheck)
{
- if (uriToCheck.IsFile || uriToCheck.IsUnc) throw new Exception("URI is file or is UNC pointing to internal network");
+ if (uriToCheck.IsFile || uriToCheck.IsUnc) throw new Exception(Resources.WebUrlIsLocal);
if (!Uri.CheckSchemeName(uriToCheck.Scheme))
return false;
@@ -56,7 +52,7 @@ public static Boolean CheckURI(Uri uriToCheck)
#endregion
- #region deserialisation
+ #region Deserialisation
///
/// Recursively parse a JSON token into native data types.
@@ -74,7 +70,7 @@ public static object Deserialise(string json)
///
/// The JSON string that needs to be deserialised.
/// The response deserialised as an object.
- public static dynamic DeserializeAsObject(string json)
+ public static dynamic DeserialiseAsObject(string json)
{
/// We don't want the deserialisation to break if some properties are empty.
/// So we need to specify the behaviour when such values are encountered.
@@ -93,7 +89,7 @@ public static dynamic DeserializeAsObject(string json)
/// The JSON string that needs to be deserialised.
/// The object that will be used to determine what type to deserialise to.
/// The response deserialised as same type as supplied object.
- public static dynamic DeserializeByObjectType(string json, object obj)
+ public static dynamic DeserialiseByObjectType(string json, object obj)
{
/// We don't want the deserialisation to break if some properties are empty.
/// So we need to specify the behaviour when such values are encountered.
@@ -105,6 +101,7 @@ public static dynamic DeserializeByObjectType(string json, object obj)
return JsonConvert.DeserializeObject(json, type, settings);
}
+
///
/// Deserialises a JSON string into a dictionary of string keys and object values.
/// Note : Does not handle deserialisation of nested objects.
@@ -131,7 +128,7 @@ public static Dictionary DeserialiseAsDictionary(string json)
///
/// The object that will be serialised.
/// Object serialised as JSON string.
- public static string SerializeToJSON(object obj)
+ public static string SerialiseToJSON(object obj)
{
/// We don't want the serialisation to break if some properties are empty.
/// So we need to specify the behaviour when such values are encountered.
@@ -179,35 +176,5 @@ private static object ParseObject(JToken token)
}
#endregion
-
- #region Type support
-
- ///
- /// Gets only non-null properties and their values from a Type using Reflection.
- ///
- /// The object to extract type properties from.
- /// A dictionary of properties and their values.
- internal static Dictionary GetValidProperties(object obj)
- {
- var parameters = new Dictionary();
- Type type = obj.GetType();
- foreach (PropertyInfo prop in type.GetProperties())
- {
- var value = prop.GetValue(obj).ToString();
- if (!string.IsNullOrEmpty(value)) parameters.Add(prop.Name, value);
- }
- return parameters;
- }
-
- internal static dynamic WrapObject(object obj)
- {
- var wrapper = new
- {
- data = obj
- };
- var json = JsonConvert.SerializeObject(wrapper);
- return ParseObject(JToken.Parse(json));
- }
- #endregion
}
}
diff --git a/src/DynaWeb/NodeModels/WebRequestModel.cs b/src/DynaWeb/NodeModels/WebRequestModel.cs
deleted file mode 100644
index 3463638..0000000
--- a/src/DynaWeb/NodeModels/WebRequestModel.cs
+++ /dev/null
@@ -1,41 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
-using Dynamo.Graph.Nodes;
-using DynaWeb.Properties;
-using ProtoCore.AST.AssociativeAST;
-using DynaWeb;
-
-namespace CoreNodeModels.Web
-{
- /*
- [NodeName("Web Request")]
- [NodeDescription("WebRequestDescription", typeof(Resources))]
- [NodeCategory(BuiltinNodeCategories.CORE_WEB)]
- [IsDesignScriptCompatible]
- [AlsoKnownAs("DynaWebNodesUI.WebRequest")]
- public class SimpleWebRequest : NodeModel
- {
- public SimpleWebRequest()
- {
- InPortData.Add(new PortData("url", Resources.WebRequestPortDataUrlToolTip));
- OutPortData.Add(new PortData("result", Resources.WebRequestPortDataResultToolTip));
- RegisterAllPorts();
-
- CanUpdatePeriodically = true;
- }
-
- public override IEnumerable BuildOutputAst(List inputAstNodes)
- {
- var functionCall = AstFactory.BuildFunctionCall(
- new Func(WebRequest.Execute),
- inputAstNodes
- );
-
- return new[] { AstFactory.BuildAssignment(GetAstIdentifierForOutputIndex(0), functionCall) };
- }
- }
- */
-}
diff --git a/src/DynaWeb/Properties/AssemblyInfo.cs b/src/DynaWeb/Properties/AssemblyInfo.cs
index a9dada4..88c63c9 100644
--- a/src/DynaWeb/Properties/AssemblyInfo.cs
+++ b/src/DynaWeb/Properties/AssemblyInfo.cs
@@ -32,5 +32,5 @@
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
-[assembly: AssemblyVersion("1.0.3.0")]
-[assembly: AssemblyFileVersion("1.0.3.0")]
+[assembly: AssemblyVersion("1.1.0.0")]
+[assembly: AssemblyFileVersion("1.1.0.0")]
diff --git a/src/DynaWeb/Properties/Resources.Designer.cs b/src/DynaWeb/Properties/Resources.Designer.cs
index a81aed2..3b5a09f 100644
--- a/src/DynaWeb/Properties/Resources.Designer.cs
+++ b/src/DynaWeb/Properties/Resources.Designer.cs
@@ -19,7 +19,7 @@ namespace DynaWeb.Properties {
// class via a tool like ResGen or Visual Studio.
// To add or remove a member, edit your .ResX file then rerun ResGen
// with the /str option, or rebuild your VS project.
- [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")]
+ [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "15.0.0.0")]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
internal class Resources {
@@ -61,7 +61,7 @@ internal Resources() {
}
///
- /// Looks up a localized string similar to Could not build a valid Uri for the request. Please double-check the WebClient baseUrl and the WebRequest resource..
+ /// Looks up a localized string similar to Could not build a valid Uri for the request. Please double-check the WebClient baseUrl and the WebRequest resource. Inner exception : {0}.
///
internal static string WebClientBuildUrlFailed {
get {
@@ -177,6 +177,15 @@ internal static string WebRequestParameterNullMessage {
}
}
+ ///
+ /// Looks up a localized string similar to Could not parse the supplied value into a valid Parameter Type..
+ ///
+ internal static string WebRequestParameterValueInvalid {
+ get {
+ return ResourceManager.GetString("WebRequestParameterValueInvalid", resourceCulture);
+ }
+ }
+
///
/// Looks up a localized string similar to .
///
@@ -240,6 +249,15 @@ internal static string WebUrlInvalidMessage {
}
}
+ ///
+ /// Looks up a localized string similar to URI is file or is UNC pointing to internal network.
+ ///
+ internal static string WebUrlIsLocal {
+ get {
+ return ResourceManager.GetString("WebUrlIsLocal", resourceCulture);
+ }
+ }
+
///
/// Looks up a localized string similar to The URL cannot be null..
///
diff --git a/src/DynaWeb/Properties/Resources.resx b/src/DynaWeb/Properties/Resources.resx
index ebb5d76..6788c54 100644
--- a/src/DynaWeb/Properties/Resources.resx
+++ b/src/DynaWeb/Properties/Resources.resx
@@ -118,7 +118,7 @@
System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
- Could not build a valid Uri for the request. Please double-check the WebClient baseUrl and the WebRequest resource.
+ Could not build a valid Uri for the request. Please double-check the WebClient baseUrl and the WebRequest resource. Inner exception : {0}
The value for MaxRedirects cannot be negative or equal to zero.
@@ -156,6 +156,9 @@
The parameter provided cannot be null.
+
+ Could not parse the supplied value into a valid Parameter Type.
+
@@ -177,6 +180,9 @@
The URL provided is not a valid URL.
+
+ URI is file or is UNC pointing to internal network
+
The URL cannot be null.
diff --git a/src/DynaWeb/app.config b/src/DynaWeb/app.config
index 4fc378d..107fc28 100644
--- a/src/DynaWeb/app.config
+++ b/src/DynaWeb/app.config
@@ -6,6 +6,10 @@
+
+
+
+
\ No newline at end of file
diff --git a/src/DynaWeb/packages.config b/src/DynaWeb/packages.config
index eaebdf9..2f35e8c 100644
--- a/src/DynaWeb/packages.config
+++ b/src/DynaWeb/packages.config
@@ -1,16 +1,16 @@
-
-
-
-
-
-
-
+
+
+
+
+
+
+
-
+
\ No newline at end of file
diff --git a/test/DynaWeb.Core.Tests/Class1.cs b/test/DynaWeb.Core.Tests/Class1.cs
deleted file mode 100644
index 4dd88a6..0000000
--- a/test/DynaWeb.Core.Tests/Class1.cs
+++ /dev/null
@@ -1,12 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
-
-namespace DynaWeb.Core.Tests
-{
- public class Class1
- {
- }
-}
diff --git a/test/DynaWeb.Core.Tests/DynaWeb.Core.Tests.csproj b/test/DynaWeb.Core.Tests/DynaWeb.Core.Tests.csproj
deleted file mode 100644
index 0bf7a22..0000000
--- a/test/DynaWeb.Core.Tests/DynaWeb.Core.Tests.csproj
+++ /dev/null
@@ -1,56 +0,0 @@
-
-
-
-
- Debug
- AnyCPU
- {50A649C6-FB32-4C6D-A7B6-6EB99DE8547D}
- Library
- Properties
- DynWWW.Core.Tests
- DynWWW.Core.Tests
- v4.5.2
- 512
-
-
- true
- full
- false
- bin\Debug\
- DEBUG;TRACE
- prompt
- 4
-
-
- pdbonly
- true
- bin\Release\
- TRACE
- prompt
- 4
-
-
-
- ..\..\src\packages\Newtonsoft.Json.10.0.3\lib\net45\Newtonsoft.Json.dll
-
-
- ..\..\src\packages\RestSharp.105.2.3\lib\net452\RestSharp.dll
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/test/DynaWeb.Core.Tests/Properties/AssemblyInfo.cs b/test/DynaWeb.Core.Tests/Properties/AssemblyInfo.cs
deleted file mode 100644
index 1591b51..0000000
--- a/test/DynaWeb.Core.Tests/Properties/AssemblyInfo.cs
+++ /dev/null
@@ -1,36 +0,0 @@
-using System.Reflection;
-using System.Runtime.CompilerServices;
-using System.Runtime.InteropServices;
-
-// General Information about an assembly is controlled through the following
-// set of attributes. Change these attribute values to modify the information
-// associated with an assembly.
-[assembly: AssemblyTitle("DynaWeb.Core.Tests")]
-[assembly: AssemblyDescription("")]
-[assembly: AssemblyConfiguration("")]
-[assembly: AssemblyCompany("")]
-[assembly: AssemblyProduct("DynaWeb.Core.Tests")]
-[assembly: AssemblyCopyright("Copyright © 2017")]
-[assembly: AssemblyTrademark("")]
-[assembly: AssemblyCulture("")]
-
-// Setting ComVisible to false makes the types in this assembly not visible
-// to COM components. If you need to access a type in this assembly from
-// COM, set the ComVisible attribute to true on that type.
-[assembly: ComVisible(false)]
-
-// The following GUID is for the ID of the typelib if this project is exposed to COM
-[assembly: Guid("50a649c6-fb32-4c6d-a7b6-6eb99de8547d")]
-
-// Version information for an assembly consists of the following four values:
-//
-// Major Version
-// Minor Version
-// Build Number
-// Revision
-//
-// You can specify all the values or you can default the Build and Revision Numbers
-// by using the '*' as shown below:
-// [assembly: AssemblyVersion("1.0.*")]
-[assembly: AssemblyVersion("1.0.0.0")]
-[assembly: AssemblyFileVersion("1.0.0.0")]
diff --git a/test/DynaWeb.Core.Tests/packages.config b/test/DynaWeb.Core.Tests/packages.config
deleted file mode 100644
index d186dc1..0000000
--- a/test/DynaWeb.Core.Tests/packages.config
+++ /dev/null
@@ -1,5 +0,0 @@
-
-
-
-
-
\ No newline at end of file
diff --git a/test/DynaWeb.Tests/Classes/ExecuteTests.cs b/test/DynaWeb.Tests/Classes/ExecuteTests.cs
new file mode 100644
index 0000000..c5155c5
--- /dev/null
+++ b/test/DynaWeb.Tests/Classes/ExecuteTests.cs
@@ -0,0 +1,68 @@
+using NUnit.Framework;
+using DynaWeb;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace DynaWeb.Tests
+{
+ [TestFixture]
+ public static class ExecuteTests
+ {
+ [Test]
+ public static void ByClientRequestMethod_Test()
+ {
+ Assert.Fail();
+ }
+
+ [Test]
+ public static void GET_Test()
+ {
+ Assert.Fail();
+ }
+
+ [Test]
+ public static void POST_Test()
+ {
+ Assert.Fail();
+ }
+
+ [Test]
+ public static void PUT_Test()
+ {
+ Assert.Fail();
+ }
+
+ [Test]
+ public static void DELETE_Test()
+ {
+ Assert.Fail();
+ }
+
+ [Test]
+ public static void HEAD_Test()
+ {
+ Assert.Fail();
+ }
+
+ [Test]
+ public static void MERGE_Test()
+ {
+ Assert.Fail();
+ }
+
+ [Test]
+ public static void OPTIONS_Test()
+ {
+ Assert.Fail();
+ }
+
+ [Test]
+ public static void PATCH_Test()
+ {
+ Assert.Fail();
+ }
+ }
+}
\ No newline at end of file
diff --git a/test/DynaWeb.Tests/Classes/WebClientTests.cs b/test/DynaWeb.Tests/Classes/WebClientTests.cs
new file mode 100644
index 0000000..2ff2807
--- /dev/null
+++ b/test/DynaWeb.Tests/Classes/WebClientTests.cs
@@ -0,0 +1,74 @@
+using NUnit.Framework;
+using DynaWeb;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace DynaWeb.Tests
+{
+ [TestFixture]
+ public static class WebClientTests
+ {
+ [Test]
+ public static void ByUrlTest()
+ {
+ Assert.Fail();
+ }
+
+ [Test]
+ public static void ByUrlTokenTest()
+ {
+ Assert.Fail();
+ }
+
+ [Test]
+ public static void ExecuteTest()
+ {
+ Assert.Fail();
+ }
+
+ [Test]
+ public static void BuildUriTest()
+ {
+ Assert.Fail();
+ }
+
+ [Test]
+ public static void SetBaseURLTest()
+ {
+ Assert.Fail();
+ }
+
+ [Test]
+ public static void SetUserAgentTest()
+ {
+ Assert.Fail();
+ }
+
+ [Test]
+ public static void SetTimeoutTest()
+ {
+ Assert.Fail();
+ }
+
+ [Test]
+ public static void SetFollowRedirectsTest()
+ {
+ Assert.Fail();
+ }
+
+ [Test]
+ public static void SetMaxRedirectsTest()
+ {
+ Assert.Fail();
+ }
+
+ [Test]
+ public static void SetJsonTokenOverrideTest()
+ {
+ Assert.Fail();
+ }
+ }
+}
\ No newline at end of file
diff --git a/test/DynaWeb.Tests/Classes/WebRequestTests.cs b/test/DynaWeb.Tests/Classes/WebRequestTests.cs
new file mode 100644
index 0000000..62c5da4
--- /dev/null
+++ b/test/DynaWeb.Tests/Classes/WebRequestTests.cs
@@ -0,0 +1,128 @@
+using NUnit.Framework;
+using DynaWeb;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace DynaWeb.Tests
+{
+ [TestFixture]
+ public static class WebRequestTests
+ {
+ [Test]
+ public static void ByUrlTest()
+ {
+ Assert.Fail();
+ }
+
+ [Test]
+ public static void ByEndpointTest()
+ {
+ Assert.Fail();
+ }
+
+ [Test]
+ public static void ExecuteTest()
+ {
+ Assert.Fail();
+ }
+
+ [Test]
+ public static void SetMethodTest()
+ {
+ Assert.Fail();
+ }
+
+ [Test]
+ public static void SetRequestFormatTest()
+ {
+ Assert.Fail();
+ }
+
+ [Test]
+ public static void SetUrlTest()
+ {
+ Assert.Fail();
+ }
+
+ [Test]
+ public static void SetResourceTest()
+ {
+ Assert.Fail();
+ }
+
+ [Test]
+ public static void SetSecurityProtocolTest()
+ {
+ Assert.Fail();
+ }
+
+ [Test]
+ public static void AddFileTest()
+ {
+ Assert.Fail();
+ }
+
+ [Test]
+ public static void AddFileAsBytesTest()
+ {
+ Assert.Fail();
+ }
+
+ [Test]
+ public static void AddBodyTest()
+ {
+ Assert.Fail();
+ }
+
+ [Test]
+ public static void AddJsonBodyTest()
+ {
+ Assert.Fail();
+ }
+
+ [Test]
+ public static void AddXmlBodyTest()
+ {
+ Assert.Fail();
+ }
+
+ [Test]
+ public static void AddObjectTest()
+ {
+ Assert.Fail();
+ }
+
+ [Test]
+ public static void AddParameterTest()
+ {
+ Assert.Fail();
+ }
+
+ [Test]
+ public static void AddHeaderTest()
+ {
+ Assert.Fail();
+ }
+
+ [Test]
+ public static void AddCookieTest()
+ {
+ Assert.Fail();
+ }
+
+ [Test]
+ public static void AddUrlSegmentTest()
+ {
+ Assert.Fail();
+ }
+
+ [Test]
+ public static void AddQueryParameterTest()
+ {
+ Assert.Fail();
+ }
+ }
+}
\ No newline at end of file
diff --git a/test/DynaWeb.Tests/Classes/WebResponseTests.cs b/test/DynaWeb.Tests/Classes/WebResponseTests.cs
new file mode 100644
index 0000000..4473d97
--- /dev/null
+++ b/test/DynaWeb.Tests/Classes/WebResponseTests.cs
@@ -0,0 +1,20 @@
+using NUnit.Framework;
+using DynaWeb;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace DynaWeb.Tests
+{
+ [TestFixture]
+ public static class WebResponseTests
+ {
+ [Test]
+ public static void WebResponseTest()
+ {
+ Assert.Fail();
+ }
+ }
+}
\ No newline at end of file
diff --git a/test/DynaWeb.Tests/DynaWeb.Tests.csproj b/test/DynaWeb.Tests/DynaWeb.Tests.csproj
new file mode 100644
index 0000000..f6139b6
--- /dev/null
+++ b/test/DynaWeb.Tests/DynaWeb.Tests.csproj
@@ -0,0 +1,113 @@
+
+
+
+
+ Debug
+ AnyCPU
+ {86015C9C-DEBA-4C2E-B9EF-872C88ED7D6C}
+ Library
+ Properties
+ DynaWeb.Tests
+ DynaWeb.Tests
+ v4.5.2
+ 512
+ {3AC096D0-A1C2-E12C-1390-A8335801FDAB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}
+ 10.0
+ $(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)
+ $(ProgramFiles)\Common Files\microsoft shared\VSTT\$(VisualStudioVersion)\UITestExtensionPackages
+ False
+ UnitTest
+
+
+
+
+
+ true
+ full
+ false
+ bin\Debug\
+ DEBUG;TRACE
+ prompt
+ 4
+
+
+ pdbonly
+ true
+ bin\Release\
+ TRACE
+ prompt
+ 4
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ {CE19C882-1AAC-434C-99AF-4A285DA053BA}
+ DynaWeb
+
+
+
+
+
+
+
+
+ ..\..\src\packages\Newtonsoft.Json.11.0.2\lib\net45\Newtonsoft.Json.dll
+ True
+
+
+ ..\..\src\packages\NUnit.3.10.1\lib\net45\nunit.framework.dll
+ True
+
+
+ ..\..\..\..\..\..\..\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.5.2\System.dll
+
+
+
+
+
+
+ False
+
+
+ False
+
+
+ False
+
+
+ False
+
+
+
+
+
+
+
+
+ This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}.
+
+
+
+
+
\ No newline at end of file
diff --git a/test/DynaWeb.Tests/Helpers/HelpersTests.cs b/test/DynaWeb.Tests/Helpers/HelpersTests.cs
new file mode 100644
index 0000000..4951a40
--- /dev/null
+++ b/test/DynaWeb.Tests/Helpers/HelpersTests.cs
@@ -0,0 +1,62 @@
+using NUnit.Framework;
+using DynaWeb;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace DynaWeb.Tests
+{
+ [TestFixture]
+ public static class HelpersTests
+ {
+ [Test]
+ public static void ParseUriFromStringTest()
+ {
+ Assert.Fail();
+ }
+
+ [Test]
+ public static void CheckURITest()
+ {
+ Assert.Fail();
+ }
+
+ [Test]
+ public static void DeserialiseTest()
+ {
+ Assert.Fail();
+ }
+
+ [Test]
+ public static void DeserializeAsObjectTest()
+ {
+ Assert.Fail();
+ }
+
+ [Test]
+ public static void DeserializeByObjectTypeTest()
+ {
+ Assert.Fail();
+ }
+
+ [Test]
+ public static void DeserialiseAsDictionaryTest()
+ {
+ Assert.Fail();
+ }
+
+ [Test]
+ public static void SerializeToJSONTest()
+ {
+ Assert.Fail();
+ }
+
+ [Test]
+ public static void SelectJsonRootTest()
+ {
+ Assert.Fail();
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/DebugApp/Properties/AssemblyInfo.cs b/test/DynaWeb.Tests/Properties/AssemblyInfo.cs
similarity index 79%
rename from src/DebugApp/Properties/AssemblyInfo.cs
rename to test/DynaWeb.Tests/Properties/AssemblyInfo.cs
index 41dfbc1..90c3dd8 100644
--- a/src/DebugApp/Properties/AssemblyInfo.cs
+++ b/test/DynaWeb.Tests/Properties/AssemblyInfo.cs
@@ -2,34 +2,34 @@
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
-// General Information about an assembly is controlled through the following
+// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
-[assembly: AssemblyTitle("DebugApp")]
+[assembly: AssemblyTitle("DynaWeb.Tests1")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
-[assembly: AssemblyProduct("DebugApp")]
-[assembly: AssemblyCopyright("Copyright © 2017")]
+[assembly: AssemblyProduct("DynaWeb.Tests1")]
+[assembly: AssemblyCopyright("Copyright © 2018")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
-// Setting ComVisible to false makes the types in this assembly not visible
-// to COM components. If you need to access a type in this assembly from
+// Setting ComVisible to false makes the types in this assembly not visible
+// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
// The following GUID is for the ID of the typelib if this project is exposed to COM
-[assembly: Guid("f2d82a82-100b-4594-b50f-7c7c815c4370")]
+[assembly: Guid("86015c9c-deba-4c2e-b9ef-872c88ed7d6c")]
// Version information for an assembly consists of the following four values:
//
// Major Version
-// Minor Version
+// Minor Version
// Build Number
// Revision
//
-// You can specify all the values or you can default the Build and Revision Numbers
+// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")]
diff --git a/test/DynaWeb.Tests/app.config b/test/DynaWeb.Tests/app.config
new file mode 100644
index 0000000..2bbe771
--- /dev/null
+++ b/test/DynaWeb.Tests/app.config
@@ -0,0 +1,11 @@
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/test/DynaWeb.Tests/packages.config b/test/DynaWeb.Tests/packages.config
new file mode 100644
index 0000000..6e75f8f
--- /dev/null
+++ b/test/DynaWeb.Tests/packages.config
@@ -0,0 +1,5 @@
+
+
+
+
+
\ No newline at end of file