Applied linting rules to tests within the Umbraco.Tests.Integration project.
This commit is contained in:
@@ -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");
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user