From cb93a791523d7a1a31728db5622d5f0d7454bb14 Mon Sep 17 00:00:00 2001 From: Nabil Abbar Date: Thu, 31 Aug 2023 13:58:41 +0200 Subject: [PATCH] fix indentation --- ...IterationApplicationTemplateTestFixture.cs | 4 +- .../ServerConnectionServiceTestFixture.cs | 98 +++++++++---------- ...ingleIterationApplicationTemplate.razor.cs | 6 +- .../ServerConnectionService.cs | 40 ++++---- .../ViewModels/Components/LoginViewModel.cs | 28 +++--- 5 files changed, 88 insertions(+), 88 deletions(-) diff --git a/COMET.Web.Common.Tests/Components/SingleIterationApplicationTemplateTestFixture.cs b/COMET.Web.Common.Tests/Components/SingleIterationApplicationTemplateTestFixture.cs index 03d6a3ac..5a100f52 100644 --- a/COMET.Web.Common.Tests/Components/SingleIterationApplicationTemplateTestFixture.cs +++ b/COMET.Web.Common.Tests/Components/SingleIterationApplicationTemplateTestFixture.cs @@ -37,8 +37,8 @@ namespace COMET.Web.Common.Tests.Components using COMET.Web.Common.Components.Selectors; using COMET.Web.Common.Extensions; using COMET.Web.Common.Services.ConfigurationService; - using COMET.Web.Common.Services.ServerConnectionService; - using COMET.Web.Common.Services.SessionManagement; + using COMET.Web.Common.Services.ServerConnectionService; + using COMET.Web.Common.Services.SessionManagement; using COMET.Web.Common.Test.Helpers; using COMET.Web.Common.ViewModels.Components; using COMET.Web.Common.ViewModels.Components.Selectors; diff --git a/COMET.Web.Common.Tests/Services/ServerConnectionService/ServerConnectionServiceTestFixture.cs b/COMET.Web.Common.Tests/Services/ServerConnectionService/ServerConnectionServiceTestFixture.cs index 00a2b1e4..9ad28715 100644 --- a/COMET.Web.Common.Tests/Services/ServerConnectionService/ServerConnectionServiceTestFixture.cs +++ b/COMET.Web.Common.Tests/Services/ServerConnectionService/ServerConnectionServiceTestFixture.cs @@ -91,53 +91,53 @@ public async Task VerifyService() Assert.That(this.serverConnectionService.ServerAddress, Is.EqualTo("http://localhost:5000/")); }); - handlerMock - .Protected() - .Setup>( - "SendAsync", - ItExpr.IsAny(), - ItExpr.IsAny() - ) - .ReturnsAsync(new HttpResponseMessage - { - StatusCode = HttpStatusCode.NotFound, - }) - .Verifiable(); - - httpClient = new HttpClient(handlerMock.Object) - { - BaseAddress = new Uri("http://localhost") - }; - - serverConnectionService = new ServerConnectionService(options.Object, httpClient); - - await this.serverConnectionService.InitializeService(); - - Assert.That(this.serverConnectionService.ServerAddress, Is.Null); - - handlerMock - .Protected() - .Setup>( - "SendAsync", - ItExpr.IsAny(), - ItExpr.IsAny() - ) - .ReturnsAsync(new HttpResponseMessage - { - StatusCode = HttpStatusCode.BadRequest, - }) - .Verifiable(); - - httpClient = new HttpClient(handlerMock.Object) - { - BaseAddress = new Uri("http://localhost") - }; - - serverConnectionService = new ServerConnectionService(options.Object, httpClient); - - await this.serverConnectionService.InitializeService(); - - Assert.That(this.serverConnectionService.ServerAddress, Is.Null); - } - } + handlerMock + .Protected() + .Setup>( + "SendAsync", + ItExpr.IsAny(), + ItExpr.IsAny() + ) + .ReturnsAsync(new HttpResponseMessage + { + StatusCode = HttpStatusCode.NotFound, + }) + .Verifiable(); + + httpClient = new HttpClient(handlerMock.Object) + { + BaseAddress = new Uri("http://localhost") + }; + + serverConnectionService = new ServerConnectionService(options.Object, httpClient); + + await this.serverConnectionService.InitializeService(); + + Assert.That(this.serverConnectionService.ServerAddress, Is.Null); + + handlerMock + .Protected() + .Setup>( + "SendAsync", + ItExpr.IsAny(), + ItExpr.IsAny() + ) + .ReturnsAsync(new HttpResponseMessage + { + StatusCode = HttpStatusCode.BadRequest, + }) + .Verifiable(); + + httpClient = new HttpClient(handlerMock.Object) + { + BaseAddress = new Uri("http://localhost") + }; + + serverConnectionService = new ServerConnectionService(options.Object, httpClient); + + await this.serverConnectionService.InitializeService(); + + Assert.That(this.serverConnectionService.ServerAddress, Is.Null); + } + } } diff --git a/COMET.Web.Common/Components/SingleIterationApplicationTemplate.razor.cs b/COMET.Web.Common/Components/SingleIterationApplicationTemplate.razor.cs index 47354385..d7bef4ec 100644 --- a/COMET.Web.Common/Components/SingleIterationApplicationTemplate.razor.cs +++ b/COMET.Web.Common/Components/SingleIterationApplicationTemplate.razor.cs @@ -146,10 +146,10 @@ internal void SetCorrectUrl() if (string.IsNullOrEmpty(this.ServerConnectionService.ServerAddress)) { - currentOptions[QueryKeys.ServerKey] = this.ViewModel.SessionService.Session.DataSourceUri; + currentOptions[QueryKeys.ServerKey] = this.ViewModel.SessionService.Session.DataSourceUri; - } - currentOptions[QueryKeys.DomainKey] = this.ViewModel.SessionService.GetDomainOfExpertise(this.ViewModel.SelectedIteration).Iid.ToShortGuid(); + } + currentOptions[QueryKeys.DomainKey] = this.ViewModel.SessionService.GetDomainOfExpertise(this.ViewModel.SelectedIteration).Iid.ToShortGuid(); } else { diff --git a/COMET.Web.Common/Services/ServerConnectionService/ServerConnectionService.cs b/COMET.Web.Common/Services/ServerConnectionService/ServerConnectionService.cs index ad2e30dd..b072581c 100644 --- a/COMET.Web.Common/Services/ServerConnectionService/ServerConnectionService.cs +++ b/COMET.Web.Common/Services/ServerConnectionService/ServerConnectionService.cs @@ -25,8 +25,8 @@ namespace COMET.Web.Common.Services.ServerConnectionService { using System; - using System.Net; - using System.Text.Json; + using System.Net; + using System.Text.Json; using COMET.Web.Common.Model; using COMET.Web.Common.Utilities; @@ -86,24 +86,24 @@ public async Task InitializeService() { var path = ContentPathBuilder.BuildPath(this.ServerConfigurationFile); - using (var response = await this.http.GetAsync(path)) - { - if (response.IsSuccessStatusCode) - { - var jsonContent = await response.Content.ReadAsStreamAsync(); - configurations = JsonSerializer.Deserialize>(jsonContent); - this.ServerAddress = configurations["ServerAddress"]; - } - else if (response.StatusCode == HttpStatusCode.NotFound) - { - Console.WriteLine($"Server configuration file not found at {path}"); - } - else - { - Console.WriteLine($"Error fetching server configuration. Status code: {response.StatusCode}"); - } - } - } + using (var response = await this.http.GetAsync(path)) + { + if (response.IsSuccessStatusCode) + { + var jsonContent = await response.Content.ReadAsStreamAsync(); + configurations = JsonSerializer.Deserialize>(jsonContent); + this.ServerAddress = configurations["ServerAddress"]; + } + else if (response.StatusCode == HttpStatusCode.NotFound) + { + Console.WriteLine($"Server configuration file not found at {path}"); + } + else + { + Console.WriteLine($"Error fetching server configuration. Status code: {response.StatusCode}"); + } + } + } catch (Exception e) { Console.WriteLine(e); diff --git a/COMET.Web.Common/ViewModels/Components/LoginViewModel.cs b/COMET.Web.Common/ViewModels/Components/LoginViewModel.cs index c35bdfcd..59985998 100644 --- a/COMET.Web.Common/ViewModels/Components/LoginViewModel.cs +++ b/COMET.Web.Common/ViewModels/Components/LoginViewModel.cs @@ -27,13 +27,13 @@ namespace COMET.Web.Common.ViewModels.Components { using COMET.Web.Common.Enumerations; using COMET.Web.Common.Model.DTO; - using COMET.Web.Common.Services.ServerConnectionService; - using COMET.Web.Common.Services.SessionManagement; - using ReactiveUI; + using COMET.Web.Common.Services.ServerConnectionService; + using COMET.Web.Common.Services.SessionManagement; + using ReactiveUI; - /// - /// View Model that enables the user to login against a COMET Server - /// + /// + /// View Model that enables the user to login against a COMET Server + /// public class LoginViewModel : ReactiveObject, ILoginViewModel { /// @@ -41,15 +41,15 @@ public class LoginViewModel : ReactiveObject, ILoginViewModel /// private readonly IAuthenticationService authenticationService; - /// - /// Gets the - /// - public IServerConnectionService serverConnectionService { get; } + /// + /// Gets the + /// + public IServerConnectionService serverConnectionService { get; } - /// - /// Backing field for - /// - private AuthenticationStateKind authenticationState; + /// + /// Backing field for + /// + private AuthenticationStateKind authenticationState; /// /// Initializes a new instance of the class.