From f6f830d066635c91763dd1ae6248c8c189e6fe7e Mon Sep 17 00:00:00 2001 From: marcinzelent Date: Mon, 20 Nov 2017 14:36:20 +0100 Subject: Added WebApi. --- .../AirPollutionWebApi.Tests.csproj | 91 ++++++++++++++++++++++ .../Controllers/HomeControllerTest.cs | 35 +++++++++ AirPollutionWebApi.Tests/packages.config | 13 ++++ 3 files changed, 139 insertions(+) create mode 100644 AirPollutionWebApi.Tests/AirPollutionWebApi.Tests.csproj create mode 100644 AirPollutionWebApi.Tests/Controllers/HomeControllerTest.cs create mode 100644 AirPollutionWebApi.Tests/packages.config (limited to 'AirPollutionWebApi.Tests') 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 @@ + + + + Debug + AnyCPU + {803677F8-DC3E-47DA-8E66-BE10F4F47E3A} + Library + AirPollutionWebApi.Tests + AirPollutionWebApi.Tests + v4.5 + + + true + full + false + bin\Debug + DEBUG; + prompt + 4 + + + true + bin\Release + prompt + 4 + + + + + + + + + + + + + + + + ..\packages\Microsoft.AspNet.Razor.3.2.3\lib\net45\System.Web.Razor.dll + + + ..\packages\Microsoft.Web.Infrastructure.1.0.0.0\lib\net40\Microsoft.Web.Infrastructure.dll + + + ..\packages\Microsoft.AspNet.WebPages.3.2.3\lib\net45\System.Web.Helpers.dll + + + ..\packages\Microsoft.AspNet.WebPages.3.2.3\lib\net45\System.Web.WebPages.Deployment.dll + + + ..\packages\Microsoft.AspNet.WebPages.3.2.3\lib\net45\System.Web.WebPages.dll + + + ..\packages\Microsoft.AspNet.WebPages.3.2.3\lib\net45\System.Web.WebPages.Razor.dll + + + ..\packages\Microsoft.AspNet.Mvc.5.2.3\lib\net45\System.Web.Mvc.dll + + + ..\packages\Microsoft.AspNet.WebApi.Client.5.2.3\lib\net45\System.Net.Http.Formatting.dll + + + + ..\packages\Microsoft.AspNet.WebApi.Core.5.2.3\lib\net45\System.Web.Http.dll + + + ..\packages\Microsoft.AspNet.WebApi.WebHost.5.2.3\lib\net45\System.Web.Http.WebHost.dll + + + ..\packages\Newtonsoft.Json.10.0.3\lib\net45\Newtonsoft.Json.dll + + + ..\packages\NUnit.3.9.0\lib\net45\nunit.framework.dll + + + + + {22C32F4C-0DEB-40EA-9D56-48942CBB2A07} + AirPollutionWebApi + + + + + + + + + + \ 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 @@ + + + + + + + + + + + + + \ No newline at end of file -- cgit v1.2.3