Skip to content

Commit

Permalink
fix indentation
Browse files Browse the repository at this point in the history
  • Loading branch information
nabilatrhea committed Aug 31, 2023
1 parent 64830e1 commit cb93a79
Show file tree
Hide file tree
Showing 5 changed files with 88 additions and 88 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -91,53 +91,53 @@ public async Task VerifyService()
Assert.That(this.serverConnectionService.ServerAddress, Is.EqualTo("http://localhost:5000/"));
});

handlerMock
.Protected()
.Setup<Task<HttpResponseMessage>>(
"SendAsync",
ItExpr.IsAny<HttpRequestMessage>(),
ItExpr.IsAny<CancellationToken>()
)
.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<Task<HttpResponseMessage>>(
"SendAsync",
ItExpr.IsAny<HttpRequestMessage>(),
ItExpr.IsAny<CancellationToken>()
)
.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<Task<HttpResponseMessage>>(
"SendAsync",
ItExpr.IsAny<HttpRequestMessage>(),
ItExpr.IsAny<CancellationToken>()
)
.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<Task<HttpResponseMessage>>(
"SendAsync",
ItExpr.IsAny<HttpRequestMessage>(),
ItExpr.IsAny<CancellationToken>()
)
.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);
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -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
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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<Dictionary<string, string>>(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<Dictionary<string, string>>(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);
Expand Down
28 changes: 14 additions & 14 deletions COMET.Web.Common/ViewModels/Components/LoginViewModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -27,29 +27,29 @@ 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;

/// <summary>
/// View Model that enables the user to login against a COMET Server
/// </summary>
/// <summary>
/// View Model that enables the user to login against a COMET Server
/// </summary>
public class LoginViewModel : ReactiveObject, ILoginViewModel
{
/// <summary>
/// The <see cref="IAuthenticationService" />
/// </summary>
private readonly IAuthenticationService authenticationService;

/// <summary>
/// Gets the <see cref="IServerConnectionService" />
/// </summary>
public IServerConnectionService serverConnectionService { get; }
/// <summary>
/// Gets the <see cref="IServerConnectionService" />
/// </summary>
public IServerConnectionService serverConnectionService { get; }

/// <summary>
/// Backing field for <see cref="AuthenticationState" />
/// </summary>
private AuthenticationStateKind authenticationState;
/// <summary>
/// Backing field for <see cref="AuthenticationState" />
/// </summary>
private AuthenticationStateKind authenticationState;

/// <summary>
/// Initializes a new instance of the <see cref="LoginViewModel" /> class.
Expand Down

0 comments on commit cb93a79

Please sign in to comment.