Code development platform for open source projects from the European Union institutions

Skip to content
Snippets Groups Projects
Commit 5bf88ad4 authored by Terry Burns's avatar Terry Burns Committed by Kostis ANAGNOSTOPOULOS
Browse files
parent 08aa4fa3
No related branches found
No related tags found
No related merge requests found
<Global.Microsoft.VisualBasic.CompilerServices.DesignerGenerated()> _
Partial Class F_PneumaticConsumers
Inherits System.Windows.Forms.Form
'Form overrides dispose to clean up the component list.
<System.Diagnostics.DebuggerNonUserCode()> _
Protected Overrides Sub Dispose(ByVal disposing As Boolean)
Try
If disposing AndAlso components IsNot Nothing Then
components.Dispose()
End If
Finally
MyBase.Dispose(disposing)
End Try
End Sub
'Required by the Windows Form Designer
Private components As System.ComponentModel.IContainer
'NOTE: The following procedure is required by the Windows Form Designer
'It can be modified using the Windows Form Designer.
'Do not modify it using the code editor.
<System.Diagnostics.DebuggerStepThrough()> _
Private Sub InitializeComponent()
Me.SuspendLayout()
'
'F_PneumaticConsumers
'
Me.AutoScaleDimensions = New System.Drawing.SizeF(6.0!, 13.0!)
Me.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font
Me.ClientSize = New System.Drawing.Size(483, 264)
Me.Name = "F_PneumaticConsumers"
Me.Text = "F_PneumaticConsumers"
Me.ResumeLayout(False)
End Sub
End Class
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
</root>
\ No newline at end of file
Public Class F_PneumaticConsumers
End Class
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<ClassDiagram />
\ No newline at end of file
Imports VectoAuxiliaries.Electrics
Namespace Mocks
Public Class AlternatorMock
Implements IAlternator
Private _gearPullyRatio As Single = 1
Private _gearPullyEfficiency As Single = 1
Public Property PulleyGearRatio() As Single Implements IAlternator.PulleyGearRatio
Get
Return _gearPullyRatio
End Get
Set(ByVal value As Single)
_gearPullyRatio = value
End Set
End Property
Public Property PulleyGearEfficiency() As Single Implements IAlternator.PulleyGearEfficiency
Get
Return _gearPullyEfficiency
End Get
Set(ByVal value As Single)
_gearPullyEfficiency = value
End Set
End Property
Public Function Initialise() As Boolean Implements IAlternator.Initialise
Return True
End Function
Public Function GetEfficiency(ByVal engineRpm As Single) As Single Implements IAlternator.GetEfficiency
Return 0.5
End Function
Public Function GetMaximumRegenerationPower(ByVal engineRpm As Single) As Single Implements IAlternator.GetMaximumRegenerationPower
Return 100
End Function
Public Function GetMaximumRegeneratinPowerAtCrank(ByVal engineRpm As Single) As Single Implements IAlternator.GetMaximumRegeneratinPowerAtCrank
Return 200
End Function
End Class
End Namespace

Imports VectoAuxiliaries.Electrics
Imports NUnit.Framework
Imports VectoAuxiliariesTests.Mocks
Namespace UnitTests
<TestFixture()>
Public Class AlternatorsRegenTests
#Region "Test Constants"
''' <summary>
''' Implemented range is [1.25 - 5.5]
''' </summary>
Const GoodRatio As Single = 3.0
''' <summary>
''' Implemented range is [1.25 - 5.5]
''' </summary>
Const TooLowRatio As Single = 0.0
Private Const TooHighRatio As Single = 6.0
''' <summary>
''' Implemented range is [0.25 - 0.95]
''' </summary>
Private Const GoodEfficiency As Single = 0.5
''' <summary>
''' Implemented range is [0.25 - 0.95]
''' </summary>
Private Const TooLowEfficiency As Single = 0
Private Const TooHighEfficiency As Single = 1
Private Function GetNonFailingMapMock() As IAlternatorMap
Return New AlternatorMapMock(False)
End Function
Private Function GetFailingMapMock() As IAlternatorMap
Return New AlternatorMapMock(True)
End Function
Private Function GetGoodAlternator() As Alternator
Dim value As Alternator = New Alternator(GetNonFailingMapMock(), GoodRatio, GoodEfficiency)
Return value
End Function
#End Region
<Test()>
Public Sub CreateNewAlternatorJustPathTest()
Dim target As Alternator = New Alternator(GetNonFailingMapMock())
Assert.IsNotNull(target)
End Sub
<Test()>
Public Sub CreateNewAlternatorAllParametersTest()
Dim target As Alternator = New Alternator(GetNonFailingMapMock(), GoodRatio, GoodEfficiency)
Assert.IsNotNull(target)
End Sub
<TestCase(TooLowRatio)> _
<TestCase(TooHighRatio)> _
<ExpectedException("System.ArgumentOutOfRangeException")>
Public Sub CreateNewAlternatorInvalidRatioTest(ByVal ratio As Single)
Dim target As Alternator = New Alternator(GetFailingMapMock(), ratio, GoodEfficiency)
End Sub
<TestCase(TooLowEfficiency)> _
<TestCase(TooHighEfficiency)> _
<ExpectedException("System.ArgumentOutOfRangeException")>
Public Sub CreateNewAlternatorInvalidEfficiencyTest(ByVal efficiency As Single)
Dim target As Alternator = New Alternator(GetNonFailingMapMock(), GoodRatio, efficiency)
End Sub
<Test()>
Public Sub InitialiseTest()
Dim target As Alternator = New Alternator(GetNonFailingMapMock())
Dim result As Boolean = target.Initialise()
Assert.IsTrue(result)
End Sub
<Test(), ExpectedException("System.ArgumentException")>
Public Sub InitialiseInvalidMapTest()
Dim target As Alternator = New Alternator(GetFailingMapMock())
Dim result As Boolean = target.Initialise()
End Sub
<Test()>
Public Sub GetEfficiencyTest()
Dim target As Alternator = GetGoodAlternator()
target.Initialise()
Dim expected As Single = 0.5
Dim actual As Single = target.GetEfficiency(100)
Assert.AreEqual(actual, expected)
End Sub
<Test()>
Public Sub GetMaximumRegenerationPowerTest()
Dim target As Alternator = GetGoodAlternator()
target.Initialise()
Dim expected As Single = 100
Dim actual As Single = target.GetMaximumRegenerationPower(500)
Assert.AreEqual(expected, actual)
End Sub
<Test()>
Public Sub GetMaximumRegeneratinPowerAtCrankTest()
'TODO: is a simple value returned, no exception test ok here, should we be checking specific values?
Dim target As Alternator = GetGoodAlternator()
target.Initialise()
Dim expected As Single = 100
Dim actual As Single = target.GetMaximumRegeneratinPowerAtCrank(500)
Assert.AreEqual(expected, actual)
End Sub
<Test()>
Public Sub SetGearRatioTest()
Dim target As Alternator = GetGoodAlternator()
Dim expected As Single = 1.25
target.PulleyGearRatio = expected
Dim actual As Single = target.PulleyGearRatio
Assert.AreEqual(actual, expected)
End Sub
<TestCase(TooLowRatio)> _
<TestCase(TooHighRatio)>
<ExpectedException("System.ArgumentOutOfRangeException")>
Public Sub SetGearRatioOutOfRange(ByVal ratio As Single)
Dim target As Alternator = New Alternator(GetNonFailingMapMock())
target.PulleyGearRatio = ratio
End Sub
<Test()>
Public Sub GetGearRatioTest()
Dim target As Alternator = New Alternator(GetNonFailingMapMock(), GoodRatio, GoodEfficiency)
Dim expected As Single = GoodRatio
Dim actual As Single = target.PulleyGearRatio
Assert.AreEqual(actual, expected)
End Sub
<Test()>
Public Sub SetGearEfficiencyTest()
Dim target As Alternator = GetGoodAlternator()
Dim expected As Single = GoodEfficiency
target.PulleyGearEfficiency = expected
Dim actual As Single = target.PulleyGearEfficiency
Assert.AreEqual(actual, expected)
End Sub
<TestCase(TooLowEfficiency)> _
<TestCase(TooHighEfficiency)> _
<ExpectedException("System.ArgumentOutOfRangeException")>
Public Sub SetGearEfficiencyTooHighTest(ByVal efficiency As Single)
Dim target As Alternator = New Alternator(GetNonFailingMapMock())
target.PulleyGearEfficiency = efficiency
End Sub
<Test()>
Public Sub GetGearEfficiencyTest()
Dim target As Alternator = New Alternator(GetNonFailingMapMock(), GoodRatio, GoodEfficiency)
Dim expected As Single = GoodEfficiency
Dim actual As Single = target.PulleyGearEfficiency
Assert.AreEqual(actual, expected)
End Sub
End Class
End Namespace
\ No newline at end of file
Imports VectoAuxiliaries.Electrics
Imports NUnit.Framework
Imports VectoAuxiliaries.Pneumatics
Namespace UnitTests
<TestFixture()>
Public Class PneumaticConsumerTests
#Region "Helpers"
Private Const GoodName As String = "Test"
Private Const GoodVolume As Single = 10.0
Private Const BadVolume As Single = 0.0
Private Const BadName As String = ""
Public Function GetGoodConsumer() As PneumaticConsumer
Return New PneumaticConsumer(GoodName, GoodVolume)
End Function
#End Region
<Test()>
Public Sub CreateNewTest()
Dim target As PneumaticConsumer = GetGoodConsumer()
Assert.IsNotNull(target)
End Sub
<Test(), ExpectedException("System.ArgumentException")>
Public Sub CreateNewInvalidNameTest()
Dim target As PneumaticConsumer = New PneumaticConsumer(BadName, GoodVolume)
End Sub
<Test(), ExpectedException("System.ArgumentOutOfRangeException")>
Public Sub CreateNewInvalidVolumeTest()
Dim target As PneumaticConsumer = New PneumaticConsumer(GoodName, BadVolume)
End Sub
<Test()>
Public Sub GetNameTest()
Dim target As PneumaticConsumer = GetGoodConsumer()
Dim expected As String = GoodName
Dim actual As String = target.Name
Assert.AreEqual(expected, actual)
End Sub
<Test()>
Public Sub GetTotalVolumeTest()
Dim target As PneumaticConsumer = GetGoodConsumer()
Dim expected As Single = GoodVolume * 50
Dim actual As Single = target.GetTotalVolume(50)
Assert.AreEqual(expected, actual)
End Sub
<Test()>
Public Sub GetVolumeTest()
Dim target As PneumaticConsumer = GetGoodConsumer()
Dim expected As Single = GoodVolume
Dim actual As Single = target.VolumePerCycle
Assert.AreEqual(expected, actual)
End Sub
End Class
End Namespace
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment