Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
113 changes: 113 additions & 0 deletions NETMFTesting/Marknic.TestRunner.Rigging/Assert.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,113 @@
using System;
using System.Collections;
using System.Reflection;
using Microsoft.SPOT;

// ==============================================================================================
// .NET MicroFramework TestRunner
//
// Author: Mark S. Nichols
//
// Copyright (c) 2013 Mark Nichols
//
// This source is subject to the Microsoft Permissive License.
// ==============================================================================================

namespace Marknic.TestRunner.Rigging
{
/// <summary>
/// Assertions for the test methods
/// </summary>
public static class Assert
{
public static void IsTrue(bool condition, string message)
{
if (!condition)
{
throw new Exception(message);
}
}

public static void IsFalse(bool condition, string message)
{
if (condition)
{
throw new Exception(message);
}
}

public static void IsTrue(bool condition)
{
if (!condition)
{
throw new Exception("Result should have been true - result was false");
}
}

public static void IsFalse(bool condition)
{
if (condition)
{
throw new Exception("Result should have been false - result was true");
}
}

public static void AreEqual(int expected, int actual)
{
if (expected != actual)
{
throw new Exception("Expected value: " + expected + " - Actual value: " + actual);
}
}

public static void AreEqual(long expected, long actual)
{
if (expected != actual)
{
throw new Exception("Expected value: " + expected + " - Actual value: " + actual);
}
}

public static void AreEqual(string expected, string actual)
{
if (expected != actual)
{
throw new Exception("Expected value: " + expected + " - Actual value: " + actual);
}
}

public static void IsNotNull(object actual)
{
if (actual == null)
{
throw new Exception("Object tested was null");
}
}

public static void IsNull(object actual)
{
if (actual != null)
{
throw new Exception("Object tested was not null");
}
}

public static void AreEqual(object expected, object actual)
{
if (expected == null)
{
throw new Exception("Expected object was null");
}

if (actual == null)
{
throw new Exception("actual object was null");
}

if (expected != actual)
{
throw new Exception("Objects are not the same: " + expected + " - Actual: " + actual);
}
}
}
}
Original file line number Diff line number Diff line change
@@ -1,51 +1,53 @@
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<AssemblyName>Marknic.TestRunner.Rigging</AssemblyName>
<OutputType>Library</OutputType>
<RootNamespace>Marknic.TestRunner.Rigging</RootNamespace>
<ProjectTypeGuids>{b69e3092-b931-443c-abe7-7e7b65f2a37f};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
<ProductVersion>9.0.21022</ProductVersion>
<SchemaVersion>2.0</SchemaVersion>
<ProjectGuid>{3B9F95F2-EACD-4609-A8FA-459A088C081D}</ProjectGuid>
<TargetFrameworkVersion>v4.2</TargetFrameworkVersion>
<NetMfTargetsBaseDir Condition="'$(NetMfTargetsBaseDir)'==''">$(MSBuildExtensionsPath32)\Microsoft\.NET Micro Framework\</NetMfTargetsBaseDir>
<SccProjectName>
</SccProjectName>
<SccLocalPath>
</SccLocalPath>
<SccAuxPath>
</SccAuxPath>
<SccProvider>
</SccProvider>
<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>
</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>
<Import Project="$(NetMfTargetsBaseDir)$(TargetFrameworkVersion)\CSharp.Targets" />
<ItemGroup>
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="Rigging.cs" />
<Compile Include="StringUtility.cs" />
</ItemGroup>
<ItemGroup>
<Reference Include="Microsoft.SPOT.Native">
</Reference>
<Reference Include="System" />
</ItemGroup>
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<AssemblyName>Marknic.TestRunner.Rigging</AssemblyName>
<OutputType>Library</OutputType>
<RootNamespace>Marknic.TestRunner.Rigging</RootNamespace>
<ProjectTypeGuids>{b69e3092-b931-443c-abe7-7e7b65f2a37f};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
<ProductVersion>9.0.21022</ProductVersion>
<SchemaVersion>2.0</SchemaVersion>
<ProjectGuid>{3B9F95F2-EACD-4609-A8FA-459A088C081D}</ProjectGuid>
<TargetFrameworkVersion>v4.2</TargetFrameworkVersion>
<NetMfTargetsBaseDir Condition="'$(NetMfTargetsBaseDir)'==''">$(MSBuildExtensionsPath32)\Microsoft\.NET Micro Framework\</NetMfTargetsBaseDir>
<SccProjectName>
</SccProjectName>
<SccLocalPath>
</SccLocalPath>
<SccAuxPath>
</SccAuxPath>
<SccProvider>
</SccProvider>
<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>
</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>
<Import Project="$(NetMfTargetsBaseDir)$(TargetFrameworkVersion)\CSharp.Targets" />
<ItemGroup>
<Compile Include="Assert.cs" />
<Compile Include="Result.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="Rigging.cs" />
<Compile Include="StringUtility.cs" />
</ItemGroup>
<ItemGroup>
<Reference Include="Microsoft.SPOT.Native">
</Reference>
<Reference Include="System" />
</ItemGroup>
</Project>
27 changes: 27 additions & 0 deletions NETMFTesting/Marknic.TestRunner.Rigging/Result.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
using System;
using System.Collections;
using System.Reflection;
using Microsoft.SPOT;

// ==============================================================================================
// .NET MicroFramework TestRunner
//
// Author: Mark S. Nichols
//
// Copyright (c) 2013 Mark Nichols
//
// This source is subject to the Microsoft Permissive License.
// ==============================================================================================

namespace Marknic.TestRunner.Rigging
{
/// <summary>
/// Tracking object for each test
/// </summary>
public class Result
{
public string MethodName { get; set; }
public bool Succeeded { get; set; }
public Exception Exception { get; set; }
}
}
Loading