initialize
This commit is contained in:
@@ -0,0 +1,31 @@
|
||||
using System.Diagnostics;
|
||||
using com.itac.mes.imsapi.domain.container;
|
||||
using ItacMesToolsTestProject;
|
||||
using Microsoft.VisualStudio.TestTools.UnitTesting;
|
||||
|
||||
namespace com.itac.mes.imsapi.client.dotnet
|
||||
{
|
||||
|
||||
[TestClass]
|
||||
public class ImsApiProxyTest
|
||||
{
|
||||
|
||||
[TestMethod]
|
||||
public void shouldCallInit()
|
||||
{
|
||||
//
|
||||
IIMSApiDotNet apiDelegate = new ImsapiHandler();
|
||||
ImsApiProxy proxy = new ImsApiProxy(apiDelegate);
|
||||
|
||||
IIMSApiDotNet imsApiMock = (IIMSApiDotNet)proxy.GetTransparentProxy();
|
||||
|
||||
string[] stationResultUploadKeys = new string[] { "Key1", "Key2" };
|
||||
|
||||
string[] stationResultUploadValues = new string[] { "val1", "val2", "val3", "val4" };
|
||||
string[] stationResultValues = null;
|
||||
int i = imsApiMock.trUploadStationResult(new IMSApiSessionContextStruct(), "station", "part", 0, "bomIndex", "bomVErsionErp", "workorder", -1, 0, stationResultUploadKeys, stationResultUploadValues, out stationResultValues);
|
||||
|
||||
Debug.WriteLine(stationResultValues.Length);
|
||||
}
|
||||
}
|
||||
}
|
||||
1661
interface/asm/dotnet/tests/ItacMesToolsTestProject/ImsapiHandler.cs
Normal file
1661
interface/asm/dotnet/tests/ItacMesToolsTestProject/ImsapiHandler.cs
Normal file
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,100 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="14.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<PropertyGroup>
|
||||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
||||
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
|
||||
<ProjectGuid>{075B739C-8C46-4FBD-8FB9-6CF826BD64AE}</ProjectGuid>
|
||||
<OutputType>Library</OutputType>
|
||||
<AppDesignerFolder>Properties</AppDesignerFolder>
|
||||
<RootNamespace>ItacMesToolsTestProject</RootNamespace>
|
||||
<AssemblyName>ItacMesToolsTestProject</AssemblyName>
|
||||
<TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
|
||||
<FileAlignment>512</FileAlignment>
|
||||
<ProjectTypeGuids>{3AC096D0-A1C2-E12C-1390-A8335801FDAB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
|
||||
<VisualStudioVersion Condition="'$(VisualStudioVersion)' == ''">10.0</VisualStudioVersion>
|
||||
<VSToolsPath Condition="'$(VSToolsPath)' == ''">$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)</VSToolsPath>
|
||||
<ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\$(VisualStudioVersion)\UITestExtensionPackages</ReferencePath>
|
||||
<IsCodedUITest>False</IsCodedUITest>
|
||||
<TestProjectType>UnitTest</TestProjectType>
|
||||
<TargetFrameworkProfile />
|
||||
</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>
|
||||
<PlatformTarget>x86</PlatformTarget>
|
||||
</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>
|
||||
<ItemGroup>
|
||||
<Reference Include="IMSApiDotNet, Version=9.1.0.3, Culture=neutral, processorArchitecture=MSIL">
|
||||
<SpecificVersion>False</SpecificVersion>
|
||||
<HintPath>..\..\libs\itac\IMSApiDotNet.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="System" />
|
||||
</ItemGroup>
|
||||
<Choose>
|
||||
<When Condition="('$(VisualStudioVersion)' == '10.0' or '$(VisualStudioVersion)' == '') and '$(TargetFrameworkVersion)' == 'v3.5'">
|
||||
<ItemGroup>
|
||||
<Reference Include="Microsoft.VisualStudio.QualityTools.UnitTestFramework, Version=10.1.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL" />
|
||||
</ItemGroup>
|
||||
</When>
|
||||
<Otherwise>
|
||||
<ItemGroup>
|
||||
<Reference Include="Microsoft.VisualStudio.QualityTools.UnitTestFramework" />
|
||||
</ItemGroup>
|
||||
</Otherwise>
|
||||
</Choose>
|
||||
<ItemGroup>
|
||||
<Compile Include="ImsapiHandler.cs" />
|
||||
<Compile Include="ImsApiProxyTest.cs" />
|
||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\..\ItacTools\ItacTools.csproj">
|
||||
<Project>{db6626c3-81a3-49f4-9117-b20c9b87a2c4}</Project>
|
||||
<Name>ItacTools</Name>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\..\MesTools\ItacMesTools.csproj">
|
||||
<Project>{886DE482-89C0-4F56-B699-27C63F8255D5}</Project>
|
||||
<Name>ItacMesTools</Name>
|
||||
</ProjectReference>
|
||||
</ItemGroup>
|
||||
<Choose>
|
||||
<When Condition="'$(VisualStudioVersion)' == '10.0' And '$(IsCodedUITest)' == 'True'">
|
||||
<ItemGroup>
|
||||
<Reference Include="Microsoft.VisualStudio.QualityTools.CodedUITestFramework, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
|
||||
<Private>False</Private>
|
||||
</Reference>
|
||||
<Reference Include="Microsoft.VisualStudio.TestTools.UITest.Common, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
|
||||
<Private>False</Private>
|
||||
</Reference>
|
||||
<Reference Include="Microsoft.VisualStudio.TestTools.UITest.Extension, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
|
||||
<Private>False</Private>
|
||||
</Reference>
|
||||
<Reference Include="Microsoft.VisualStudio.TestTools.UITesting, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
|
||||
<Private>False</Private>
|
||||
</Reference>
|
||||
</ItemGroup>
|
||||
</When>
|
||||
</Choose>
|
||||
<Import Project="$(VSToolsPath)\TeamTest\Microsoft.TestTools.targets" Condition="Exists('$(VSToolsPath)\TeamTest\Microsoft.TestTools.targets')" />
|
||||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
||||
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
|
||||
Other similar extension points exist, see Microsoft.Common.targets.
|
||||
<Target Name="BeforeBuild">
|
||||
</Target>
|
||||
<Target Name="AfterBuild">
|
||||
</Target>
|
||||
-->
|
||||
</Project>
|
||||
@@ -0,0 +1,36 @@
|
||||
using System.Reflection;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
// Allgemeine Informationen über eine Assembly werden über folgende
|
||||
// Attribute gesteuert. Ändern Sie diese Attributwerte, um die Informationen zu ändern,
|
||||
// die einer Assembly zugeordnet sind.
|
||||
[assembly: AssemblyTitle("ItacMesToolsTestProject")]
|
||||
[assembly: AssemblyDescription("")]
|
||||
[assembly: AssemblyConfiguration("")]
|
||||
[assembly: AssemblyCompany("")]
|
||||
[assembly: AssemblyProduct("ItacMesToolsTestProject")]
|
||||
[assembly: AssemblyCopyright("Copyright © 2018")]
|
||||
[assembly: AssemblyTrademark("")]
|
||||
[assembly: AssemblyCulture("")]
|
||||
|
||||
// Wenn ComVisible auf "false" festgelegt wird, sind die Typen innerhalb dieser Assembly
|
||||
// für COM-Komponenten unsichtbar. Wenn Sie auf einen Typ in dieser Assembly von
|
||||
// COM aus zugreifen müssen, sollten Sie das ComVisible-Attribut für diesen Typ auf "True" festlegen.
|
||||
[assembly: ComVisible(false)]
|
||||
|
||||
// Die folgende GUID bestimmt die ID der Typbibliothek, wenn dieses Projekt für COM verfügbar gemacht wird
|
||||
[assembly: Guid("075b739c-8c46-4fbd-8fb9-6cf826bd64ae")]
|
||||
|
||||
// Versionsinformationen für eine Assembly bestehen aus den folgenden vier Werten:
|
||||
//
|
||||
// Hauptversion
|
||||
// Nebenversion
|
||||
// Buildnummer
|
||||
// Revision
|
||||
//
|
||||
// Sie können alle Werte angeben oder die standardmäßigen Build- und Revisionsnummern
|
||||
// übernehmen, indem Sie "*" eingeben:
|
||||
// [Assembly: AssemblyVersion("1.0.*")]
|
||||
[assembly: AssemblyVersion("1.0.0.0")]
|
||||
[assembly: AssemblyFileVersion("1.0.0.0")]
|
||||
Binary file not shown.
@@ -0,0 +1,36 @@
|
||||
using System.Reflection;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
// Allgemeine Informationen über eine Assembly werden über folgende
|
||||
// Attribute gesteuert. Ändern Sie diese Attributwerte, um die Informationen zu ändern,
|
||||
// die einer Assembly zugeordnet sind.
|
||||
[assembly: AssemblyTitle("SimmApplication3xTests")]
|
||||
[assembly: AssemblyDescription("")]
|
||||
[assembly: AssemblyConfiguration("")]
|
||||
[assembly: AssemblyCompany("")]
|
||||
[assembly: AssemblyProduct("SimmApplication3xTests")]
|
||||
[assembly: AssemblyCopyright("Copyright © 2018")]
|
||||
[assembly: AssemblyTrademark("")]
|
||||
[assembly: AssemblyCulture("")]
|
||||
|
||||
// Wenn ComVisible auf "false" festgelegt wird, sind die Typen innerhalb dieser Assembly
|
||||
// für COM-Komponenten unsichtbar. Wenn Sie auf einen Typ in dieser Assembly von
|
||||
// COM aus zugreifen müssen, sollten Sie das ComVisible-Attribut für diesen Typ auf "True" festlegen.
|
||||
[assembly: ComVisible(false)]
|
||||
|
||||
// Die folgende GUID bestimmt die ID der Typbibliothek, wenn dieses Projekt für COM verfügbar gemacht wird
|
||||
[assembly: Guid("be3744dd-8210-4764-a139-4721070a582b")]
|
||||
|
||||
// Versionsinformationen für eine Assembly bestehen aus den folgenden vier Werten:
|
||||
//
|
||||
// Hauptversion
|
||||
// Nebenversion
|
||||
// Buildnummer
|
||||
// Revision
|
||||
//
|
||||
// Sie können alle Werte angeben oder die standardmäßigen Build- und Revisionsnummern
|
||||
// übernehmen, indem Sie "*" eingeben:
|
||||
// [Assembly: AssemblyVersion("1.0.*")]
|
||||
[assembly: AssemblyVersion("1.0.0.0")]
|
||||
[assembly: AssemblyFileVersion("1.0.0.0")]
|
||||
@@ -0,0 +1,327 @@
|
||||
using Microsoft.VisualStudio.TestTools.UnitTesting;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using www.siplace.com.OIB._2008._05.SetupCenter.Contracts.Data;
|
||||
using System.Globalization;
|
||||
using com.itac.mes.simm;
|
||||
using com.itac.mes.imsapi;
|
||||
using System.Runtime.Remoting.Proxies;
|
||||
using System.Runtime.Remoting.Messaging;
|
||||
using com.itac.mes.imsapi.domain.container;
|
||||
using com.itac.mes.imsapi.data;
|
||||
using com.itac.mes.imsapi.client.dotnet;
|
||||
|
||||
namespace Itac.Oib.Simm.Tests
|
||||
{
|
||||
|
||||
public class ImsApiMock : RealProxy
|
||||
{
|
||||
|
||||
public ImsApiMock() : base(typeof(IIMSApiDotNet)) { }
|
||||
|
||||
private Dictionary<string, int> callCountDictionary = new Dictionary<string, int>();
|
||||
|
||||
|
||||
public override IMessage Invoke(IMessage message)
|
||||
{
|
||||
// start der Methode
|
||||
IMethodCallMessage methodMsg = (IMethodCallMessage)message;
|
||||
|
||||
if (!callCountDictionary.ContainsKey(methodMsg.MethodName))
|
||||
{
|
||||
callCountDictionary.Add(methodMsg.MethodName, 1);
|
||||
}
|
||||
else
|
||||
{
|
||||
callCountDictionary.Add(methodMsg.MethodName, callCountDictionary[methodMsg.MethodName] + 1);
|
||||
}
|
||||
|
||||
object[] args = methodMsg.Args;
|
||||
object returnValue = null;
|
||||
if (methodMsg.MethodName.Equals("mlGetMaterialBinData"))
|
||||
{
|
||||
KeyValue callParam = ((KeyValue[])args[2])[0];
|
||||
// Keys = "MATERIAL_BIN_NUMBER", "EXPIRATION_DATE", "MATERIAL_BIN_STATE", "MSL_STATE", "MSL_LEVEL", "MSL_DRY_END_DATE", "MSL_OPEN_DATE", "MATERIAL_BIN_QTY_ACTUAL"
|
||||
|
||||
if (callParam.value.Equals("000608"))
|
||||
{
|
||||
args[5] = new String[] { "000608", "32535212399000", "R", "C", "2a", "", "", "10.0" };
|
||||
}
|
||||
else if (callParam.value.Equals("000609"))
|
||||
{
|
||||
args[5] = new String[] { "000609", "0", "R", "O", "2a", "", "", "10.0" };
|
||||
}
|
||||
else if (callParam.value.Equals("000610"))
|
||||
{
|
||||
// expiration 2032.12.31
|
||||
args[5] = new String[] { "000610", "1988060400000", "R", "O", "2a", "", "", "10.0" };
|
||||
}
|
||||
}
|
||||
returnValue = 0;//
|
||||
return new ReturnMessage(returnValue, args, 0, methodMsg.LogicalCallContext, methodMsg);
|
||||
}
|
||||
|
||||
public int getCallCount(string methodName)
|
||||
{
|
||||
if (!callCountDictionary.ContainsKey(methodName)) { return 0; }
|
||||
return callCountDictionary[methodName];
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
[TestClass()]
|
||||
public class SetupCenterExternalControlReceiverTests
|
||||
{
|
||||
[TestMethod()]
|
||||
public void GetNewPackagingUnitDataTest()
|
||||
{
|
||||
PackagingUnit pu = new PackagingUnit();
|
||||
pu.UID = "outer";
|
||||
pu.SplicedPackagingUnit = new PackagingUnit();
|
||||
pu.SplicedPackagingUnit.UID = "spliced";
|
||||
|
||||
PackagingUnit spliced = pu.SplicedPackagingUnit;
|
||||
spliced.SplicedPackagingUnit = new PackagingUnit();
|
||||
spliced.SplicedPackagingUnit.UID = "last";
|
||||
|
||||
Dictionary<string, PackagingUnit> packagingUnitMap = new Dictionary<string, PackagingUnit>();
|
||||
|
||||
SetupCenterExternalControlReceiver testee = new SetupCenterExternalControlReceiver(null, null, null, "", 201, ConfigCode.SIMM, ConfigCode.OFF, ConfigCode.OFF);
|
||||
testee.deepAddUnit(pu, ref packagingUnitMap);
|
||||
|
||||
Assert.IsTrue(packagingUnitMap.ContainsKey("spliced"));
|
||||
Assert.IsTrue(packagingUnitMap.ContainsKey("last"));
|
||||
Assert.IsTrue(packagingUnitMap.ContainsKey("outer"));
|
||||
}
|
||||
|
||||
[TestMethod()]
|
||||
public void shouldMapValues()
|
||||
{
|
||||
PackagingUnit pu = new PackagingUnit();
|
||||
pu.UID = "outer";
|
||||
|
||||
string[] materialBinUploadKeys = new String[] { "ERROR_CODE", "MATERIAL_BIN_NUMBER" };
|
||||
string[] result = new string[20];
|
||||
SetupCenterExternalControlReceiver testee = new SetupCenterExternalControlReceiver(null, null, null, "", 201, ConfigCode.OFF, ConfigCode.OFF, ConfigCode.OFF);
|
||||
testee.mapValues(pu, materialBinUploadKeys, ref result, 2);
|
||||
|
||||
Assert.AreEqual("0", result[2]);
|
||||
Assert.AreEqual("outer", result[3]);
|
||||
}
|
||||
|
||||
[TestMethod()]
|
||||
public void shouldParseDoubleLanguageIndependent()
|
||||
{
|
||||
string v = "9950,0";
|
||||
v = v.Replace(",", ".");
|
||||
CultureInfo culture = CultureInfo.CreateSpecificCulture("en-US");
|
||||
Double d = Double.Parse(v, culture);
|
||||
Assert.AreEqual(9950.0, d);
|
||||
}
|
||||
|
||||
[TestMethod()]
|
||||
public void shouldReturnMaxDateString()
|
||||
{
|
||||
DateTime newDate = new DateTime(4000, 12, 3, 14, 23, 55, DateTimeKind.Utc);
|
||||
SetupCenterExternalControlReceiver testee = new SetupCenterExternalControlReceiver(null, null, null, "", 201, ConfigCode.OFF, ConfigCode.OFF, ConfigCode.OFF);
|
||||
Assert.AreEqual("32535212399000", testee.getImsApiDateString(newDate));
|
||||
}
|
||||
|
||||
[TestMethod()]
|
||||
public void shouldReturnMinDateString()
|
||||
{
|
||||
DateTime newDate = new DateTime(1969, 12, 3, 02, 23, 55, DateTimeKind.Utc);
|
||||
SetupCenterExternalControlReceiver testee = new SetupCenterExternalControlReceiver(null, null, null, "", 201, ConfigCode.OFF, ConfigCode.OFF, ConfigCode.OFF);
|
||||
Assert.AreEqual("0", testee.getImsApiDateString(newDate));
|
||||
}
|
||||
|
||||
|
||||
|
||||
[TestMethod()]
|
||||
public void shouldReturnCorrectDateString()
|
||||
{
|
||||
// Fri Nov 25 2016 10:46:25
|
||||
DateTime newDate = new DateTime(2016, 11, 25, 09, 46, 25, DateTimeKind.Utc);
|
||||
SetupCenterExternalControlReceiver testee = new SetupCenterExternalControlReceiver(null, null, null, "", 201, ConfigCode.OFF, ConfigCode.OFF, ConfigCode.OFF);
|
||||
Assert.AreEqual("1480067185000", testee.getImsApiDateString(newDate));
|
||||
}
|
||||
|
||||
[TestMethod()]
|
||||
public void shouldReturnClosedContainer()
|
||||
{
|
||||
//prepare
|
||||
PackagingUnit pu = new PackagingUnit();
|
||||
pu.UID = "000608";
|
||||
pu.ExpiryDate = DateTime.MinValue.ToUniversalTime();
|
||||
pu.ConsumptionDate = DateTime.MinValue.ToUniversalTime();
|
||||
pu.ManufacturerDate = DateTime.MinValue.ToUniversalTime();
|
||||
pu.LastProductionDate = DateTime.MinValue.ToUniversalTime();
|
||||
pu.MsdOpenDate = DateTime.MinValue.ToUniversalTime();
|
||||
|
||||
PackagingUnitLocation location = new PackagingUnitLocation();
|
||||
location.PackagingUnit = pu;
|
||||
|
||||
ImsApiMock proxy = new ImsApiMock();
|
||||
IIMSApiDotNet imsApiMock = (IIMSApiDotNet)proxy.GetTransparentProxy();
|
||||
|
||||
SetupCenterExternalControlReceiver testee = new SetupCenterExternalControlReceiver(null, imsApiMock, null, "", 201,
|
||||
ConfigCode.OFF, ConfigCode.OFF, ConfigCode.OFF);
|
||||
PackagingUnitLocation[] packagingUnitLocations = new PackagingUnitLocation[] { location };
|
||||
|
||||
// call
|
||||
ExternalControlResult[] result = testee.GetPackagingUnitControlStatus(packagingUnitLocations);
|
||||
|
||||
Assert.AreEqual(DateTime.MinValue, result[0].PackagingUnit.MsdOpenDate);
|
||||
}
|
||||
|
||||
[TestMethod()]
|
||||
public void shouldReturnOpenedContainer()
|
||||
{
|
||||
//prepare
|
||||
PackagingUnit pu = new PackagingUnit();
|
||||
pu.UID = "000609";
|
||||
pu.ExpiryDate = DateTime.MinValue.ToUniversalTime();
|
||||
pu.ConsumptionDate = DateTime.MinValue.ToUniversalTime();
|
||||
pu.ManufacturerDate = DateTime.MinValue.ToUniversalTime();
|
||||
pu.LastProductionDate = DateTime.MinValue.ToUniversalTime();
|
||||
pu.MsdOpenDate = DateTime.MinValue.ToUniversalTime();
|
||||
|
||||
PackagingUnitLocation location = new PackagingUnitLocation();
|
||||
location.PackagingUnit = pu;
|
||||
|
||||
ImsApiMock proxy = new ImsApiMock();
|
||||
IIMSApiDotNet imsApiMock = (IIMSApiDotNet)proxy.GetTransparentProxy();
|
||||
|
||||
SetupCenterExternalControlReceiver testee = new SetupCenterExternalControlReceiver(null, imsApiMock, null, "", 201,
|
||||
ConfigCode.OFF, ConfigCode.SIMM, ConfigCode.SIMM);
|
||||
PackagingUnitLocation[] packagingUnitLocations = new PackagingUnitLocation[] { location };
|
||||
|
||||
// call
|
||||
ExternalControlResult[] result = testee.GetPackagingUnitControlStatus(packagingUnitLocations);
|
||||
|
||||
Assert.AreEqual(DateTime.MinValue, result[0].PackagingUnit.MsdOpenDate);
|
||||
Assert.AreEqual(DateTime.MinValue, result[0].PackagingUnit.ExpiryDate);
|
||||
|
||||
// expected is no adjustment of the material bin data in the mes
|
||||
Assert.AreEqual(0, proxy.getCallCount("mlChangeMaterialBinData"));
|
||||
}
|
||||
|
||||
|
||||
[TestMethod()]
|
||||
public void shouldAdjustContainerExpirationInMES()
|
||||
{
|
||||
//prepare
|
||||
PackagingUnit pu = new PackagingUnit();
|
||||
pu.UID = "000610";
|
||||
pu.ExpiryDate = new DateTime(2000, 12, 31).ToUniversalTime();
|
||||
pu.ConsumptionDate = DateTime.MinValue.ToUniversalTime();
|
||||
pu.ManufacturerDate = DateTime.MinValue.ToUniversalTime();
|
||||
pu.LastProductionDate = DateTime.MinValue.ToUniversalTime();
|
||||
pu.MsdOpenDate = DateTime.MinValue.ToUniversalTime();
|
||||
|
||||
PackagingUnitLocation location = new PackagingUnitLocation();
|
||||
location.PackagingUnit = pu;
|
||||
|
||||
ImsApiMock proxy = new ImsApiMock();
|
||||
IIMSApiDotNet imsApiMock = (IIMSApiDotNet)proxy.GetTransparentProxy();
|
||||
|
||||
SetupCenterExternalControlReceiver testee = new SetupCenterExternalControlReceiver(null, imsApiMock, null, "", 201,
|
||||
ConfigCode.OFF, ConfigCode.SIMM, ConfigCode.SIMM);
|
||||
PackagingUnitLocation[] packagingUnitLocations = new PackagingUnitLocation[] { location };
|
||||
|
||||
// call
|
||||
ExternalControlResult[] result = testee.GetPackagingUnitControlStatus(packagingUnitLocations);
|
||||
|
||||
Assert.AreEqual(DateTime.MinValue, result[0].PackagingUnit.MsdOpenDate);
|
||||
|
||||
// expected is no adjustment of the material bin data in the mes
|
||||
Assert.AreEqual(1, proxy.getCallCount("mlChangeMaterialBinData"), "mlChangeMaterialBinData nicht aufgerufen");
|
||||
Assert.AreEqual(1, proxy.getCallCount("mslStopObjectExpiration"), "mslStopObjectExpiration nicht aufgerufen");
|
||||
}
|
||||
|
||||
|
||||
[TestMethod()]
|
||||
public void shouldNotTakeOverQuantity()
|
||||
{
|
||||
SetupCenterExternalControlReceiver testee = new SetupCenterExternalControlReceiver(null, null, null, "", 201, ConfigCode.OFF, ConfigCode.OFF, ConfigCode.OFF);
|
||||
|
||||
SmtContainer container = new SmtContainer();
|
||||
container.materialBinQuantityActual = 100;
|
||||
PackagingUnit packagingUnit = new PackagingUnit();
|
||||
packagingUnit.Quantity = 50;
|
||||
LinkedList<MaterialBinBooking> updateQtyList = new LinkedList<MaterialBinBooking>();
|
||||
testee.adjustQuantity(ConfigCode.OFF, ref container, ref packagingUnit, ref updateQtyList);
|
||||
|
||||
Assert.AreEqual(50, packagingUnit.Quantity);
|
||||
Assert.AreEqual(0, updateQtyList.Count);
|
||||
}
|
||||
|
||||
|
||||
/* [TestMethod()]
|
||||
public void shouldTakeOverMesExpiration()
|
||||
{
|
||||
SetupCenterExternalControlReceiver testee = new SetupCenterExternalControlReceiver(null, null, null, "", 201, ConfigCode.OFF, ConfigCode.OFF, ConfigCode.OFF);
|
||||
SmtContainer container = new SmtContainer();
|
||||
container.expirationDate = new DateTime(2017, 01, 14, 12, 34, 55, DateTimeKind.Utc);
|
||||
PackagingUnit packagingUnit = new PackagingUnit();
|
||||
packagingUnit.ExpiryDate = new DateTime(2012, 01, 14, 12, 34, 55, DateTimeKind.Utc);
|
||||
|
||||
LinkedList<MaterialBinBooking> updateQtyList = new LinkedList<MaterialBinBooking>();
|
||||
|
||||
Object p = new object()
|
||||
{ int mlChangeMaterialBinData(IMSApiSessionContextStruct sessionContext, string stationNumber, string materialBinNumber, KeyValue[] materialBinDataUploadValues)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
};
|
||||
|
||||
ExternalControlResult result = new ExternalControlResult();
|
||||
IIMSApi imsapi = (IIMSApi)p;
|
||||
testee.adjustExpiration(ConfigCode.MES, ref container, ref packagingUnit, ref imsapi, ref result);
|
||||
|
||||
Assert.AreEqual(2017, packagingUnit.ExpiryDate.Year);
|
||||
}
|
||||
*/
|
||||
/*
|
||||
[TestMethod()]
|
||||
public void shouldTakeOverQuantity()
|
||||
{
|
||||
SetupCenterExternalControlReceiver testee = new SetupCenterExternalControlReceiver(null, null, null, "", 201, ConfigCode.OFF, ConfigCode.OFF, ConfigCode.OFF);
|
||||
|
||||
SmtContainer container = new SmtContainer();
|
||||
container.materialBinQuantityActual = 100;
|
||||
PackagingUnit packagingUnit = new PackagingUnit();
|
||||
packagingUnit.Quantity = 50;
|
||||
LinkedList<MaterialBinBooking> updateQtyList = new LinkedList<MaterialBinBooking>();
|
||||
testee.adjustQuantity(ConfigCode.SIMM, ref container, ref packagingUnit, ref updateQtyList);
|
||||
|
||||
Assert.AreEqual(1, updateQtyList.Count);
|
||||
// mes setzt Gebinde auf Menge 50 (Menge der ASM-Pack-Unit
|
||||
Assert.AreEqual(50, updateQtyList.First.Value.materialBinQuantityActual);
|
||||
}
|
||||
|
||||
[TestMethod()]
|
||||
public void shouldNotTakeOverQuantity()
|
||||
{
|
||||
SetupCenterExternalControlReceiver testee = new SetupCenterExternalControlReceiver(null, null, null, "", 201, ConfigCode.OFF, ConfigCode.OFF, ConfigCode.OFF);
|
||||
|
||||
SmtContainer container = new SmtContainer();
|
||||
container.materialBinQuantityActual = 100;
|
||||
PackagingUnit packagingUnit = new PackagingUnit();
|
||||
packagingUnit.Quantity = 50;
|
||||
LinkedList<MaterialBinBooking> updateQtyList = new LinkedList<MaterialBinBooking>();
|
||||
testee.adjustQuantity(ConfigCode.OFF, ref container, ref packagingUnit, ref updateQtyList);
|
||||
|
||||
Assert.AreEqual(50, packagingUnit.Quantity);
|
||||
Assert.AreEqual(0, updateQtyList.Count);
|
||||
}
|
||||
*/
|
||||
|
||||
[TestMethod()]
|
||||
public void shouldAcceptAsSameExpirationDate()
|
||||
{
|
||||
SetupCenterExternalControlReceiver testee = new SetupCenterExternalControlReceiver(null, null, null, "", 201, ConfigCode.OFF, ConfigCode.OFF, ConfigCode.OFF);
|
||||
Assert.IsFalse(testee.expirationDateDifferent(new DateTime(3000, 12, 30, 4, 0, 0), new DateTime(3000, 12, 31, 0, 0, 0)));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,154 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="14.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<PropertyGroup>
|
||||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
||||
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
|
||||
<ProjectGuid>{BE3744DD-8210-4764-A139-4721070A582B}</ProjectGuid>
|
||||
<OutputType>Library</OutputType>
|
||||
<AppDesignerFolder>Properties</AppDesignerFolder>
|
||||
<RootNamespace>SimmApplication3xTests</RootNamespace>
|
||||
<AssemblyName>SimmApplication3xTests</AssemblyName>
|
||||
<TargetFrameworkVersion>v4.5.2</TargetFrameworkVersion>
|
||||
<FileAlignment>512</FileAlignment>
|
||||
<ProjectTypeGuids>{3AC096D0-A1C2-E12C-1390-A8335801FDAB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
|
||||
<VisualStudioVersion Condition="'$(VisualStudioVersion)' == ''">10.0</VisualStudioVersion>
|
||||
<VSToolsPath Condition="'$(VSToolsPath)' == ''">$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)</VSToolsPath>
|
||||
<ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\$(VisualStudioVersion)\UITestExtensionPackages</ReferencePath>
|
||||
<IsCodedUITest>False</IsCodedUITest>
|
||||
<TestProjectType>UnitTest</TestProjectType>
|
||||
</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>
|
||||
<PlatformTarget>x86</PlatformTarget>
|
||||
</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>
|
||||
<ItemGroup>
|
||||
<Reference Include="ASM.AS.OIB.Client">
|
||||
<HintPath>..\..\libs\asm3client\ASM.AS.OIB.Client.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="ASM.AS.OIB.Client.CustomExtensions">
|
||||
<HintPath>..\..\libs\asm3client\ASM.AS.OIB.Client.CustomExtensions.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Asm.As.Oib.Common">
|
||||
<HintPath>..\..\libs\oib3\Asm.As.Oib.Common.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Asm.As.Oib.Common.Proxy">
|
||||
<HintPath>..\..\libs\oib3\Asm.As.Oib.Common.Proxy.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="ASM.AS.OIB.DisplayService.Contracts">
|
||||
<HintPath>..\..\libs\oib3\ASM.AS.OIB.DisplayService.Contracts.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="ASM.AS.OIB.DisplayService.Proxy">
|
||||
<HintPath>..\..\libs\oib3\ASM.AS.OIB.DisplayService.Proxy.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Asm.As.Oib.Monitoring.Contracts">
|
||||
<HintPath>..\..\libs\oib3\Asm.As.Oib.Monitoring.Contracts.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Asm.As.Oib.Monitoring.Proxy">
|
||||
<HintPath>..\..\libs\oib3\Asm.As.Oib.Monitoring.Proxy.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Asm.As.Oib.SIPLACEPro.Contracts">
|
||||
<HintPath>..\..\libs\oib3\Asm.As.Oib.SIPLACEPro.Contracts.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Asm.As.Oib.SIPLACEPro.LineControl.Contracts">
|
||||
<HintPath>..\..\libs\oib3\Asm.As.Oib.SIPLACEPro.LineControl.Contracts.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Asm.As.Oib.SIPLACEPro.LineControl.Proxy">
|
||||
<HintPath>..\..\libs\oib3\Asm.As.Oib.SIPLACEPro.LineControl.Proxy.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Asm.As.Oib.SIPLACEPro.Proxy">
|
||||
<HintPath>..\..\libs\oib3\Asm.As.Oib.SIPLACEPro.Proxy.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Asm.As.Oib.SIPLACESetupCenter.Contracts">
|
||||
<HintPath>..\..\libs\oib3\Asm.As.Oib.SIPLACESetupCenter.Contracts.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Asm.As.Oib.SiplaceSetupCenter.Proxy">
|
||||
<HintPath>..\..\libs\oib3\Asm.As.Oib.SiplaceSetupCenter.Proxy.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Asm.As.Oib.WS.Common">
|
||||
<HintPath>..\..\libs\oib3\Asm.As.Oib.WS.Common.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Asm.As.Oib.WS.Eventing.Contracts">
|
||||
<HintPath>..\..\libs\oib3\Asm.As.Oib.WS.Eventing.Contracts.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="IMSApiDotNet">
|
||||
<HintPath>..\..\libs\itac\IMSApiDotNet.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="System" />
|
||||
</ItemGroup>
|
||||
<Choose>
|
||||
<When Condition="('$(VisualStudioVersion)' == '10.0' or '$(VisualStudioVersion)' == '') and '$(TargetFrameworkVersion)' == 'v3.5'">
|
||||
<ItemGroup>
|
||||
<Reference Include="Microsoft.VisualStudio.QualityTools.UnitTestFramework, Version=10.1.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL" />
|
||||
</ItemGroup>
|
||||
</When>
|
||||
<Otherwise>
|
||||
<ItemGroup>
|
||||
<Reference Include="Microsoft.VisualStudio.QualityTools.UnitTestFramework" />
|
||||
</ItemGroup>
|
||||
</Otherwise>
|
||||
</Choose>
|
||||
<ItemGroup>
|
||||
<Compile Include="SetupCenterExternalControlReceiverTests.cs" />
|
||||
<Compile Include="SmtContainerTests.cs" />
|
||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\..\AdapterApplication3x\AdapterApplication3x.csproj">
|
||||
<Project>{3fe6a508-3914-4a4b-bed7-86e130a2dfd4}</Project>
|
||||
<Name>AdapterApplication3x</Name>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\..\ItacTools\ItacTools.csproj">
|
||||
<Project>{db6626c3-81a3-49f4-9117-b20c9b87a2c4}</Project>
|
||||
<Name>ItacTools</Name>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\..\MesTools\ItacMesTools.csproj">
|
||||
<Project>{886de482-89c0-4f56-b699-27c63f8255d5}</Project>
|
||||
<Name>ItacMesTools</Name>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\..\SimmApplication3x\SimmApplication3x.csproj">
|
||||
<Project>{561159EC-A9B8-48C7-8FE2-09428C10D1F0}</Project>
|
||||
<Name>SimmApplication3x</Name>
|
||||
</ProjectReference>
|
||||
</ItemGroup>
|
||||
<Choose>
|
||||
<When Condition="'$(VisualStudioVersion)' == '10.0' And '$(IsCodedUITest)' == 'True'">
|
||||
<ItemGroup>
|
||||
<Reference Include="Microsoft.VisualStudio.QualityTools.CodedUITestFramework, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
|
||||
<Private>False</Private>
|
||||
</Reference>
|
||||
<Reference Include="Microsoft.VisualStudio.TestTools.UITest.Common, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
|
||||
<Private>False</Private>
|
||||
</Reference>
|
||||
<Reference Include="Microsoft.VisualStudio.TestTools.UITest.Extension, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
|
||||
<Private>False</Private>
|
||||
</Reference>
|
||||
<Reference Include="Microsoft.VisualStudio.TestTools.UITesting, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
|
||||
<Private>False</Private>
|
||||
</Reference>
|
||||
</ItemGroup>
|
||||
</When>
|
||||
</Choose>
|
||||
<Import Project="$(VSToolsPath)\TeamTest\Microsoft.TestTools.targets" Condition="Exists('$(VSToolsPath)\TeamTest\Microsoft.TestTools.targets')" />
|
||||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
||||
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
|
||||
Other similar extension points exist, see Microsoft.Common.targets.
|
||||
<Target Name="BeforeBuild">
|
||||
</Target>
|
||||
<Target Name="AfterBuild">
|
||||
</Target>
|
||||
-->
|
||||
</Project>
|
||||
@@ -0,0 +1,17 @@
|
||||
using Microsoft.VisualStudio.TestTools.UnitTesting;
|
||||
|
||||
namespace com.itac.mes.imsapi.data.Tests
|
||||
{
|
||||
[TestClass()]
|
||||
public class SmtContainerTests
|
||||
{
|
||||
[TestMethod()]
|
||||
public void CompareToTest()
|
||||
{
|
||||
|
||||
string[] resultValues = new string[] { "MATERIAL_BIN_NUMBER", "0000", "O", "O", "2a", "1234", "4567", "3000" };
|
||||
SmtContainer knownContainer = new ImsApiMapTool<SmtContainer>().getStruct(typeof(SmtContainer), SmtContainer.MINIMAL_INFORMATION, resultValues);
|
||||
Assert.AreEqual("MATERIAL_BIN_NUMBER", knownContainer.materialBinNumber);
|
||||
}
|
||||
}
|
||||
}
|
||||
Binary file not shown.
Reference in New Issue
Block a user