-
Notifications
You must be signed in to change notification settings - Fork 1
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
antoineatrhea
committed
Oct 3, 2023
1 parent
71a4c6d
commit ec1b77e
Showing
44 changed files
with
1,594 additions
and
1,155 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
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
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
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
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
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
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 |
---|---|---|
@@ -0,0 +1,12 @@ | ||
{ | ||
"OpenEngineeringModelPlaceholder": "Select an Engineering Model", | ||
"OpenIterationPlaceholder": "Select an Iteration", | ||
"OpenDomainOfExpertisePlaceholder": "Select a Domain of Expertise", | ||
"ModelTitleCaption": "Model", | ||
"IterationTitleCaption": "Iteration", | ||
"DomainTitleCaption": "Domain", | ||
"LandingPageTitle": "", | ||
"NavigationApplicationSelectorTitle": "Application", | ||
"NavigationModelSelectorTitle": "Models", | ||
"ModelOpenButtonCaption": "Open Model" | ||
} |
12 changes: 12 additions & 0 deletions
12
COMET.Web.Common.Tests/Resources/configuration/DefaultTextConfiguration.json
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 |
---|---|---|
@@ -0,0 +1,12 @@ | ||
{ | ||
"OpenEngineeringModelPlaceholder": "Select an Engineering Model", | ||
"OpenIterationPlaceholder": "Select an Iteration", | ||
"OpenDomainOfExpertisePlaceholder": "Select a Domain of Expertise", | ||
"ModelTitleCaption": "Model", | ||
"IterationTitleCaption": "Iteration", | ||
"DomainTitleCaption": "Domain", | ||
"LandingPageTitle": "", | ||
"NavigationApplicationSelectorTitle": "Application", | ||
"NavigationModelSelectorTitle": "Models", | ||
"ModelOpenButtonCaption": "Open Model" | ||
} |
74 changes: 74 additions & 0 deletions
74
....Web.Common.Tests/Server/Services/ConfigurationService/ConfigurationServiceTestFixture.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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,74 @@ | ||
// -------------------------------------------------------------------------------------------------------------------- | ||
// <copyright file="ConfigurationServiceTestFixture.cs" company="RHEA System S.A."> | ||
// Copyright (c) 2023 RHEA System S.A. | ||
// | ||
// Authors: Sam Gerené, Alex Vorobiev, Alexander van Delft, Jaime Bernar, Théate Antoine | ||
// | ||
// This file is part of COMET WEB Community Edition | ||
// The COMET WEB Community Edition is the RHEA Web Application implementation of ECSS-E-TM-10-25 | ||
// Annex A and Annex C. | ||
// | ||
// Licensed under the Apache License, Version 2.0 (the "License"); | ||
// you may not use this file except in compliance with the License. | ||
// You may obtain a copy of the License at | ||
// | ||
// http://www.apache.org/licenses/LICENSE-2.0 | ||
// | ||
// Unless required by applicable law or agreed to in writing, software | ||
// distributed under the License is distributed on an "AS IS" BASIS, | ||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
// See the License for the specific language governing permissions and | ||
// limitations under the License. | ||
// | ||
// </copyright> | ||
// -------------------------------------------------------------------------------------------------------------------- | ||
|
||
namespace COMET.Web.Common.Tests.Server.Services.ConfigurationService | ||
{ | ||
using COMET.Web.Common.Server.Services.ConfigurationService; | ||
|
||
using Microsoft.Extensions.Configuration; | ||
|
||
using Moq; | ||
|
||
using NUnit.Framework; | ||
|
||
[TestFixture] | ||
public class ConfigurationServiceTestFixture | ||
{ | ||
[Test] | ||
public async Task VerifyInitializeServiceWithEmptyConfiguration() | ||
{ | ||
var configuration = new Mock<IConfiguration>(); | ||
configuration.Setup(x => x.GetSection(ConfigurationService.AddressSection)).Returns(new Mock<IConfigurationSection>().Object); | ||
var service = new ConfigurationService(configuration.Object); | ||
await service.InitializeService(); | ||
|
||
Assert.Multiple(() => | ||
{ | ||
configuration.Verify(x => x.GetSection(ConfigurationService.AddressSection), Times.Once); | ||
Assert.That(service.ServerAddress, Is.Null); | ||
}); | ||
|
||
await service.InitializeService(); | ||
configuration.Verify(x => x.GetSection(ConfigurationService.AddressSection), Times.Once); | ||
} | ||
|
||
[Test] | ||
public async Task VerifyInitializeServiceWithConfiguration() | ||
{ | ||
var configurationSection = new Mock<IConfigurationSection>(); | ||
configurationSection.Setup(x => x.Value).Returns("https://a.b.c"); | ||
var configuration = new Mock<IConfiguration>(); | ||
configuration.Setup(x => x.GetSection(ConfigurationService.AddressSection)).Returns(configurationSection.Object); | ||
var service = new ConfigurationService(configuration.Object); | ||
await service.InitializeService(); | ||
|
||
Assert.Multiple(() => | ||
{ | ||
configuration.Verify(x => x.GetSection(ConfigurationService.AddressSection), Times.Once); | ||
Assert.That(service.ServerAddress, Is.EqualTo(configurationSection.Object.Value)); | ||
}); | ||
} | ||
} | ||
} |
58 changes: 58 additions & 0 deletions
58
COMET.Web.Common.Tests/Server/Services/StringTableService/StringTableServiceTestFixture.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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
// -------------------------------------------------------------------------------------------------------------------- | ||
// <copyright file="StringTableServiceTestFixture.cs" company="RHEA System S.A."> | ||
// Copyright (c) 2023 RHEA System S.A. | ||
// | ||
// Authors: Sam Gerené, Alex Vorobiev, Alexander van Delft, Jaime Bernar, Théate Antoine | ||
// | ||
// This file is part of COMET WEB Community Edition | ||
// The COMET WEB Community Edition is the RHEA Web Application implementation of ECSS-E-TM-10-25 | ||
// Annex A and Annex C. | ||
// | ||
// Licensed under the Apache License, Version 2.0 (the "License"); | ||
// you may not use this file except in compliance with the License. | ||
// You may obtain a copy of the License at | ||
// | ||
// http://www.apache.org/licenses/LICENSE-2.0 | ||
// | ||
// Unless required by applicable law or agreed to in writing, software | ||
// distributed under the License is distributed on an "AS IS" BASIS, | ||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
// See the License for the specific language governing permissions and | ||
// limitations under the License. | ||
// | ||
// </copyright> | ||
// -------------------------------------------------------------------------------------------------------------------- | ||
|
||
namespace COMET.Web.Common.Tests.Server.Services.StringTableService | ||
{ | ||
using COMET.Web.Common.Enumerations; | ||
using COMET.Web.Common.Server.Services.StringTableService; | ||
|
||
using Microsoft.Extensions.Configuration; | ||
using Microsoft.Extensions.Logging.Abstractions; | ||
|
||
using Moq; | ||
|
||
using NUnit.Framework; | ||
|
||
[TestFixture] | ||
public class StringTableServiceTestFixture | ||
{ | ||
[Test] | ||
public async Task VerifyServiceInitialization() | ||
{ | ||
var configuration = new Mock<IConfiguration>(); | ||
configuration.Setup(x => x["StringTablePath"]).Returns(""); | ||
|
||
var service = new StringTableService(configuration.Object, NullLogger<StringTableService>.Instance); | ||
await service.InitializeService(); | ||
Assert.That(() => service.GetText(TextConfigurationKind.DomainTitleCaption), Throws.Exception); | ||
|
||
configuration.Setup(x => x["StringTablePath"]).Returns(Path.Combine("Resources", "configuration", "DefaultTextConfiguration.json")); | ||
|
||
service = new StringTableService(configuration.Object, NullLogger<StringTableService>.Instance); | ||
await service.InitializeService(); | ||
Assert.That(() => service.GetText(TextConfigurationKind.DomainTitleCaption), Throws.Nothing); | ||
} | ||
} | ||
} |
Oops, something went wrong.