-
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.
Co-authored-by: Fabian Zacharias <fabian.zacharias@siemens.com>
- Loading branch information
1 parent
eb18dbb
commit 18a892f
Showing
12 changed files
with
357 additions
and
3 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 |
---|---|---|
|
@@ -361,5 +361,3 @@ MigrationBackup/ | |
|
||
# Fody - auto-generated XML schema | ||
FodyWeavers.xsd | ||
/MAC_use_cases.Tests | ||
/MAC_use_cases.sln |
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,15 @@ | ||
<?xml version="1.0" encoding="utf-8" ?> | ||
<configuration> | ||
<runtime> | ||
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1"> | ||
<dependentAssembly> | ||
<assemblyIdentity name="Siemens.Automation.ModAppCreator.Core" publicKeyToken="a9c97c5d7d58abea" culture="neutral" /> | ||
<bindingRedirect oldVersion="0.0.0.0-99.0.0.0" newVersion="19.2.10.0" /> | ||
</dependentAssembly> | ||
<dependentAssembly> | ||
<assemblyIdentity name="Siemens.Automation.ModAppCreator.Basics" publicKeyToken="a9c97c5d7d58abea" culture="neutral" /> | ||
<bindingRedirect oldVersion="0.0.0.0-99.0.0.0" newVersion="19.2.10.0" /> | ||
</dependentAssembly> | ||
</assemblyBinding> | ||
</runtime> | ||
</configuration> |
18 changes: 18 additions & 0 deletions
18
MAC_use_cases.Tests/Builder.Tests/GenerateTiaPortalTest.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,18 @@ | ||
using NUnit.Framework; | ||
|
||
using MAC_use_cases.Tests.TestEnvironment; | ||
|
||
using Siemens.ModularApplicationCreator.Testenvironment.TestCategoryAttributes; | ||
|
||
namespace MAC_use_cases.Tests.Builder.Tests | ||
{ | ||
public class GenerateTiaPortalTest : MacGenerationTestBaseMAC_use_cases | ||
{ | ||
[Test, MacGenerationTest] | ||
public void GenerateTiaPortal_Test() | ||
{ | ||
GenerateTiaPortal(); | ||
OpenProjectInNewTiaPortalWithUi(); | ||
} | ||
} | ||
} |
35 changes: 35 additions & 0 deletions
35
MAC_use_cases.Tests/Builder.Tests/MAC_use_casesBuilderTests.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,35 @@ | ||
using NUnit.Framework; | ||
|
||
using MAC_use_cases.Tests.TestEnvironment; | ||
|
||
using Siemens.ModularApplicationCreator.Testenvironment.TestCategoryAttributes; | ||
using Siemens.ModularApplicationCreator.Testenvironment.UnitTestBaseClasses.Enums; | ||
|
||
namespace MAC_use_cases.Tests.Builder.Tests | ||
{ | ||
public class MAC_use_casesBuilderTests : MacFunctionTestBaseMAC_use_cases | ||
{ | ||
protected string LanguageSetting => | ||
this.Get(() => ProjectOpenness.LanguageSettings.EditingLanguage.Culture.Name, NunitTestContext.TestCase); | ||
|
||
|
||
[Test, MacFunctionTest] | ||
public void GenerateOBMainTest() | ||
{ | ||
//Test could look like the following | ||
|
||
//GenericBlockCreation.GenerateOB_Main("MyMultiInstanceDBName", EquipmentModule, LanguageSetting, PlcDeviceMacSimulated); | ||
} | ||
|
||
[Test, MacFunctionTest] | ||
public void GenerateS120Test() | ||
{ | ||
//A test for the hardware generation could look like the following. | ||
//Necessary to create the openness objects is to call the function GenerateHardware after configuration of the MAC objects. | ||
|
||
//HardwareGeneration.GenerateS120WithMasterCopy(EquipmentModule, "Test", "Test"); | ||
//GenerateHardware(); | ||
} | ||
|
||
} | ||
} |
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,164 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<Project ToolsVersion="15.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> | ||
<PropertyGroup> | ||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> | ||
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> | ||
<ProductVersion>8.0.30703</ProductVersion> | ||
<SchemaVersion>2.0</SchemaVersion> | ||
<ProjectGuid>4c3974f2-4eff-4168-a68e-ec9e5caccda1</ProjectGuid> | ||
<OutputType>Library</OutputType> | ||
<AppDesignerFolder>Properties</AppDesignerFolder> | ||
<RootNamespace>Module.Tests</RootNamespace> | ||
<AssemblyName>Module.Tests</AssemblyName> | ||
<TargetFrameworkVersion>v4.8</TargetFrameworkVersion> | ||
<FileAlignment>512</FileAlignment> | ||
</PropertyGroup> | ||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "> | ||
<DebugSymbols>true</DebugSymbols> | ||
<DebugType>full</DebugType> | ||
<Optimize>false</Optimize> | ||
<OutputPath>bin\Debug\</OutputPath> | ||
<DefineConstants>DEBUG;TRACE</DefineConstants> | ||
<ErrorReport>prompt</ErrorReport> | ||
<WarningLevel>4</WarningLevel> | ||
</PropertyGroup> | ||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' "> | ||
<DebugType>pdbonly</DebugType> | ||
<Optimize>true</Optimize> | ||
<OutputPath>bin\Release\</OutputPath> | ||
<DefineConstants>TRACE</DefineConstants> | ||
<ErrorReport>prompt</ErrorReport> | ||
<WarningLevel>4</WarningLevel> | ||
</PropertyGroup> | ||
<PropertyGroup> | ||
<EqmProjectPath Condition="Exists('..\MAC_use_cases\MAC_use_cases.csproj')">..\MAC_use_cases\MAC_use_cases.csproj</EqmProjectPath> | ||
<EqmProjectPath Condition="Exists('..\MAC_use_cases.csproj')">..\MAC_use_cases.csproj</EqmProjectPath> | ||
</PropertyGroup> | ||
|
||
<ItemGroup> | ||
<Reference Include="System"/> | ||
|
||
<Reference Include="System.Core"/> | ||
<Reference Include="System.Xml.Linq"/> | ||
<Reference Include="System.Data.DataSetExtensions"/> | ||
|
||
|
||
<Reference Include="Microsoft.CSharp"/> | ||
|
||
<Reference Include="System.Data"/> | ||
<Reference Include="System.Xml"/> | ||
</ItemGroup> | ||
<ItemGroup> | ||
<Compile Include="Properties\AssemblyInfo.cs" /> | ||
</ItemGroup> | ||
|
||
<ItemGroup> | ||
<EmbeddedResource Include="..\MAC_use_cases\Resources\**\*.xaml" Link="Resources\%(RecursiveDir)%(Filename)%(Extension)" CopyToOutputDirectory="Copy always" /> | ||
<EmbeddedResource Include="..\MAC_use_cases\TiaImports\**\*.zip" Link="Resources\%(RecursiveDir)%(Filename)%(Extension)" CopyToOutputDirectory="Copy always" /> | ||
</ItemGroup> | ||
|
||
<ItemGroup> | ||
<Compile Include="..\MAC_use_cases\TiaImports\CustomClasses\**\*.cs" Link="CustomClasses\%(RecursiveDir)%(Filename)%(Extension)" /> | ||
<Compile Include="..\MAC_use_cases\TiaImports\GeneratedClasses\**\*.cs" Link="GeneratedClasses\%(RecursiveDir)%(Filename)%(Extension)" /> | ||
<Compile Include="BUILDER.TESTS\MAC_use_casesBuilderTests.cs" /> | ||
<Compile Include="BUILDER.TESTS\GenerateTiaPortalTest.cs" /> | ||
<Compile Include="TESTENVIRONMENT\MacGenerationTestBaseMAC_use_cases.cs" /> | ||
<Compile Include="TESTENVIRONMENT\MacFunctionTestBaseMAC_use_cases.cs" /> | ||
</ItemGroup> | ||
|
||
<ItemGroup> | ||
<None Remove="Resources\BaseTestProject.zap19" /> | ||
<None Include="Siemens.ModularApplicationCreator.Testenvironment_Documentation_V1.0.pdf" /> | ||
<None Include="App.config" /> | ||
</ItemGroup> | ||
|
||
<ItemGroup> | ||
<PackageReference Include="Siemens.ModularApplicationCreator-V19.2.10.TestEnvironment" Version="1.0.1.207" /> | ||
<PackageReference Include="StrongNamer" Version="0.2.5" /> | ||
</ItemGroup> | ||
|
||
<ItemGroup> | ||
<ProjectReference Include="$(EqmProjectPath)" /> | ||
</ItemGroup> | ||
|
||
<ItemGroup> | ||
<EmbeddedResource Include="Resources\MacTestenvironmentBaseProject.zap19" /> | ||
</ItemGroup> | ||
|
||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" /> | ||
|
||
|
||
<Target Name="StoreOriginalReferencePath" BeforeTargets="ModifyReferencePathForStrongNamer"> | ||
<ItemGroup> | ||
<OriginalReferencePath Include="@(ReferencePath)" /> | ||
</ItemGroup> | ||
</Target> | ||
|
||
<Target Name="ModifyReferencePathForStrongNamer" BeforeTargets="StrongNamerTarget"> | ||
<PropertyGroup> | ||
<EqmBinDllPath Condition="Exists('$(SolutionDir)MAC_use_cases\MAC_use_cases.csproj')">$(SolutionDir)MAC_use_cases\bin\$(Configuration)\MAC_use_cases.dll</EqmBinDllPath> | ||
<EqmBinDllPath Condition="Exists('$(SolutionDir)MAC_use_cases.csproj')">$(SolutionDir)bin\$(Configuration)\MAC_use_cases.dll</EqmBinDllPath> | ||
</PropertyGroup> | ||
<!-- Redefine ReferencePath excluding the specific reference --> | ||
<ItemGroup> | ||
<DllReferencesFromOtherProject Include="@(Reference)" Condition="'%(Reference.HintPath)' != '' | ||
And !$([System.String]::Copy('%(Reference.HintPath)').Contains('ben.demystifier')) | ||
And !$([System.String]::Copy('%(Reference.HintPath)').Contains('system')) | ||
And !$([System.String]::Copy('%(Reference.HintPath)').Contains('siemens.collaboration')) | ||
And !$([System.String]::Copy('%(Reference.HintPath)').Contains('siemens.modularapplicationcreator')) | ||
And !$([System.String]::Copy('%(Reference.HintPath)').Contains('castle.core')) | ||
And !$([System.String]::Copy('%(Reference.HintPath)').Contains('microsoft.bcl.asyncinterfaces')) | ||
And !$([System.String]::Copy('%(Reference.HintPath)').Contains('nunit'))"/> | ||
<ReferencePath Remove="$(EqmBinDllPath)" /> | ||
<ReferencePath Remove="@(DllReferencesFromOtherProject)" /> | ||
</ItemGroup> | ||
<!-- Output the modified reference path --> | ||
<Message Text="Modified ReferencePath: @(ReferencePath)" Importance="high" /> | ||
</Target> | ||
|
||
<Target Name="RestoreOriginalReferencePath" AfterTargets="StrongNamerTarget"> | ||
<ItemGroup> | ||
<ReferencePath Include="@(OriginalReferencePath)" /> | ||
</ItemGroup> | ||
<Message Text="Restored ReferencePath: @(ReferencePath)" Importance="high" /> | ||
</Target> | ||
|
||
<Target Name="UpdateAppConfig" AfterTargets="Build"> | ||
<ItemGroup> | ||
<Assemblies Include="$(OutputPath)Siemens.Automation.ModAppCreator.Core.dll" /> | ||
</ItemGroup> | ||
|
||
<GetAssemblyIdentity AssemblyFiles="@(Assemblies)"> | ||
<Output TaskParameter="Assemblies" ItemName="AssemblyIdentities" /> | ||
</GetAssemblyIdentity> | ||
|
||
<ReplaceFileText | ||
Filename="App.config" | ||
NewAssemblyVersion="@(AssemblyIdentities->'%(Version)')" /> | ||
</Target> | ||
|
||
<UsingTask TaskName="ReplaceFileText" TaskFactory="RoslynCodeTaskFactory" AssemblyFile="$(MSBuildToolsPath)\Microsoft.Build.Tasks.Core.dll"> | ||
<ParameterGroup> | ||
<Filename ParameterType="System.String" Required="true" /> | ||
<NewAssemblyVersion ParameterType="System.String" Required="true" /> | ||
</ParameterGroup> | ||
<Task> | ||
<Using Namespace="System" /> | ||
<Using Namespace="System.IO" /> | ||
<Using Namespace="System.Text.RegularExpressions" /> | ||
<Code Type="Fragment" Language="cs"> | ||
<![CDATA[ | ||
File.WriteAllText( | ||
Filename, | ||
Regex.Replace(File.ReadAllText(Filename), "(?<=<assemblyIdentity name=\"Siemens\\.Automation\\.ModAppCreator\\.Core\"[^>]*>\\s*<bindingRedirect[^>]*newVersion=\")[^\"]*", NewAssemblyVersion) | ||
); | ||
File.WriteAllText( | ||
Filename, | ||
Regex.Replace(File.ReadAllText(Filename), "(?<=<assemblyIdentity name=\"Siemens\\.Automation\\.ModAppCreator\\.Basics\"[^>]*>\\s*<bindingRedirect[^>]*newVersion=\")[^\"]*", NewAssemblyVersion) | ||
); | ||
]]> | ||
</Code> | ||
</Task> | ||
</UsingTask> | ||
|
||
</Project> |
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,36 @@ | ||
using System.Reflection; | ||
using System.Runtime.CompilerServices; | ||
using System.Runtime.InteropServices; | ||
|
||
// General Information about an assembly is controlled through the following | ||
// set of attributes. Change these attribute values to modify the information | ||
// associated with an assembly. | ||
[assembly: AssemblyTitle("Module.Tests")] | ||
[assembly: AssemblyDescription("")] | ||
[assembly: AssemblyConfiguration("")] | ||
[assembly: AssemblyCompany("Siemens AG")] | ||
[assembly: AssemblyProduct("Module.Tests")] | ||
[assembly: AssemblyCopyright("Copyright © Siemens AG 2024")] | ||
[assembly: AssemblyTrademark("")] | ||
[assembly: AssemblyCulture("")] | ||
|
||
// Setting ComVisible to false makes the types in this assembly not visible | ||
// to COM components. If you need to access a type in this assembly from | ||
// COM, set the ComVisible attribute to true on that type. | ||
[assembly: ComVisible(false)] | ||
|
||
// The following GUID is for the ID of the typelib if this project is exposed to COM | ||
[assembly: Guid("4c3974f2-4eff-4168-a68e-ec9e5caccda1")] | ||
|
||
// Version information for an assembly consists of the following four values: | ||
// | ||
// Major Version | ||
// Minor Version | ||
// Build Number | ||
// Revision | ||
// | ||
// You can specify all the values or you can default the Build and Revision Numbers | ||
// by using the '*' as shown below: | ||
// [assembly: AssemblyVersion("1.0.*")] | ||
[assembly: AssemblyVersion("1.0.0.0")] | ||
[assembly: AssemblyFileVersion("1.0.0.0")] |
Binary file not shown.
Binary file added
BIN
+918 KB
MAC_use_cases.Tests/Siemens.ModularApplicationCreator.Testenvironment_Documentation_V1.0.pdf
Binary file not shown.
40 changes: 40 additions & 0 deletions
40
MAC_use_cases.Tests/TestEnvironment/MacFunctionTestBaseMAC_use_cases.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,40 @@ | ||
using System.Reflection; | ||
|
||
using NUnit.Framework; | ||
|
||
using MAC_use_cases.Model; | ||
using MAC_use_cases.TiaImports; | ||
|
||
using Siemens.ModularApplicationCreator.Testenvironment; | ||
using Siemens.ModularApplicationCreator.Testenvironment.UnitTestBaseClasses.Enums; | ||
|
||
|
||
|
||
namespace MAC_use_cases.Tests.TestEnvironment | ||
{ | ||
public class MacFunctionTestBaseMAC_use_cases : MacFunctionTestBase<MAC_use_casesEM> | ||
{ | ||
[TearDown] | ||
public override void Teardown() | ||
{ | ||
} | ||
|
||
protected ResourceManagement ResourceManagement => this.Get( () => new ResourceManagement(), NunitTestContext.TestCase); | ||
|
||
protected override void InitializeModuleClassesForTesting() | ||
{ | ||
} | ||
|
||
|
||
protected override string DirectoryNameOfViewTestResources => | ||
this.Get(() => "MAC_use_cases.Tests.Resources"); | ||
|
||
protected override string NameOfTiaZapFileFromResources => this.Get(() => "MacTestenvironmentBaseProject.zap19"); | ||
protected override Assembly Assembly => this.Get(() => typeof(MacFunctionTestBaseMAC_use_cases).Assembly); | ||
|
||
protected override string PlcName => this.Get(() => "S7-1500/ET200MP station_1"); | ||
protected override string PlcCPUName => this.Get(() => "TestenvironmentPLC"); | ||
protected override string OrderNumberPLC => this.Get(() => ""); | ||
} | ||
|
||
} |
42 changes: 42 additions & 0 deletions
42
MAC_use_cases.Tests/TestEnvironment/MacGenerationTestBaseMAC_use_cases.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,42 @@ | ||
using System.IO; | ||
using System.Reflection; | ||
|
||
using NUnit.Framework; | ||
|
||
using MAC_use_cases.Model; | ||
|
||
using Siemens.Engineering; | ||
using Siemens.ModularApplicationCreator.Testenvironment; | ||
|
||
namespace MAC_use_cases.Tests.TestEnvironment | ||
{ | ||
public class MacGenerationTestBaseMAC_use_cases : MacGenerationTestBase<MAC_use_casesEM> | ||
{ | ||
[TearDown] | ||
public override void Teardown() | ||
{ | ||
} | ||
protected override void InitializeModuleClassesForTesting() | ||
{ | ||
} | ||
|
||
protected override string DirectoryNameOfViewTestResources => | ||
this.Get(() => "MAC_use_cases.Tests.Resources"); | ||
|
||
protected override string NameOfTiaZapFileFromResources => this.Get(() => "MacTestenvironmentBaseProject.zap19"); | ||
protected override Assembly Assembly => this.Get(() => typeof(MacGenerationTestBaseMAC_use_cases).Assembly); | ||
|
||
protected override string PlcName => this.Get(() => "S7-1500/ET200MP station_1"); | ||
protected override string PlcCPUName => this.Get(() => "TestenvironmentPLC"); | ||
protected override string OrderNumberPLC => this.Get(() => ""); | ||
|
||
|
||
protected void OpenProjectInNewTiaPortalWithUi() | ||
{ | ||
var projectPath = new FileInfo(ExistingProjectTemplate.ProjectPath); | ||
|
||
var newTiaPortal = new TiaPortal(TiaPortalMode.WithUserInterface); | ||
var project = newTiaPortal.Projects.Open(projectPath); | ||
} | ||
} | ||
} |
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