-
-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added Support for Visual Studio 2013 and Generating the class as Inte…
…rnal (C#) or Friend (VB)
- Loading branch information
1 parent
2f134ac
commit 44b1f1f
Showing
14 changed files
with
136 additions
and
35 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,18 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<TestSettings | ||
id="85f80678-5acf-4267-a4f8-e5bf47bd5e87" | ||
name="Integration Tests" | ||
enableDefaultDataCollectors="false" | ||
xmlns="http://microsoft.com/schemas/VisualStudio/TeamTest/2010"> | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<TestSettings name="Integration Tests" id="85f80678-5acf-4267-a4f8-e5bf47bd5e87" xmlns="http://microsoft.com/schemas/VisualStudio/TeamTest/2010"> | ||
<Description>This test run configuration uses the VS IDE host type in the test run.</Description> | ||
<Deployment enabled="false" /> | ||
<Execution> | ||
<Hosts> | ||
<VSSDKTestHostRunConfig name="VS IDE" HiveName="11.0Exp" xmlns="http://microsoft.com/schemas/VisualStudio/SDK/Tools/IdeHostAdapter/2006/06" /> | ||
<VSSDKTestHostRunConfig name="VS IDE" HiveKind="DevEnv" HiveName="11.0Exp" xmlns="http://microsoft.com/schemas/VisualStudio/SDK/Tools/IdeHostAdapter/2006/06" /> | ||
</Hosts> | ||
<TestTypeSpecific> | ||
<UnitTestRunConfig testTypeId="13cdc9d9-ddb5-4fa4-a97d-d965ccfc6d4b"> | ||
<AssemblyResolution> | ||
<TestDirectory useLoadContext="true" /> | ||
</AssemblyResolution> | ||
</UnitTestRunConfig> | ||
</TestTypeSpecific> | ||
<AgentRule name="LocalMachineDefaultRole"> | ||
</AgentRule> | ||
</Execution> | ||
</TestSettings> | ||
</TestSettings> |
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
70 changes: 70 additions & 0 deletions
70
RESW File Code Generator/ReswCodeGen.Tests/VisualBasicCodeGeneratorInternalTests.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,70 @@ | ||
using System.IO; | ||
using System.Linq; | ||
using System.Reflection; | ||
using ChristianHelle.DeveloperTools.CodeGenerators.Resw.VSPackage.CustomTool; | ||
using Microsoft.VisualBasic; | ||
using Microsoft.VisualStudio.TestTools.UnitTesting; | ||
|
||
namespace ChristianHelle.DeveloperTools.CodeGenerators.Resw.CustomTool.Tests | ||
{ | ||
[TestClass] | ||
[DeploymentItem("Resources/Resources.resw")] | ||
public class VisualBasicCodeGeneratorInternalTests | ||
{ | ||
private const string FILE_PATH = "Resources.resw"; | ||
private string actual; | ||
private string reswFileContents; | ||
private ICodeGenerator target; | ||
|
||
[TestInitialize] | ||
public void Initialize() | ||
{ | ||
reswFileContents = File.ReadAllText(FILE_PATH); | ||
|
||
target = new CodeGeneratorFactory().Create(FILE_PATH.Replace(".resw", string.Empty), "TestApp", reswFileContents, new VBCodeProvider(), TypeAttributes.NestedAssembly); | ||
actual = target.GenerateCode(); | ||
} | ||
|
||
[TestMethod] | ||
public void GenerateCodeDoesNotReturnNull() | ||
{ | ||
Assert.IsNotNull(actual); | ||
} | ||
|
||
[TestMethod] | ||
public void GeneratedCodeIsFriendClass() | ||
{ | ||
Assert.IsTrue(actual.Contains("Partial Friend Class")); | ||
} | ||
|
||
[TestMethod] | ||
public void GeneratedCodeContainsPropertiesDefinedInResources() | ||
{ | ||
var resourceItems = target.ResourceParser.Parse(); | ||
|
||
foreach (var item in resourceItems.Where(item => !item.Name.Contains("."))) | ||
Assert.IsTrue(actual.Contains("Public Shared ReadOnly Property " + item.Name + "() As String")); | ||
} | ||
|
||
[TestMethod] | ||
public void GeneratedCodePropertiesContainsCommentsSimilarToValuesDefinedInResources() | ||
{ | ||
var resourceItems = target.ResourceParser.Parse(); | ||
|
||
foreach (var item in resourceItems.Where(item => !item.Name.Contains("."))) | ||
Assert.IsTrue(actual.Contains("Localized resource similar to \"" + item.Value + "\"")); | ||
} | ||
|
||
[TestMethod] | ||
public void ClassNameEqualsFileNameWithoutExtension() | ||
{ | ||
Assert.IsTrue(actual.Contains("Class Resources")); | ||
} | ||
|
||
[TestMethod] | ||
public void ResourceLoaderInitializedWithClassName() | ||
{ | ||
Assert.IsTrue(actual.Contains("New ResourceLoader(currentAssemblyName + \"/Resources\")")); | ||
} | ||
} | ||
} |
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,9 +1,15 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<TestSettings | ||
id="906380a7-c058-43a6-8f36-966013e5a9eb" | ||
name="Unit Tests" | ||
enableDefaultDataCollectors="false" | ||
xmlns="http://microsoft.com/schemas/VisualStudio/TeamTest/2010"> | ||
<Deployment enabled="false" /> | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<TestSettings name="Unit Tests" id="906380a7-c058-43a6-8f36-966013e5a9eb" xmlns="http://microsoft.com/schemas/VisualStudio/TeamTest/2010"> | ||
<Description>This test run configuration is used for running the unit tests</Description> | ||
</TestSettings> | ||
<Execution> | ||
<TestTypeSpecific> | ||
<UnitTestRunConfig testTypeId="13cdc9d9-ddb5-4fa4-a97d-d965ccfc6d4b"> | ||
<AssemblyResolution> | ||
<TestDirectory useLoadContext="true" /> | ||
</AssemblyResolution> | ||
</UnitTestRunConfig> | ||
</TestTypeSpecific> | ||
<AgentRule name="LocalMachineDefaultRole"> | ||
</AgentRule> | ||
</Execution> | ||
</TestSettings> |
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
3 changes: 2 additions & 1 deletion
3
RESW File Code Generator/VSPackage/CustomTool/CodeGeneratorFactory.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
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