Applied linting rules to tests within the Umbraco.Tests.Integration project.

This commit is contained in:
Andy Butland
2020-12-23 11:35:49 +01:00
parent 2dc72ea323
commit cd5f5778ee
101 changed files with 7717 additions and 7365 deletions

View File

@@ -1,6 +1,10 @@
using System;
// Copyright (c) Umbraco.
// See LICENSE for more details.
using System;
using System.Linq;
using System.Net;
using System.Net.Http;
using System.Threading.Tasks;
using Newtonsoft.Json;
using Newtonsoft.Json.Linq;
@@ -20,12 +24,12 @@ namespace Umbraco.Tests.Integration.TestServerTest.Controllers
[Test]
public async Task GetContentTypes__Ensure_camel_case()
{
var url = PrepareUrl<TemplateQueryController>(x => x.GetContentTypes());
string url = PrepareUrl<TemplateQueryController>(x => x.GetContentTypes());
// Act
var response = await Client.GetAsync(url);
HttpResponseMessage response = await Client.GetAsync(url);
var body = await response.Content.ReadAsStringAsync();
string body = await response.Content.ReadAsStringAsync();
body = body.TrimStart(AngularJsonMediaTypeFormatter.XsrfPrefix);
@@ -36,17 +40,15 @@ namespace Umbraco.Tests.Integration.TestServerTest.Controllers
Assert.DoesNotThrow(() => JsonConvert.DeserializeObject<ContentTypeModel[]>(body));
var jtokens = JsonConvert.DeserializeObject<JToken[]>(body);
foreach (var jToken in jtokens)
JToken[] jtokens = JsonConvert.DeserializeObject<JToken[]>(body);
foreach (JToken jToken in jtokens)
{
var alias = nameof(ContentTypeModel.Alias);
var camelCaseAlias = alias.ToCamelCase();
string alias = nameof(ContentTypeModel.Alias);
string camelCaseAlias = alias.ToCamelCase();
Assert.IsNotNull(jToken.Value<string>(camelCaseAlias), $"'{jToken}' do not contain the key '{camelCaseAlias}' in the expected casing");
Assert.IsNull(jToken.Value<string>(alias), $"'{jToken}' do contain the key '{alias}', which was not expect in that casing");
}
});
}
}
}