diff --git a/build.xml b/build.xml
new file mode 100644
index 0000000..497b5e9
--- /dev/null
+++ b/build.xml
@@ -0,0 +1,48 @@
+
+
+ The Demo project for Tutorial
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/dotcover.xml b/dotcover.xml
new file mode 100644
index 0000000..948dfce
--- /dev/null
+++ b/dotcover.xml
@@ -0,0 +1,37 @@
+
+
+ C:\Program Files (x86)\Microsoft Visual Studio 14.0\Common7\IDE\MSTest.exe
+ /testcontainer:tutorial\bin\tutorial.dll
+ .
+
+ HTML
+
+
+
+
+
+ tutorial
+ *
+ *
+
+
+
+
+
+
\ No newline at end of file
diff --git a/tutorial.Tests/Controllers/ProductControllerTest.cs b/tutorial.Tests/Controllers/ProductControllerTest.cs
index 8a27a27..29beb06 100644
--- a/tutorial.Tests/Controllers/ProductControllerTest.cs
+++ b/tutorial.Tests/Controllers/ProductControllerTest.cs
@@ -23,5 +23,19 @@ public void GetAll()
Assert.IsNotNull(result);
Assert.AreEqual(77, result.Count());
}
+
+ [TestMethod]
+ public void GetById()
+ {
+ // Arrange
+ ProductController controller = new ProductController();
+
+ // Act
+ Product product = controller.Get(5);
+
+ // Assert
+ Assert.IsNotNull(product);
+ Assert.AreEqual("Chef Anton's Gumbo Mix", product.ProductName);
+ }
}
}
diff --git a/tutorial.Tests/Controllers/ValuesControllerTest.cs b/tutorial.Tests/Controllers/ValuesControllerTest.cs
deleted file mode 100644
index c153c92..0000000
--- a/tutorial.Tests/Controllers/ValuesControllerTest.cs
+++ /dev/null
@@ -1,81 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Net.Http;
-using System.Text;
-using System.Web.Http;
-using Microsoft.VisualStudio.TestTools.UnitTesting;
-using tutorial;
-using tutorial.Controllers;
-
-namespace tutorial.Tests.Controllers
-{
- [TestClass]
- public class ValuesControllerTest
- {
- [TestMethod]
- public void Get()
- {
- // Arrange
- ValuesController controller = new ValuesController();
-
- // Act
- IEnumerable result = controller.Get();
-
- // Assert
- Assert.IsNotNull(result);
- Assert.AreEqual(2, result.Count());
- Assert.AreEqual("value1", result.ElementAt(0));
- Assert.AreEqual("value2", result.ElementAt(1));
- }
-
- [TestMethod]
- public void GetById()
- {
- // Arrange
- ValuesController controller = new ValuesController();
-
- // Act
- string result = controller.Get(5);
-
- // Assert
- Assert.AreEqual("value", result);
- }
-
- [TestMethod]
- public void Post()
- {
- // Arrange
- ValuesController controller = new ValuesController();
-
- // Act
- controller.Post("value");
-
- // Assert
- }
-
- [TestMethod]
- public void Put()
- {
- // Arrange
- ValuesController controller = new ValuesController();
-
- // Act
- controller.Put(5, "value");
-
- // Assert
- }
-
- [TestMethod]
- public void Delete()
- {
- // Arrange
- ValuesController controller = new ValuesController();
-
- // Act
- controller.Delete(5);
-
- // Assert
- }
- }
-}
diff --git a/tutorial.Tests/tutorial.Tests.csproj b/tutorial.Tests/tutorial.Tests.csproj
index 5068552..5f6426c 100644
--- a/tutorial.Tests/tutorial.Tests.csproj
+++ b/tutorial.Tests/tutorial.Tests.csproj
@@ -104,7 +104,6 @@
-
diff --git a/tutorial.sln b/tutorial.sln
index 80a9496..d2fe3fe 100644
--- a/tutorial.sln
+++ b/tutorial.sln
@@ -1,12 +1,18 @@
Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 14
-VisualStudioVersion = 14.0.24720.0
+VisualStudioVersion = 14.0.25123.0
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "tutorial", "tutorial\tutorial.csproj", "{87B8D7E9-2398-4BE5-A432-850D7E7DAF88}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "tutorial.Tests", "tutorial.Tests\tutorial.Tests.csproj", "{7E2FEAA7-E20B-4A5B-929B-A925354E31B5}"
EndProject
+Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{9462607A-9608-474F-A5D0-D9BD7FDCC66A}"
+ ProjectSection(SolutionItems) = preProject
+ build.xml = build.xml
+ dotcover.xml = dotcover.xml
+ EndProjectSection
+EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
diff --git a/tutorial/Controllers/ProductController.cs b/tutorial/Controllers/ProductController.cs
index e35082c..637e1f0 100644
--- a/tutorial/Controllers/ProductController.cs
+++ b/tutorial/Controllers/ProductController.cs
@@ -19,9 +19,9 @@ public IQueryable Get()
}
// GET api//5
- public string Get(int id)
+ public Product Get(int id)
{
- return "value";
+ return db.Products.Find(id);
}
// POST api/
diff --git a/tutorial/Controllers/ValuesController.cs b/tutorial/Controllers/ValuesController.cs
deleted file mode 100644
index 8a1acea..0000000
--- a/tutorial/Controllers/ValuesController.cs
+++ /dev/null
@@ -1,39 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Net;
-using System.Net.Http;
-using System.Web.Http;
-
-namespace tutorial.Controllers
-{
- public class ValuesController : ApiController
- {
- // GET api/values
- public IEnumerable Get()
- {
- return new string[] { "value1", "value2" };
- }
-
- // GET api/values/5
- public string Get(int id)
- {
- return "value";
- }
-
- // POST api/values
- public void Post([FromBody]string value)
- {
- }
-
- // PUT api/values/5
- public void Put(int id, [FromBody]string value)
- {
- }
-
- // DELETE api/values/5
- public void Delete(int id)
- {
- }
- }
-}
diff --git a/tutorial/Controllers/tests/HomeControllerTest.cs b/tutorial/Controllers/tests/HomeControllerTest.cs
new file mode 100644
index 0000000..6254862
--- /dev/null
+++ b/tutorial/Controllers/tests/HomeControllerTest.cs
@@ -0,0 +1,25 @@
+using System.Web.Mvc;
+using Microsoft.VisualStudio.TestTools.UnitTesting;
+using tutorial;
+using tutorial.Controllers;
+
+namespace tutorial.Tests.Controllers
+{
+ [TestClass]
+ public class HomeControllerTest
+ {
+ [TestMethod]
+ public void Index()
+ {
+ // Arrange
+ HomeController controller = new HomeController();
+
+ // Act
+ ViewResult result = controller.Index() as ViewResult;
+
+ // Assert
+ Assert.IsNotNull(result);
+ Assert.AreEqual("Home Page", result.ViewBag.Title);
+ }
+ }
+}
diff --git a/tutorial/Controllers/tests/ProductControllerTest.cs b/tutorial/Controllers/tests/ProductControllerTest.cs
new file mode 100644
index 0000000..d4b4b42
--- /dev/null
+++ b/tutorial/Controllers/tests/ProductControllerTest.cs
@@ -0,0 +1,43 @@
+using System;
+using Microsoft.VisualStudio.TestTools.UnitTesting;
+
+using tutorial.Controllers;
+using System.Collections.Generic;
+using System.Linq;
+
+namespace tutorial.Tests.Controllers
+{
+ [TestClass]
+ public class ProductControllerTest
+ {
+ [TestMethod]
+ public void GetAll()
+ {
+ // Arrange
+ ProductController controller = new ProductController();
+
+ // Act
+ IQueryable result = controller.Get();
+
+ // Assert
+ Assert.IsNotNull(result);
+ Assert.AreEqual(77, result.Count());
+ }
+
+
+ [TestMethod]
+ public void GetById()
+ {
+ // Arrange
+ ProductController controller = new ProductController();
+
+ // Act
+ Product product = controller.Get(5);
+
+ // Assert
+ Assert.IsNotNull(product);
+ Assert.AreEqual("Chef Anton's Gumbo Mix", product.ProductName);
+ }
+
+ }
+}
diff --git a/tutorial/Properties/Settings.Designer.cs b/tutorial/Properties/Settings.Designer.cs
new file mode 100644
index 0000000..ef1b548
--- /dev/null
+++ b/tutorial/Properties/Settings.Designer.cs
@@ -0,0 +1,26 @@
+//------------------------------------------------------------------------------
+//
+// This code was generated by a tool.
+// Runtime Version:4.0.30319.42000
+//
+// Changes to this file may cause incorrect behavior and will be lost if
+// the code is regenerated.
+//
+//------------------------------------------------------------------------------
+
+namespace tutorial.Properties {
+
+
+ [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
+ [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "14.0.0.0")]
+ internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase {
+
+ private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings())));
+
+ public static Settings Default {
+ get {
+ return defaultInstance;
+ }
+ }
+ }
+}
diff --git a/tutorial/Properties/Settings.settings b/tutorial/Properties/Settings.settings
new file mode 100644
index 0000000..049245f
--- /dev/null
+++ b/tutorial/Properties/Settings.settings
@@ -0,0 +1,6 @@
+
+
+
+
+
+
diff --git a/tutorial/Web.Release.config b/tutorial/Web.Release.config
index 943c9c0..e318e36 100644
--- a/tutorial/Web.Release.config
+++ b/tutorial/Web.Release.config
@@ -14,6 +14,9 @@
xdt:Transform="SetAttributes" xdt:Locator="Match(name)"/>
-->
+
+
+