aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'AirPollutionWebApi.Tests')
-rw-r--r--AirPollutionWebApi.Tests/AirPollutionWebApi.Tests.csproj91
-rw-r--r--AirPollutionWebApi.Tests/Controllers/HomeControllerTest.cs35
-rw-r--r--AirPollutionWebApi.Tests/packages.config13
3 files changed, 139 insertions, 0 deletions
diff --git a/AirPollutionWebApi.Tests/AirPollutionWebApi.Tests.csproj b/AirPollutionWebApi.Tests/AirPollutionWebApi.Tests.csproj
new file mode 100644
index 0000000..a3f8082
--- /dev/null
+++ b/AirPollutionWebApi.Tests/AirPollutionWebApi.Tests.csproj
@@ -0,0 +1,91 @@
+<?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>
+ <ProjectGuid>{803677F8-DC3E-47DA-8E66-BE10F4F47E3A}</ProjectGuid>
+ <OutputType>Library</OutputType>
+ <RootNamespace>AirPollutionWebApi.Tests</RootNamespace>
+ <AssemblyName>AirPollutionWebApi.Tests</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>
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+ <Optimize>true</Optimize>
+ <OutputPath>bin\Release</OutputPath>
+ <ErrorReport>prompt</ErrorReport>
+ <WarningLevel>4</WarningLevel>
+ </PropertyGroup>
+ <ItemGroup>
+ <Reference Include="System" />
+ <Reference Include="System.Web" />
+ <Reference Include="System.Xml" />
+ <Reference Include="System.Core" />
+ <Reference Include="System.Web.Services" />
+ <Reference Include="System.Web.Routing" />
+ <Reference Include="System.Web.Extensions" />
+ <Reference Include="System.Web.Abstractions" />
+ <Reference Include="System.Web.DynamicData" />
+ <Reference Include="System.ComponentModel.DataAnnotations" />
+ <Reference Include="System.Xml.Linq" />
+ <Reference Include="Microsoft.CSharp" />
+ <Reference Include="System.Web.Razor">
+ <HintPath>..\packages\Microsoft.AspNet.Razor.3.2.3\lib\net45\System.Web.Razor.dll</HintPath>
+ </Reference>
+ <Reference Include="Microsoft.Web.Infrastructure">
+ <HintPath>..\packages\Microsoft.Web.Infrastructure.1.0.0.0\lib\net40\Microsoft.Web.Infrastructure.dll</HintPath>
+ </Reference>
+ <Reference Include="System.Web.Helpers">
+ <HintPath>..\packages\Microsoft.AspNet.WebPages.3.2.3\lib\net45\System.Web.Helpers.dll</HintPath>
+ </Reference>
+ <Reference Include="System.Web.WebPages.Deployment">
+ <HintPath>..\packages\Microsoft.AspNet.WebPages.3.2.3\lib\net45\System.Web.WebPages.Deployment.dll</HintPath>
+ </Reference>
+ <Reference Include="System.Web.WebPages">
+ <HintPath>..\packages\Microsoft.AspNet.WebPages.3.2.3\lib\net45\System.Web.WebPages.dll</HintPath>
+ </Reference>
+ <Reference Include="System.Web.WebPages.Razor">
+ <HintPath>..\packages\Microsoft.AspNet.WebPages.3.2.3\lib\net45\System.Web.WebPages.Razor.dll</HintPath>
+ </Reference>
+ <Reference Include="System.Web.Mvc">
+ <HintPath>..\packages\Microsoft.AspNet.Mvc.5.2.3\lib\net45\System.Web.Mvc.dll</HintPath>
+ </Reference>
+ <Reference Include="System.Net.Http.Formatting">
+ <HintPath>..\packages\Microsoft.AspNet.WebApi.Client.5.2.3\lib\net45\System.Net.Http.Formatting.dll</HintPath>
+ </Reference>
+ <Reference Include="System.Net.Http" />
+ <Reference Include="System.Web.Http">
+ <HintPath>..\packages\Microsoft.AspNet.WebApi.Core.5.2.3\lib\net45\System.Web.Http.dll</HintPath>
+ </Reference>
+ <Reference Include="System.Web.Http.WebHost">
+ <HintPath>..\packages\Microsoft.AspNet.WebApi.WebHost.5.2.3\lib\net45\System.Web.Http.WebHost.dll</HintPath>
+ </Reference>
+ <Reference Include="Newtonsoft.Json">
+ <HintPath>..\packages\Newtonsoft.Json.10.0.3\lib\net45\Newtonsoft.Json.dll</HintPath>
+ </Reference>
+ <Reference Include="nunit.framework">
+ <HintPath>..\packages\NUnit.3.9.0\lib\net45\nunit.framework.dll</HintPath>
+ </Reference>
+ </ItemGroup>
+ <ItemGroup>
+ <ProjectReference Include="..\AirPollutionWebApi\AirPollutionWebApi.csproj">
+ <Project>{22C32F4C-0DEB-40EA-9D56-48942CBB2A07}</Project>
+ <Name>AirPollutionWebApi</Name>
+ </ProjectReference>
+ </ItemGroup>
+ <ItemGroup>
+ <Compile Include="Controllers\HomeControllerTest.cs" />
+ </ItemGroup>
+ <ItemGroup>
+ <None Include="packages.config" />
+ </ItemGroup>
+ <Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
+</Project> \ No newline at end of file
diff --git a/AirPollutionWebApi.Tests/Controllers/HomeControllerTest.cs b/AirPollutionWebApi.Tests/Controllers/HomeControllerTest.cs
new file mode 100644
index 0000000..fdae606
--- /dev/null
+++ b/AirPollutionWebApi.Tests/Controllers/HomeControllerTest.cs
@@ -0,0 +1,35 @@
+using NUnit.Framework;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Web.Mvc;
+using AirPollutionWebApi;
+using AirPollutionWebApi.Controllers;
+
+namespace AirPollutionWebApi.Tests.Controllers
+{
+ [TestFixture]
+ public class HomeControllerTest
+ {
+ [Test]
+ public void Index()
+ {
+ // Arrange
+ var controller = new HomeController();
+
+ // Act
+ var result = (ViewResult)controller.Index();
+
+ var mvcName = typeof(Controller).Assembly.GetName();
+ var isMono = Type.GetType("Mono.Runtime") != null;
+
+ var expectedVersion = mvcName.Version.Major + "." + mvcName.Version.Minor;
+ var expectedRuntime = isMono ? "Mono" : ".NET";
+
+ // Assert
+ Assert.AreEqual(expectedVersion, result.ViewData["Version"]);
+ Assert.AreEqual(expectedRuntime, result.ViewData["Runtime"]);
+ }
+ }
+}
diff --git a/AirPollutionWebApi.Tests/packages.config b/AirPollutionWebApi.Tests/packages.config
new file mode 100644
index 0000000..89948e8
--- /dev/null
+++ b/AirPollutionWebApi.Tests/packages.config
@@ -0,0 +1,13 @@
+<?xml version="1.0" encoding="utf-8"?>
+<packages>
+ <package id="Microsoft.AspNet.Mvc" version="5.2.3" targetFramework="net45" />
+ <package id="Microsoft.AspNet.Razor" version="3.2.3" targetFramework="net45" />
+ <package id="Microsoft.AspNet.WebApi" version="5.2.3" targetFramework="net45" />
+ <package id="Microsoft.AspNet.WebApi.Client" version="5.2.3" targetFramework="net45" />
+ <package id="Microsoft.AspNet.WebApi.Core" version="5.2.3" targetFramework="net45" />
+ <package id="Microsoft.AspNet.WebApi.WebHost" version="5.2.3" targetFramework="net45" />
+ <package id="Microsoft.AspNet.WebPages" version="3.2.3" targetFramework="net45" />
+ <package id="Microsoft.Web.Infrastructure" version="1.0.0.0" targetFramework="net45" />
+ <package id="Newtonsoft.Json" version="10.0.3" targetFramework="net45" />
+ <package id="NUnit" version="3.9.0" targetFramework="net45" />
+</packages> \ No newline at end of file