-
-
Notifications
You must be signed in to change notification settings - Fork 344
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add test for Control.Language property resource
- Loading branch information
Showing
3 changed files
with
67 additions
and
1 deletion.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,9 @@ | ||
using System.Resources; | ||
using System.Reflection; | ||
using System.Runtime.CompilerServices; | ||
|
||
[assembly: AssemblyTitle("CKAN-GUI")] | ||
[assembly: AssemblyDescription("CKAN GUI Client")] | ||
[assembly: NeutralResourcesLanguage("en-GB")] | ||
|
||
[assembly: InternalsVisibleTo("CKAN.Tests")] |
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,64 @@ | ||
using System; | ||
using System.Linq; | ||
using System.ComponentModel; | ||
using System.Globalization; | ||
using NUnit.Framework; | ||
|
||
namespace Tests.GUI | ||
{ | ||
[TestFixture] | ||
public class ResourcesTests | ||
{ | ||
/// <summary> | ||
/// .resx files should never have a $this.Language property because it | ||
/// does not deserialize properly in Windows when serialized on Mono 6+ | ||
/// </summary> | ||
[Test, | ||
// Controls | ||
TestCase(typeof(CKAN.AllModVersions)), | ||
TestCase(typeof(CKAN.Changeset)), | ||
TestCase(typeof(CKAN.ChooseProvidedMods)), | ||
TestCase(typeof(CKAN.ChooseRecommendedMods)), | ||
TestCase(typeof(CKAN.DeleteDirectories)), | ||
TestCase(typeof(CKAN.EditModpack)), | ||
TestCase(typeof(CKAN.EditModSearch)), | ||
TestCase(typeof(CKAN.HintTextBox)), | ||
TestCase(typeof(CKAN.ManageMods)), | ||
TestCase(typeof(CKAN.ModInfo)), | ||
TestCase(typeof(CKAN.Wait)), | ||
|
||
// Dialogs | ||
TestCase(typeof(CKAN.Main)), | ||
TestCase(typeof(CKAN.AboutDialog)), | ||
TestCase(typeof(CKAN.AskUserForAutoUpdatesDialog)), | ||
TestCase(typeof(CKAN.CloneFakeKspDialog)), | ||
TestCase(typeof(CKAN.CompatibleKspVersionsDialog)), | ||
TestCase(typeof(CKAN.EditLabelsDialog)), | ||
TestCase(typeof(CKAN.ErrorDialog)), | ||
TestCase(typeof(CKAN.KSPCommandLineOptionsDialog)), | ||
TestCase(typeof(CKAN.ManageKspInstancesDialog)), | ||
TestCase(typeof(CKAN.NewRepoDialog)), | ||
TestCase(typeof(CKAN.NewUpdateDialog)), | ||
TestCase(typeof(CKAN.PluginsDialog)), | ||
TestCase(typeof(CKAN.RenameInstanceDialog)), | ||
TestCase(typeof(CKAN.SelectionDialog)), | ||
TestCase(typeof(CKAN.YesNoDialog)), | ||
] | ||
public void ControlOrDialog_LanguageResource_NotSet(Type t) | ||
{ | ||
// Arrange | ||
ComponentResourceManager resources = new CKAN.SingleAssemblyComponentResourceManager(t); | ||
|
||
// Act/Assert | ||
foreach (CultureInfo resourceCulture in cultures) | ||
{ | ||
Assert.IsNull(resources.GetObject("$this.Language", resourceCulture)); | ||
} | ||
} | ||
|
||
// The cultures to test | ||
private static CultureInfo[] cultures = CKAN.Utilities.AvailableLanguages | ||
.Select(l => new CultureInfo(l)) | ||
.ToArray(); | ||
} | ||
} |