* Yavsc.sln:

* Web.csproj:
* TestAPI.csproj:
* YavscModel.csproj:
* Automate.cs:
* TaskOutput.cs:
* AssemblyInfo.cs:
* Service.cs:
* FinalStateException.cs:
* FrontOfficeController.cs:
* InvalidLetterException.cs:
* PriceOnItemCount.cs:

* TestAutomate.cs: Tests an Automate

* packages.config: using Machine.Specifications
This commit is contained in:
Paul Schneider 2015-07-17 05:07:05 +02:00
commit da90e2cb10
18 changed files with 377 additions and 79 deletions

9
TestAPI/ChangeLog Normal file
View file

@ -0,0 +1,9 @@
2015-07-17 Paul Schneider <paul@pschneider.fr>
* TestAPI.csproj:
* AssemblyInfo.cs:
* TestAutomate.cs: Tests an Automate
* packages.config: using Machine.Specifications

View file

@ -0,0 +1,47 @@
//
// AssemblyInfo.cs
//
// Author:
// Paul Schneider <paul@pschneider.fr>
//
// Copyright (c) 2015 GNU GPL
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Lesser General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
using System.Reflection;
using System.Runtime.CompilerServices;
// Information about this assembly is defined by the following attributes.
// Change them to the values specific to your project.
[assembly: AssemblyTitle ("TestAPI")]
[assembly: AssemblyDescription ("")]
[assembly: AssemblyConfiguration ("")]
[assembly: AssemblyCompany ("")]
[assembly: AssemblyProduct ("")]
[assembly: AssemblyCopyright ("GNU GPL")]
[assembly: AssemblyTrademark ("")]
[assembly: AssemblyCulture ("")]
// The assembly version has the format "{Major}.{Minor}.{Build}.{Revision}".
// The form "{Major}.{Minor}.*" will automatically update the build and revision,
// and "{Major}.{Minor}.{Build}.*" will update just the revision.
[assembly: AssemblyVersion ("1.0.*")]
// The following attributes are used to specify the signing key for the assembly,
// if desired. See the Mono documentation for more information about signing.
//[assembly: AssemblyDelaySign(false)]
//[assembly: AssemblyKeyFile("")]

73
TestAPI/TestAPI.csproj Normal file
View file

@ -0,0 +1,73 @@
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" ToolsVersion="4.0" 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>{42B77C89-BF6D-4DB1-8763-6197F4030A95}</ProjectGuid>
<OutputType>Library</OutputType>
<RootNamespace>TestAPI</RootNamespace>
<AssemblyName>TestAPI</AssemblyName>
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug</OutputPath>
<DefineConstants>DEBUG;</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<ConsolePause>false</ConsolePause>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>full</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release</OutputPath>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<ConsolePause>false</ConsolePause>
</PropertyGroup>
<ItemGroup>
<Reference Include="System" />
<Reference Include="Machine.Specifications">
<HintPath>..\packages\Machine.Specifications.0.9.3\lib\net45\Machine.Specifications.dll</HintPath>
</Reference>
<Reference Include="Machine.Specifications.Clr4">
<HintPath>..\packages\Machine.Specifications.0.9.3\lib\net45\Machine.Specifications.Clr4.dll</HintPath>
</Reference>
<Reference Include="Machine.Specifications.Runner.Utility">
<HintPath>..\packages\Machine.Specifications.Runner.Utility.0.9.0\lib\net45\Machine.Specifications.Runner.Utility.dll</HintPath>
</Reference>
<Reference Include="Spark">
<HintPath>..\packages\Spark.1.7.5.3\lib\NET45\Spark.dll</HintPath>
</Reference>
<Reference Include="Machine.Specifications.Reporting">
<HintPath>..\packages\Machine.Specifications.Reporting.0.9.0\lib\net45\Machine.Specifications.Reporting.dll</HintPath>
</Reference>
<Reference Include="Machine.Specifications.Reporting.Templates">
<HintPath>..\packages\Machine.Specifications.Reporting.0.9.0\lib\net45\Machine.Specifications.Reporting.Templates.dll</HintPath>
</Reference>
<Reference Include="Machine.Specifications.Should">
<HintPath>..\packages\Machine.Specifications.Should.0.7.2\lib\net45\Machine.Specifications.Should.dll</HintPath>
</Reference>
<Reference Include="nunit.framework, Version=2.6.3.0, Culture=neutral, PublicKeyToken=96d09a1eb7f44a77">
<Package>nunit</Package>
</Reference>
</ItemGroup>
<ItemGroup>
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="TestAutomate.cs" />
</ItemGroup>
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
<ItemGroup>
<ProjectReference Include="..\yavscModel\YavscModel.csproj">
<Project>{68F5B80A-616E-4C3C-91A0-828AA40000BD}</Project>
<Name>YavscModel</Name>
</ProjectReference>
</ItemGroup>
<ItemGroup>
<None Include="packages.config" />
</ItemGroup>
</Project>

67
TestAPI/TestAutomate.cs Normal file
View file

@ -0,0 +1,67 @@
//
// MyClass.cs
//
// Author:
// Paul Schneider <paul@pschneider.fr>
//
// Copyright (c) 2015 GNU GPL
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Lesser General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
using System;
using Machine.Specifications;
using Yavsc.Model.WorkFlow;
using NUnit.Framework;
namespace TestAPI
{
[Subject(typeof(Automate<int,int>),"simple automate")]
public class CreatingAnAutomate
{
static Automate<int,int> Subject;
/// <summary>
/// The context.
/// </summary>
Establish context = () =>
{
// ... any mocking, stubbing, or other setup ...
Subject = new Automate<int,int>();
};
Because of = () => Subject.AddTransition(0,1,'a');
/// <summary>
/// The should be in state 0.
/// </summary>
It should_be_in_state_0 = () => Subject.State.ShouldEqual(0);
/// <summary>
/// The should not be in state 1.
/// </summary>
It should_not_be_in_state_1 = () => Subject.State.ShouldNotEqual(1);
/// <summary>
/// The state of the should not indicate o as final.
/// </summary>
It should_not_indicate_O_as_final_state = () => Subject.IsInFinalState().ShouldNotEqual(true);
[Test]
public void DoTheTest()
{
context.Invoke ();
of.Invoke ();
should_be_in_state_0.Invoke ();
should_not_be_in_state_1.Invoke ();
should_not_indicate_O_as_final_state.Invoke ();
}
}
}

8
TestAPI/packages.config Normal file
View file

@ -0,0 +1,8 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="Machine.Specifications" version="0.9.3" targetFramework="net45" />
<package id="Machine.Specifications.Reporting" version="0.9.0" targetFramework="net45" />
<package id="Machine.Specifications.Runner.Utility" version="0.9.0" targetFramework="net45" />
<package id="Machine.Specifications.Should" version="0.7.2" targetFramework="net45" />
<package id="Spark" version="1.7.5.3" targetFramework="net45" />
</packages>