-
Notifications
You must be signed in to change notification settings - Fork 12
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
abf776a
commit 3334d8c
Showing
131 changed files
with
97 additions
and
97 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
4 changes: 2 additions & 2 deletions
4
...Server.Tests.Unit/Constants/ThemeTests.cs → ...Tests.Unit/Client/Constants/ThemeTests.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
186 changes: 93 additions & 93 deletions
186
...es/Devices/ConnectionStringDialogTests.cs → ...es/Devices/ConnectionStringDialogTests.cs
100755 → 100644
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,93 +1,93 @@ | ||
// Copyright (c) CGI France. All rights reserved. | ||
// Licensed under the MIT license. See LICENSE file in the project root for full license information. | ||
|
||
namespace AzureIoTHub.Portal.Server.Tests.Unit.Pages.Devices | ||
{ | ||
using System; | ||
using System.Threading.Tasks; | ||
using Bunit; | ||
using Client.Exceptions; | ||
using Client.Models; | ||
using Client.Pages.Devices; | ||
using Client.Services; | ||
using FluentAssertions; | ||
using Microsoft.Extensions.DependencyInjection; | ||
using Models.v10; | ||
using Moq; | ||
using MudBlazor; | ||
using NUnit.Framework; | ||
|
||
[TestFixture] | ||
public class ConnectionStringDialogTests : BlazorUnitTest | ||
{ | ||
private Mock<IDeviceClientService> mockDeviceClientService; | ||
|
||
public override void Setup() | ||
{ | ||
base.Setup(); | ||
|
||
this.mockDeviceClientService = MockRepository.Create<IDeviceClientService>(); | ||
|
||
_ = Services.AddSingleton(this.mockDeviceClientService.Object); | ||
_ = Services.AddSingleton<ClipboardService>(); | ||
} | ||
|
||
[Test] | ||
public async Task ConnectionStringDialogMustBeRenderedOnShow() | ||
{ | ||
// Arrange | ||
var deviceId = Guid.NewGuid().ToString(); | ||
|
||
_ = this.mockDeviceClientService.Setup(service => service.GetEnrollmentCredentials(deviceId)) | ||
.ReturnsAsync(new EnrollmentCredentials()); | ||
|
||
var cut = RenderComponent<MudDialogProvider>(); | ||
var service = Services.GetService<IDialogService>() as DialogService; | ||
|
||
var parameters = new DialogParameters | ||
{ | ||
{ | ||
"deviceId", deviceId | ||
} | ||
}; | ||
|
||
// Act | ||
await cut.InvokeAsync(() => service?.Show<ConnectionStringDialog>(string.Empty, parameters)); | ||
|
||
// Assert | ||
cut.WaitForAssertion(() => cut.Find("div.mud-dialog-container").Should().NotBeNull()); | ||
cut.WaitForAssertion(() => MockRepository.VerifyAll()); | ||
} | ||
|
||
[Test] | ||
public async Task OnInitializedAsyncShouldProcessProblemDetailsExceptionWhenIssueOccursOnGettingCredentials() | ||
{ | ||
// Arrange | ||
var deviceId = Guid.NewGuid().ToString(); | ||
|
||
_ = this.mockDeviceClientService.Setup(service => service.GetEnrollmentCredentials(deviceId)) | ||
.ThrowsAsync(new ProblemDetailsException(new ProblemDetailsWithExceptionDetails())); | ||
|
||
var cut = RenderComponent<MudDialogProvider>(); | ||
var service = Services.GetService<IDialogService>() as DialogService; | ||
|
||
var parameters = new DialogParameters | ||
{ | ||
{ | ||
"deviceId", deviceId | ||
} | ||
}; | ||
|
||
IDialogReference dialogReference = null; | ||
|
||
// Act | ||
await cut.InvokeAsync(() => dialogReference = service?.Show<ConnectionStringDialog>(string.Empty, parameters)); | ||
|
||
var result = await dialogReference.Result; | ||
|
||
// Assert | ||
cut.WaitForAssertion(() => result.Cancelled.Should().BeFalse()); | ||
cut.WaitForAssertion(() => MockRepository.VerifyAll()); | ||
} | ||
} | ||
} | ||
// Copyright (c) CGI France. All rights reserved. | ||
// Licensed under the MIT license. See LICENSE file in the project root for full license information. | ||
|
||
namespace AzureIoTHub.Portal.Server.Tests.Unit.Pages.Devices | ||
{ | ||
using System; | ||
using System.Threading.Tasks; | ||
using Bunit; | ||
using Client.Exceptions; | ||
using Client.Models; | ||
using Client.Pages.Devices; | ||
using Client.Services; | ||
using FluentAssertions; | ||
using Microsoft.Extensions.DependencyInjection; | ||
using Models.v10; | ||
using Moq; | ||
using MudBlazor; | ||
using NUnit.Framework; | ||
|
||
[TestFixture] | ||
public class ConnectionStringDialogTests : BlazorUnitTest | ||
{ | ||
private Mock<IDeviceClientService> mockDeviceClientService; | ||
|
||
public override void Setup() | ||
{ | ||
base.Setup(); | ||
|
||
this.mockDeviceClientService = MockRepository.Create<IDeviceClientService>(); | ||
|
||
_ = Services.AddSingleton(this.mockDeviceClientService.Object); | ||
_ = Services.AddSingleton<ClipboardService>(); | ||
} | ||
|
||
[Test] | ||
public async Task ConnectionStringDialogMustBeRenderedOnShow() | ||
{ | ||
// Arrange | ||
var deviceId = Guid.NewGuid().ToString(); | ||
|
||
_ = this.mockDeviceClientService.Setup(service => service.GetEnrollmentCredentials(deviceId)) | ||
.ReturnsAsync(new EnrollmentCredentials()); | ||
|
||
var cut = RenderComponent<MudDialogProvider>(); | ||
var service = Services.GetService<IDialogService>() as DialogService; | ||
|
||
var parameters = new DialogParameters | ||
{ | ||
{ | ||
"deviceId", deviceId | ||
} | ||
}; | ||
|
||
// Act | ||
await cut.InvokeAsync(() => service?.Show<ConnectionStringDialog>(string.Empty, parameters)); | ||
|
||
// Assert | ||
cut.WaitForAssertion(() => cut.Find("div.mud-dialog-container").Should().NotBeNull()); | ||
cut.WaitForAssertion(() => MockRepository.VerifyAll()); | ||
} | ||
|
||
[Test] | ||
public async Task OnInitializedAsyncShouldProcessProblemDetailsExceptionWhenIssueOccursOnGettingCredentials() | ||
{ | ||
// Arrange | ||
var deviceId = Guid.NewGuid().ToString(); | ||
|
||
_ = this.mockDeviceClientService.Setup(service => service.GetEnrollmentCredentials(deviceId)) | ||
.ThrowsAsync(new ProblemDetailsException(new ProblemDetailsWithExceptionDetails())); | ||
|
||
var cut = RenderComponent<MudDialogProvider>(); | ||
var service = Services.GetService<IDialogService>() as DialogService; | ||
|
||
var parameters = new DialogParameters | ||
{ | ||
{ | ||
"deviceId", deviceId | ||
} | ||
}; | ||
|
||
IDialogReference dialogReference = null; | ||
|
||
// Act | ||
await cut.InvokeAsync(() => dialogReference = service?.Show<ConnectionStringDialog>(string.Empty, parameters)); | ||
|
||
var result = await dialogReference.Result; | ||
|
||
// Assert | ||
cut.WaitForAssertion(() => result.Cancelled.Should().BeFalse()); | ||
cut.WaitForAssertion(() => MockRepository.VerifyAll()); | ||
} | ||
} | ||
} |
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters