1
- using System ;
2
- using System . Collections . Generic ;
1
+ using Moq ;
2
+ using Moq . Protected ;
3
+ using NUnit . Framework ;
4
+ using NUnit . Framework . Internal ;
5
+ using System ;
3
6
using System . IO ;
4
- using System . Linq ;
5
7
using System . Net ;
6
8
using System . Net . Http ;
7
- using System . Text ;
8
9
using System . Threading ;
9
10
using System . Threading . Tasks ;
10
- using System . Web ;
11
- using Microsoft . AspNet . SignalR . Hubs ;
12
- using Moq ;
13
- using Moq . Protected ;
14
- using Newtonsoft . Json ;
15
- using NUnit . Framework ;
16
- using NUnit . Framework . Internal ;
17
11
using Umbraco . Cms . Integrations . Crm . Hubspot . Configuration ;
18
12
using Umbraco . Cms . Integrations . Crm . Hubspot . Controllers ;
19
13
using Umbraco . Cms . Integrations . Crm . Hubspot . Models ;
20
- using Umbraco . Cms . Integrations . Crm . Hubspot . Models . Dtos ;
21
14
using Umbraco . Cms . Integrations . Crm . Hubspot . Services ;
22
15
using Umbraco . Core . Composing ;
23
- using Umbraco . Core . Configuration ;
24
- using Umbraco . Core . Configuration . UmbracoSettings ;
25
- using Umbraco . Core . Logging ;
26
- using Umbraco . Web ;
27
- using Umbraco . Web . Routing ;
28
- using Umbraco . Web . Security ;
29
16
using ILogger = Umbraco . Core . Logging . ILogger ;
30
17
31
18
namespace Umbraco . Cms . Integrations . Crm . Hubspot . Tests . Controllers
@@ -39,18 +26,6 @@ public class FormsControllerTests
39
26
""correlationId"": ""73f4a25b-7b0a-4537-a490-e5c226619d59""
40
27
}" ;
41
28
42
- private readonly string ExpiredOAuthToken = @"{
43
- ""status"": ""error"",
44
- ""message"": ""This oauth-token is expired! expiresAt: 1643194402611, now: 1643972072320"",
45
- ""correlationId"": ""1ae46a55-f5b9-4f68-811a-695a12aaa4f5"",
46
- ""category"": ""EXPIRED_AUTHENTICATION"",
47
- ""errors"": [
48
- {
49
- ""message"": ""The OAuth token used to make this call expired 9 day(s) ago.""
50
- }
51
- ]
52
- }" ;
53
-
54
29
private HubspotSettings MockedAppSettingsApiSetup ;
55
30
56
31
private HubspotSettings MockedAppSettingsOAuthSetup ;
@@ -81,8 +56,10 @@ public void Init()
81
56
[ Test ]
82
57
public void CheckApiConfiguration_WithApiConfig_ShouldReturnValidConfigurationResponseObjectWithType ( )
83
58
{
84
- var sut = new FormsController ( Mock . Of < ITokenService > ( ) , Mock . Of < ILogger > ( ) ) ;
85
- sut . Options = MockedAppSettingsApiSetup ;
59
+ var sut = new FormsController ( Mock . Of < ITokenService > ( ) , Mock . Of < ILogger > ( ) )
60
+ {
61
+ Options = MockedAppSettingsApiSetup
62
+ } ;
86
63
87
64
var result = sut . CheckConfiguration ( ) ;
88
65
@@ -93,8 +70,10 @@ public void CheckApiConfiguration_WithApiConfig_ShouldReturnValidConfigurationRe
93
70
[ Test ]
94
71
public void CheckOAuthConfiguration_WithOAuthConfigAndNoApiConfig_ShouldReturnValidConfigurationResponseObjectWithType ( )
95
72
{
96
- var sut = new FormsController ( Mock . Of < ITokenService > ( ) , Mock . Of < ILogger > ( ) ) ;
97
- sut . Options = MockedAppSettingsOAuthSetup ;
73
+ var sut = new FormsController ( Mock . Of < ITokenService > ( ) , Mock . Of < ILogger > ( ) )
74
+ {
75
+ Options = MockedAppSettingsOAuthSetup
76
+ } ;
98
77
99
78
var result = sut . CheckConfiguration ( ) ;
100
79
@@ -109,8 +88,10 @@ public void CheckOAuthConfiguration_WithOAuthConfigAndNoApiConfig_ShouldReturnVa
109
88
[ Test ]
110
89
public async Task GetAll_WithoutApiKey_ShouldReturnInvalidResponseObjectWithLoggedInfo ( )
111
90
{
112
- var sut = new FormsController ( Mock . Of < ITokenService > ( ) , MockedLogger . Object ) ;
113
- sut . Options = MockedAppSettingsNoSetup ;
91
+ var sut = new FormsController ( Mock . Of < ITokenService > ( ) , MockedLogger . Object )
92
+ {
93
+ Options = MockedAppSettingsNoSetup
94
+ } ;
114
95
115
96
var result = await sut . GetAll ( ) ;
116
97
0 commit comments