diff --git a/pipedrive.ruleset b/pipedrive.ruleset
new file mode 100644
index 00000000..66590f96
--- /dev/null
+++ b/pipedrive.ruleset
@@ -0,0 +1,33 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/src/Pipedrive.net.Tests.Integration/Clients/ActivitiesClientTests.cs b/src/Pipedrive.net.Tests.Integration/Clients/ActivitiesClientTests.cs
index 7956eaf2..dc33cea7 100644
--- a/src/Pipedrive.net.Tests.Integration/Clients/ActivitiesClientTests.cs
+++ b/src/Pipedrive.net.Tests.Integration/Clients/ActivitiesClientTests.cs
@@ -127,7 +127,7 @@ public async Task CanDelete()
await fixture.Delete(createdActivity.Id);
- var deletedActivity = await fixture.Get(createdActivity.Id);
+ var deletedActivity = await fixture.Get(createdActivity.Id);
Assert.False(deletedActivity.ActiveFlag);
}
diff --git a/src/Pipedrive.net.Tests.Integration/Clients/DealsClientTests.cs b/src/Pipedrive.net.Tests.Integration/Clients/DealsClientTests.cs
index cd764c30..12e0cab5 100644
--- a/src/Pipedrive.net.Tests.Integration/Clients/DealsClientTests.cs
+++ b/src/Pipedrive.net.Tests.Integration/Clients/DealsClientTests.cs
@@ -1,6 +1,6 @@
-using Pipedrive.CustomFields;
-using System;
+using System;
using System.Threading.Tasks;
+using Pipedrive.CustomFields;
using Xunit;
namespace Pipedrive.Tests.Integration.Clients
diff --git a/src/Pipedrive.net.Tests.Integration/Helper.cs b/src/Pipedrive.net.Tests.Integration/Helper.cs
index aad59a6f..22d77623 100644
--- a/src/Pipedrive.net.Tests.Integration/Helper.cs
+++ b/src/Pipedrive.net.Tests.Integration/Helper.cs
@@ -6,9 +6,15 @@ namespace Pipedrive.Tests.Integration
{
public static class Helper
{
- public static Uri ApiUrl { get { return _apiUrl.Value; } }
+ public static Uri ApiUrl
+ {
+ get { return _apiUrl.Value; }
+ }
- public static string ApiToken { get { return Environment.GetEnvironmentVariable("PIPEDRIVE_APITOKEN"); } }
+ public static string ApiToken
+ {
+ get { return Environment.GetEnvironmentVariable("PIPEDRIVE_APITOKEN"); }
+ }
static readonly Lazy _apiUrl = new Lazy(() =>
{
@@ -39,6 +45,7 @@ public static Stream LoadFixture(string fileName)
throw new InvalidOperationException(
"The file '" + fileName + "' was not found as an embedded resource in the assembly. Failing the test...");
}
+
return stream;
}
}
diff --git a/src/Pipedrive.net.Tests.Integration/Helpers/IntegrationTestAttribute.cs b/src/Pipedrive.net.Tests.Integration/Helpers/IntegrationTestAttribute.cs
index d7db1878..aafbbe62 100644
--- a/src/Pipedrive.net.Tests.Integration/Helpers/IntegrationTestAttribute.cs
+++ b/src/Pipedrive.net.Tests.Integration/Helpers/IntegrationTestAttribute.cs
@@ -1,25 +1,8 @@
-using System.Collections.Generic;
-using Xunit;
-using Xunit.Abstractions;
+using Xunit;
using Xunit.Sdk;
namespace Pipedrive.Tests.Integration
{
- public class IntegrationTestDiscoverer : IXunitTestCaseDiscoverer
- {
- readonly IMessageSink diagnosticMessageSink;
-
- public IntegrationTestDiscoverer(IMessageSink diagnosticMessageSink)
- {
- this.diagnosticMessageSink = diagnosticMessageSink;
- }
-
- public IEnumerable Discover(ITestFrameworkDiscoveryOptions discoveryOptions, ITestMethod testMethod, IAttributeInfo factAttribute)
- {
- return new[] { new XunitTestCase(diagnosticMessageSink, discoveryOptions.MethodDisplayOrDefault(), discoveryOptions.MethodDisplayOptionsOrDefault(), testMethod) };
- }
- }
-
[XunitTestCaseDiscoverer("Pipedrive.Tests.Integration.IntegrationTestDiscoverer", "Pipedrive.Tests.Integration")]
public class IntegrationTestAttribute : FactAttribute
{
diff --git a/src/Pipedrive.net.Tests.Integration/Helpers/IntegrationTestDiscoverer.cs b/src/Pipedrive.net.Tests.Integration/Helpers/IntegrationTestDiscoverer.cs
new file mode 100644
index 00000000..34263f92
--- /dev/null
+++ b/src/Pipedrive.net.Tests.Integration/Helpers/IntegrationTestDiscoverer.cs
@@ -0,0 +1,21 @@
+using System.Collections.Generic;
+using Xunit.Abstractions;
+using Xunit.Sdk;
+
+namespace Pipedrive.Tests.Integration
+{
+ public class IntegrationTestDiscoverer : IXunitTestCaseDiscoverer
+ {
+ readonly IMessageSink diagnosticMessageSink;
+
+ public IntegrationTestDiscoverer(IMessageSink diagnosticMessageSink)
+ {
+ this.diagnosticMessageSink = diagnosticMessageSink;
+ }
+
+ public IEnumerable Discover(ITestFrameworkDiscoveryOptions discoveryOptions, ITestMethod testMethod, IAttributeInfo factAttribute)
+ {
+ return new[] { new XunitTestCase(diagnosticMessageSink, discoveryOptions.MethodDisplayOrDefault(), discoveryOptions.MethodDisplayOptionsOrDefault(), testMethod) };
+ }
+ }
+}
diff --git a/src/Pipedrive.net.Tests.Integration/Pipedrive.Tests.Integration.csproj b/src/Pipedrive.net.Tests.Integration/Pipedrive.Tests.Integration.csproj
index 07ed3479..505fda3a 100644
--- a/src/Pipedrive.net.Tests.Integration/Pipedrive.Tests.Integration.csproj
+++ b/src/Pipedrive.net.Tests.Integration/Pipedrive.Tests.Integration.csproj
@@ -30,6 +30,10 @@
+
+ all
+ runtime; build; native; contentfiles; analyzers; buildtransitive
+
all
@@ -44,4 +48,11 @@
+
+ ..\..\pipedrive.ruleset
+
+
+
+
+
diff --git a/src/Pipedrive.net.Tests/Clients/ActivitiesClientTests.cs b/src/Pipedrive.net.Tests/Clients/ActivitiesClientTests.cs
index bcbc9146..bd1d58aa 100644
--- a/src/Pipedrive.net.Tests/Clients/ActivitiesClientTests.cs
+++ b/src/Pipedrive.net.Tests/Clients/ActivitiesClientTests.cs
@@ -1,7 +1,7 @@
-using NSubstitute;
-using System;
+using System;
using System.Collections.Generic;
using System.Threading.Tasks;
+using NSubstitute;
using Xunit;
namespace Pipedrive.Tests.Clients
@@ -52,8 +52,7 @@ await connection.GetAll(
&& d["done"] == "1"),
Arg.Is(o => o.PageSize == 1
&& o.PageCount == 1
- && o.StartPage == 0)
- );
+ && o.StartPage == 0));
});
}
}
@@ -88,12 +87,11 @@ public async Task RequestsCorrectUrl()
{
await connection.GetAll(
Arg.Is(u => u.ToString() == "activities"),
- Arg.Is>(d => d.Count == 1
+ Arg.Is>(d => d.Count == 1
&& d["done"] == "1"),
Arg.Is(o => o.PageSize == 1
&& o.PageCount == 1
- && o.StartPage == 0)
- );
+ && o.StartPage == 0));
});
}
}
@@ -133,8 +131,7 @@ await connection.GetAll(
&& d["done"] == "1"),
Arg.Is(o => o.PageSize == 1
&& o.PageCount == 1
- && o.StartPage == 0)
- );
+ && o.StartPage == 0));
});
}
}
diff --git a/src/Pipedrive.net.Tests/Clients/ActivityFieldsClientTests.cs b/src/Pipedrive.net.Tests/Clients/ActivityFieldsClientTests.cs
index 9b78a65a..bbf978f6 100644
--- a/src/Pipedrive.net.Tests/Clients/ActivityFieldsClientTests.cs
+++ b/src/Pipedrive.net.Tests/Clients/ActivityFieldsClientTests.cs
@@ -1,6 +1,6 @@
-using NSubstitute;
-using System;
+using System;
using System.Threading.Tasks;
+using NSubstitute;
using Xunit;
namespace Pipedrive.Tests.Clients
diff --git a/src/Pipedrive.net.Tests/Clients/ActivityTypesClientTests.cs b/src/Pipedrive.net.Tests/Clients/ActivityTypesClientTests.cs
index 1850db49..75d82b1c 100644
--- a/src/Pipedrive.net.Tests/Clients/ActivityTypesClientTests.cs
+++ b/src/Pipedrive.net.Tests/Clients/ActivityTypesClientTests.cs
@@ -1,6 +1,6 @@
-using NSubstitute;
-using System;
+using System;
using System.Threading.Tasks;
+using NSubstitute;
using Xunit;
namespace Pipedrive.Tests.Clients
diff --git a/src/Pipedrive.net.Tests/Clients/CurrenciesClientTests.cs b/src/Pipedrive.net.Tests/Clients/CurrenciesClientTests.cs
index 6270897b..15d50848 100644
--- a/src/Pipedrive.net.Tests/Clients/CurrenciesClientTests.cs
+++ b/src/Pipedrive.net.Tests/Clients/CurrenciesClientTests.cs
@@ -1,7 +1,7 @@
-using NSubstitute;
-using System;
+using System;
using System.Collections.Generic;
using System.Threading.Tasks;
+using NSubstitute;
using Xunit;
namespace Pipedrive.Tests.Clients
@@ -27,7 +27,7 @@ public async Task RequestsCorrectUrl()
await client.GetAll();
- Received.InOrder(async() =>
+ Received.InOrder(async () =>
{
await connection.GetAll(Arg.Is(u => u.ToString() == "currencies"));
});
diff --git a/src/Pipedrive.net.Tests/Clients/DealFieldsClientTests.cs b/src/Pipedrive.net.Tests/Clients/DealFieldsClientTests.cs
index e5f66ebc..2bd2bece 100644
--- a/src/Pipedrive.net.Tests/Clients/DealFieldsClientTests.cs
+++ b/src/Pipedrive.net.Tests/Clients/DealFieldsClientTests.cs
@@ -1,6 +1,6 @@
-using NSubstitute;
-using System;
+using System;
using System.Threading.Tasks;
+using NSubstitute;
using Xunit;
namespace Pipedrive.Tests.Clients
diff --git a/src/Pipedrive.net.Tests/Clients/DealsClientTests.cs b/src/Pipedrive.net.Tests/Clients/DealsClientTests.cs
index ad22b6a4..deb112ee 100644
--- a/src/Pipedrive.net.Tests/Clients/DealsClientTests.cs
+++ b/src/Pipedrive.net.Tests/Clients/DealsClientTests.cs
@@ -1,11 +1,10 @@
-using NSubstitute;
-using Pipedrive.CustomFields;
-using Pipedrive.Models.Response;
-using System;
+using System;
using System.Collections.Generic;
using System.Threading.Tasks;
+using NSubstitute;
+using Pipedrive.CustomFields;
+using Pipedrive.Models.Response;
using Xunit;
-using static Pipedrive.DealsClient;
namespace Pipedrive.Tests.Clients
{
@@ -55,8 +54,7 @@ await connection.GetAll(
&& d["status"] == "lost"),
Arg.Is(o => o.PageSize == 1
&& o.PageCount == 1
- && o.StartPage == 0)
- );
+ && o.StartPage == 0));
});
}
}
@@ -96,8 +94,7 @@ await connection.GetAll(
&& d["status"] == "lost"),
Arg.Is(o => o.PageSize == 1
&& o.PageCount == 1
- && o.StartPage == 0)
- );
+ && o.StartPage == 0));
});
}
}
@@ -137,8 +134,7 @@ await connection.GetAll(
&& d["status"] == "lost"),
Arg.Is(o => o.PageSize == 1
&& o.PageCount == 1
- && o.StartPage == 0)
- );
+ && o.StartPage == 0));
});
}
}
@@ -277,8 +273,7 @@ await connection.GetAll(
&& d["id"] == "123"),
Arg.Is(o => o.PageSize == 1
&& o.PageCount == 1
- && o.StartPage == 0)
- );
+ && o.StartPage == 0));
});
}
}
@@ -298,8 +293,7 @@ public async Task RequestsCorrectUrl()
await connection.GetAll(
Arg.Is(u => u.ToString() == "deals/123/followers"),
Arg.Is>(d => d.Count == 1
- && d["id"] == "123")
- );
+ && d["id"] == "123"));
});
}
}
@@ -369,8 +363,7 @@ await connection.GetAll(
&& d["done"] == "1"),
Arg.Is(o => o.PageSize == 1
&& o.PageCount == 1
- && o.StartPage == 0)
- );
+ && o.StartPage == 0));
});
}
}
@@ -408,8 +401,7 @@ await connection.GetAll(
&& d["id"] == "123"),
Arg.Is(o => o.PageSize == 1
&& o.PageCount == 1
- && o.StartPage == 0)
- );
+ && o.StartPage == 0));
});
}
}
diff --git a/src/Pipedrive.net.Tests/Clients/FilesClientTests.cs b/src/Pipedrive.net.Tests/Clients/FilesClientTests.cs
index a903e3cd..9aeabd85 100644
--- a/src/Pipedrive.net.Tests/Clients/FilesClientTests.cs
+++ b/src/Pipedrive.net.Tests/Clients/FilesClientTests.cs
@@ -1,7 +1,7 @@
-using NSubstitute;
-using System;
+using System;
using System.Collections.Generic;
using System.Threading.Tasks;
+using NSubstitute;
using Xunit;
namespace Pipedrive.Tests.Clients
@@ -49,8 +49,7 @@ await connection.GetAll(
Arg.Is>(d => d.Count == 0),
Arg.Is(o => o.PageSize == 1
&& o.PageCount == 1
- && o.StartPage == 0)
- );
+ && o.StartPage == 0));
});
}
}
diff --git a/src/Pipedrive.net.Tests/Clients/NotesClientTests.cs b/src/Pipedrive.net.Tests/Clients/NotesClientTests.cs
index 320e85be..428c4ec7 100644
--- a/src/Pipedrive.net.Tests/Clients/NotesClientTests.cs
+++ b/src/Pipedrive.net.Tests/Clients/NotesClientTests.cs
@@ -1,7 +1,7 @@
-using NSubstitute;
-using System;
+using System;
using System.Collections.Generic;
using System.Threading.Tasks;
+using NSubstitute;
using Xunit;
namespace Pipedrive.Tests.Clients
@@ -49,8 +49,7 @@ await connection.GetAll(
Arg.Is>(d => d.Count == 0),
Arg.Is(o => o.PageSize == 1
&& o.PageCount == 1
- && o.StartPage == 0)
- );
+ && o.StartPage == 0));
});
}
}
diff --git a/src/Pipedrive.net.Tests/Clients/OrganizationFieldsClientTests.cs b/src/Pipedrive.net.Tests/Clients/OrganizationFieldsClientTests.cs
index ffb9acfe..590cc5cf 100644
--- a/src/Pipedrive.net.Tests/Clients/OrganizationFieldsClientTests.cs
+++ b/src/Pipedrive.net.Tests/Clients/OrganizationFieldsClientTests.cs
@@ -1,6 +1,6 @@
-using NSubstitute;
-using System;
+using System;
using System.Threading.Tasks;
+using NSubstitute;
using Xunit;
namespace Pipedrive.Tests.Clients
diff --git a/src/Pipedrive.net.Tests/Clients/OrganizationsClientTests.cs b/src/Pipedrive.net.Tests/Clients/OrganizationsClientTests.cs
index d4c2a1ed..33acc6dd 100644
--- a/src/Pipedrive.net.Tests/Clients/OrganizationsClientTests.cs
+++ b/src/Pipedrive.net.Tests/Clients/OrganizationsClientTests.cs
@@ -1,7 +1,7 @@
-using NSubstitute;
-using System;
+using System;
using System.Collections.Generic;
using System.Threading.Tasks;
+using NSubstitute;
using Xunit;
namespace Pipedrive.Tests.Clients
@@ -49,8 +49,7 @@ await connection.GetAll(
Arg.Is>(d => d.Count == 0),
Arg.Is(o => o.PageSize == 1
&& o.PageCount == 1
- && o.StartPage == 0)
- );
+ && o.StartPage == 0));
});
}
}
@@ -88,8 +87,7 @@ await connection.GetAll(
&& d["user_id"] == "123"),
Arg.Is(o => o.PageSize == 1
&& o.PageCount == 1
- && o.StartPage == 0)
- );
+ && o.StartPage == 0));
});
}
}
@@ -225,8 +223,7 @@ await connection.GetAll(
&& d["id"] == "123"),
Arg.Is(o => o.PageSize == 1
&& o.PageCount == 1
- && o.StartPage == 0)
- );
+ && o.StartPage == 0));
});
}
}
diff --git a/src/Pipedrive.net.Tests/Clients/PersonFieldsClientTests.cs b/src/Pipedrive.net.Tests/Clients/PersonFieldsClientTests.cs
index 889b162f..771a93a9 100644
--- a/src/Pipedrive.net.Tests/Clients/PersonFieldsClientTests.cs
+++ b/src/Pipedrive.net.Tests/Clients/PersonFieldsClientTests.cs
@@ -1,6 +1,6 @@
-using NSubstitute;
-using System;
+using System;
using System.Threading.Tasks;
+using NSubstitute;
using Xunit;
namespace Pipedrive.Tests.Clients
diff --git a/src/Pipedrive.net.Tests/Clients/PersonsClientTests.cs b/src/Pipedrive.net.Tests/Clients/PersonsClientTests.cs
index 29831ffc..de2af050 100644
--- a/src/Pipedrive.net.Tests/Clients/PersonsClientTests.cs
+++ b/src/Pipedrive.net.Tests/Clients/PersonsClientTests.cs
@@ -1,7 +1,7 @@
-using NSubstitute;
-using System;
+using System;
using System.Collections.Generic;
using System.Threading.Tasks;
+using NSubstitute;
using Xunit;
namespace Pipedrive.Tests.Clients
@@ -49,8 +49,7 @@ await connection.GetAll(
Arg.Is>(d => d.Count == 0),
Arg.Is(o => o.PageSize == 1
&& o.PageCount == 1
- && o.StartPage == 0)
- );
+ && o.StartPage == 0));
});
}
}
@@ -88,8 +87,7 @@ await connection.GetAll(
&& d["user_id"] == "123"),
Arg.Is(o => o.PageSize == 1
&& o.PageCount == 1
- && o.StartPage == 0)
- );
+ && o.StartPage == 0));
});
}
}
@@ -246,8 +244,7 @@ await connection.GetAll(
&& d["id"] == "123"),
Arg.Is(o => o.PageSize == 1
&& o.PageCount == 1
- && o.StartPage == 0)
- );
+ && o.StartPage == 0));
});
}
}
diff --git a/src/Pipedrive.net.Tests/Clients/PipelinesClientTests.cs b/src/Pipedrive.net.Tests/Clients/PipelinesClientTests.cs
index ba22d829..3f3cb633 100644
--- a/src/Pipedrive.net.Tests/Clients/PipelinesClientTests.cs
+++ b/src/Pipedrive.net.Tests/Clients/PipelinesClientTests.cs
@@ -1,7 +1,7 @@
-using NSubstitute;
-using System;
+using System;
using System.Collections.Generic;
using System.Threading.Tasks;
+using NSubstitute;
using Xunit;
namespace Pipedrive.Tests.Clients
@@ -147,8 +147,7 @@ await connection.GetAll(
&& d["id"] == "123"),
Arg.Is(o => o.PageSize == 1
&& o.PageCount == 1
- && o.StartPage == 0)
- );
+ && o.StartPage == 0));
});
}
}
diff --git a/src/Pipedrive.net.Tests/Clients/StagesClientTests.cs b/src/Pipedrive.net.Tests/Clients/StagesClientTests.cs
index 11dee740..5bc106ed 100644
--- a/src/Pipedrive.net.Tests/Clients/StagesClientTests.cs
+++ b/src/Pipedrive.net.Tests/Clients/StagesClientTests.cs
@@ -1,7 +1,7 @@
-using NSubstitute;
-using System;
+using System;
using System.Collections.Generic;
using System.Threading.Tasks;
+using NSubstitute;
using Xunit;
namespace Pipedrive.Tests.Clients
@@ -168,8 +168,7 @@ await connection.GetAll(
&& d["id"] == "123"),
Arg.Is(o => o.PageSize == 1
&& o.PageCount == 1
- && o.StartPage == 0)
- );
+ && o.StartPage == 0));
});
}
}
diff --git a/src/Pipedrive.net.Tests/Clients/UsersClientTests.cs b/src/Pipedrive.net.Tests/Clients/UsersClientTests.cs
index d8cf7686..ed624535 100644
--- a/src/Pipedrive.net.Tests/Clients/UsersClientTests.cs
+++ b/src/Pipedrive.net.Tests/Clients/UsersClientTests.cs
@@ -1,7 +1,7 @@
-using NSubstitute;
-using System;
+using System;
using System.Collections.Generic;
using System.Threading.Tasks;
+using NSubstitute;
using Xunit;
namespace Pipedrive.Tests.Clients
diff --git a/src/Pipedrive.net.Tests/Exceptions/ApiErrorTests.cs b/src/Pipedrive.net.Tests/Exceptions/ApiErrorTests.cs
index 4133a011..763b06c8 100644
--- a/src/Pipedrive.net.Tests/Exceptions/ApiErrorTests.cs
+++ b/src/Pipedrive.net.Tests/Exceptions/ApiErrorTests.cs
@@ -9,6 +9,7 @@ public class ApiErrorTests
""error"": ""Validation Failed"",
""error_info"": ""Please check developers.pipedrive.com""
}";
+
[Fact]
public void CanBeDeserialized()
{
diff --git a/src/Pipedrive.net.Tests/Exceptions/ApiExceptionTests.cs b/src/Pipedrive.net.Tests/Exceptions/ApiExceptionTests.cs
index 1b950b25..0e7a15e2 100644
--- a/src/Pipedrive.net.Tests/Exceptions/ApiExceptionTests.cs
+++ b/src/Pipedrive.net.Tests/Exceptions/ApiExceptionTests.cs
@@ -47,8 +47,7 @@ public void CreatesGitHubErrorFromJsonResponse()
@"{""errors"":[{""code"":""custom"",""field"":""key"",""message"":""key is " +
@"already in use"",""resource"":""PublicKey""}],""error"":""Validation Failed""}",
new Dictionary(),
- "application/json"
- );
+ "application/json");
var exception = new ApiException(response);
@@ -103,8 +102,7 @@ public void ContainsResponseBody()
HttpStatusCode.GatewayTimeout,
responseBody,
new Dictionary(),
- "application/json"
- );
+ "application/json");
var exception = new ApiException(response);
var stringRepresentation = exception.ToString();
@@ -118,8 +116,7 @@ public void DoesNotThrowIfBodyIsNotDefined()
HttpStatusCode.GatewayTimeout,
null,
new Dictionary(),
- "application/json"
- );
+ "application/json");
var exception = new ApiException(response);
var stringRepresentation = exception.ToString();
@@ -134,8 +131,7 @@ public void DoesNotPrintImageContent()
HttpStatusCode.GatewayTimeout,
responceBody,
new Dictionary(),
- "image/*"
- );
+ "image/*");
var exception = new ApiException(response);
var stringRepresentation = exception.ToString();
@@ -150,8 +146,7 @@ public void DoesNotPrintNonStringContent()
HttpStatusCode.GatewayTimeout,
responceBody,
new Dictionary(),
- "application/json"
- );
+ "application/json");
var exception = new ApiException(response);
var stringRepresentation = exception.ToString();
diff --git a/src/Pipedrive.net.Tests/Exceptions/ApiValidationExceptionTests.cs b/src/Pipedrive.net.Tests/Exceptions/ApiValidationExceptionTests.cs
index 6abe46a4..e53856ac 100644
--- a/src/Pipedrive.net.Tests/Exceptions/ApiValidationExceptionTests.cs
+++ b/src/Pipedrive.net.Tests/Exceptions/ApiValidationExceptionTests.cs
@@ -18,8 +18,7 @@ public void CreatesGitHubErrorFromJsonResponse()
@"{""errors"":[{""code"":""custom"",""field"":""key"",""message"":""key is " +
@"already in use"",""resource"":""PublicKey""}],""error"":""Validation Failed""}",
new Dictionary(),
- "application/json"
- );
+ "application/json");
var exception = new ApiValidationException(response);
diff --git a/src/Pipedrive.net.Tests/Exceptions/LoginAttemptsExceededExceptionTests.cs b/src/Pipedrive.net.Tests/Exceptions/LoginAttemptsExceededExceptionTests.cs
index a0687f59..5524484e 100644
--- a/src/Pipedrive.net.Tests/Exceptions/LoginAttemptsExceededExceptionTests.cs
+++ b/src/Pipedrive.net.Tests/Exceptions/LoginAttemptsExceededExceptionTests.cs
@@ -1,6 +1,6 @@
-using Pipedrive.Internal;
-using System.Collections.Generic;
+using System.Collections.Generic;
using System.Net;
+using Pipedrive.Internal;
using Xunit;
namespace Pipedrive.Tests.Exceptions
diff --git a/src/Pipedrive.net.Tests/Exceptions/RateLimitExceededExceptionTests.cs b/src/Pipedrive.net.Tests/Exceptions/RateLimitExceededExceptionTests.cs
index 2b581420..8d8e49fb 100644
--- a/src/Pipedrive.net.Tests/Exceptions/RateLimitExceededExceptionTests.cs
+++ b/src/Pipedrive.net.Tests/Exceptions/RateLimitExceededExceptionTests.cs
@@ -1,8 +1,8 @@
-using Pipedrive.Internal;
-using System;
+using System;
using System.Collections.Generic;
using System.Globalization;
using System.Net;
+using Pipedrive.Internal;
using Xunit;
namespace Pipedrive.Tests.Exceptions
@@ -16,9 +16,9 @@ public void ParsesRateLimitsFromHeaders()
{
var headers = new Dictionary
{
- {"X-RateLimit-Limit", "100"},
- {"X-RateLimit-Remaining", "42"},
- {"X-RateLimit-Reset", "1372700873"}
+ { "X-RateLimit-Limit", "100" },
+ { "X-RateLimit-Remaining", "42" },
+ { "X-RateLimit-Reset", "1372700873" }
};
var response = new Response(HttpStatusCode.Forbidden, null, headers, "application/json");
@@ -40,9 +40,9 @@ public void HandlesInvalidHeaderValues()
{
var headers = new Dictionary
{
- {"X-RateLimit-Limit", "XXX"},
- {"X-RateLimit-Remaining", "XXXX"},
- {"X-RateLimit-Reset", "XXXX"}
+ { "X-RateLimit-Limit", "XXX" },
+ { "X-RateLimit-Remaining", "XXXX" },
+ { "X-RateLimit-Reset", "XXXX" }
};
var response = new Response(HttpStatusCode.Forbidden, null, headers, "application/json");
diff --git a/src/Pipedrive.net.Tests/Helpers/UnixTimestampExtensionsTests.cs b/src/Pipedrive.net.Tests/Helpers/UnixTimestampExtensionsTests.cs
index f384811f..ebebc759 100644
--- a/src/Pipedrive.net.Tests/Helpers/UnixTimestampExtensionsTests.cs
+++ b/src/Pipedrive.net.Tests/Helpers/UnixTimestampExtensionsTests.cs
@@ -2,45 +2,48 @@
using Pipedrive.Helpers;
using Xunit;
-public class UnixTimestampExtensionsTests
+namespace Pipedrive.Common
{
- public class TheToUnixTimeMethod
+ public class UnixTimestampExtensionsTests
{
- [Fact]
- public void ReturnsUnixEpochCorrectly()
+ public class TheToUnixTimeMethod
{
- var epoch = new DateTimeOffset(1970, 1, 1, 0, 0, 0, TimeSpan.Zero);
- Assert.Equal(0, epoch.ToUnixTime());
+ [Fact]
+ public void ReturnsUnixEpochCorrectly()
+ {
+ var epoch = new DateTimeOffset(1970, 1, 1, 0, 0, 0, TimeSpan.Zero);
+ Assert.Equal(0, epoch.ToUnixTime());
+ }
+
+ [Fact]
+ public void ReturnsRandomDateCorrectly()
+ {
+ var epoch = new DateTimeOffset(1975, 1, 23, 1, 1, 1, TimeSpan.Zero);
+ Assert.Equal(159670861, epoch.ToUnixTime());
+ }
}
- [Fact]
- public void ReturnsRandomDateCorrectly()
+ public class TheFromUnixTimeMethod
{
- var epoch = new DateTimeOffset(1975, 1, 23, 1, 1, 1, TimeSpan.Zero);
- Assert.Equal(159670861, epoch.ToUnixTime());
- }
- }
+ [Fact]
+ public void ReturnsDateFromUnixEpochCorrectly()
+ {
+ var epoch = new DateTimeOffset(1970, 1, 1, 0, 0, 0, TimeSpan.Zero);
- public class TheFromUnixTimeMethod
- {
- [Fact]
- public void ReturnsDateFromUnixEpochCorrectly()
- {
- var epoch = new DateTimeOffset(1970, 1, 1, 0, 0, 0, TimeSpan.Zero);
+ var result = 0L.FromUnixTime();
- var result = ((long)0).FromUnixTime();
+ Assert.Equal(epoch, result);
+ }
- Assert.Equal(epoch, result);
- }
-
- [Fact]
- public void ReturnsDateFromRandomTimeCorrectly()
- {
- var expected = new DateTimeOffset(1975, 1, 23, 1, 1, 2, TimeSpan.Zero);
+ [Fact]
+ public void ReturnsDateFromRandomTimeCorrectly()
+ {
+ var expected = new DateTimeOffset(1975, 1, 23, 1, 1, 2, TimeSpan.Zero);
- var result = ((long)159670862).FromUnixTime();
+ var result = 159670862L.FromUnixTime();
- Assert.Equal(expected, result);
+ Assert.Equal(expected, result);
+ }
}
}
}
diff --git a/src/Pipedrive.net.Tests/Helpers/UriExtensionsTests.cs b/src/Pipedrive.net.Tests/Helpers/UriExtensionsTests.cs
index 5eebf0c8..4b89debb 100644
--- a/src/Pipedrive.net.Tests/Helpers/UriExtensionsTests.cs
+++ b/src/Pipedrive.net.Tests/Helpers/UriExtensionsTests.cs
@@ -15,8 +15,8 @@ public void AppendsParametersAsQueryString()
var uriWithParameters = uri.ApplyParameters(new Dictionary
{
- {"foo", "foo val"},
- {"bar", "barval"}
+ { "foo", "foo val" },
+ { "bar", "barval" }
});
Assert.Equal(new Uri("https://example.com?foo=foo%20val&bar=barval"), uriWithParameters);
@@ -29,7 +29,7 @@ public void AppendsParametersAsQueryStringWithExistingParameters()
var uriWithParameters = uri.ApplyParameters(new Dictionary
{
- {"bar", "barval"}
+ { "bar", "barval" }
});
Assert.Equal(new Uri("https://example.com?bar=barval&foo=foo%20val"), uriWithParameters);
@@ -42,8 +42,8 @@ public void AppendsParametersAsQueryStringWithRelativeUri()
var uriWithParameters = uri.ApplyParameters(new Dictionary
{
- {"foo", "fooval"},
- {"bar", "barval"}
+ { "foo", "fooval" },
+ { "bar", "barval" }
});
Assert.Equal(new Uri("issues?foo=fooval&bar=barval", UriKind.Relative), uriWithParameters);
@@ -56,7 +56,7 @@ public void ThrowsExceptionWhenNullValueProvided()
var parameters = new Dictionary
{
- {"foo", null }
+ { "foo", null }
};
Assert.Throws(() => uri.ApplyParameters(parameters));
@@ -69,7 +69,7 @@ public void ThrowsExceptionWhenNullValueProvidedWithRelativeUri()
var parameters = new Dictionary
{
- {"foo", null }
+ { "foo", null }
};
Assert.Throws(() => uri.ApplyParameters(parameters));
diff --git a/src/Pipedrive.net.Tests/Http/ApiConnectionTests.cs b/src/Pipedrive.net.Tests/Http/ApiConnectionTests.cs
index 694ab2a6..a5be710d 100644
--- a/src/Pipedrive.net.Tests/Http/ApiConnectionTests.cs
+++ b/src/Pipedrive.net.Tests/Http/ApiConnectionTests.cs
@@ -1,7 +1,7 @@
using System;
-using System.Net;
using System.Collections.Generic;
using System.IO;
+using System.Net;
using System.Threading;
using System.Threading.Tasks;
using NSubstitute;
@@ -28,7 +28,7 @@ public async Task MakesGetRequestForItem()
var data = await apiConnection.Get
+
+ all
+ runtime; build; native; contentfiles; analyzers; buildtransitive
+
+
+
+
+ ..\..\pipedrive.ruleset
+
+
+
+
diff --git a/src/Pipedrive.net/PipedriveClient.cs b/src/Pipedrive.net/PipedriveClient.cs
index 2ab2cf41..dd3d61ef 100644
--- a/src/Pipedrive.net/PipedriveClient.cs
+++ b/src/Pipedrive.net/PipedriveClient.cs
@@ -1,6 +1,6 @@
-using Pipedrive.Clients;
+using System;
+using Pipedrive.Clients;
using Pipedrive.Helpers;
-using System;
namespace Pipedrive
{
@@ -102,8 +102,11 @@ public ApiInfo GetLastApiInfo()
///
public Credentials Credentials
{
- get { return Connection.Credentials; }
- // Note this is for convenience. We probably shouldn't allow this to be mutable.
+ get
+ {
+ return Connection.Credentials;
+ }
+
set
{
Ensure.ArgumentNotNull(value, nameof(value));
diff --git a/stylecop.json b/stylecop.json
new file mode 100644
index 00000000..85abcfc3
--- /dev/null
+++ b/stylecop.json
@@ -0,0 +1,8 @@
+{
+ "$schema": "https://raw.githubusercontent.com/DotNetAnalyzers/StyleCopAnalyzers/master/StyleCop.Analyzers/StyleCop.Analyzers/Settings/stylecop.schema.json",
+ "settings": {
+ "orderingRules": {
+ "usingDirectivesPlacement": "outsideNamespace"
+ }
+ }
+}