Permalink
Browse files

Fix unit tests. Added db initializer in tests in order to automatically

create database on first hit.
  • Loading branch information...
1 parent 7aff963 commit b4ca89880d1956a68e28548bf456c0af74583b0a @iloire committed Nov 4, 2011
View
@@ -5,4 +5,4 @@ iloire Facturacion Tests/*.dll
*.pdb
*.suo
iloire Facturacion/App_Error/*
-InvoiceDB.sdf
+*.sdf
@@ -13,7 +13,7 @@ public class CustomerTest
{
[TestFixtureSetUp]
public void TestSetup() {
-
+ System.Data.Entity.Database.SetInitializer(new EntitiesContextInitializer());
}
[Test]
@@ -41,6 +41,8 @@ public void TestAddCustomer()
c.Name = "Company name dummy";
c.Phone1 = "3423423423";
c.Phone2 = "234234232";
+ c.Notes = "A customer!";
+ c.ContactPerson = "Mr customer";
System.Web.Mvc.ActionResult result = cc.Create(c);
@@ -77,9 +77,9 @@ public void TestAddInvoiceDetails()
//post
System.Web.Mvc.ActionResult resultAdd = idc.Create(id);
- Assert.IsInstanceOf(typeof(System.Web.Mvc.ViewResult), resultAdd);
+ Assert.IsInstanceOf(typeof(System.Web.Mvc.PartialViewResult), resultAdd);
- Assert.AreEqual(((System.Web.Mvc.ViewResult)resultAdd).ViewName, "Index");
+ Assert.AreEqual(((System.Web.Mvc.PartialViewResult)resultAdd).ViewName, "Index");
}
[Test]
@@ -95,7 +95,7 @@ public void TestEditInvoiceDetails()
id.Price= 9999;
System.Web.Mvc.ActionResult resultEdition = idc.Edit(id);
- Assert.IsInstanceOf(typeof(System.Web.Mvc.RedirectToRouteResult), resultEdition);
+ Assert.IsInstanceOf(typeof(System.Web.Mvc.PartialViewResult), resultEdition);
}
@@ -51,7 +51,7 @@ public void TestAddInvoice()
System.Web.Mvc.ActionResult resultAdd = ic.Create(i);
- Assert.IsInstanceOf(typeof(System.Web.Mvc.RedirectToRouteResult), resultAdd);
+ Assert.IsInstanceOf(typeof(System.Web.Mvc.ViewResult), resultAdd);
}
[Test]
@@ -15,19 +15,27 @@
<add name="ApplicationServices" connectionString="data source=.\SQLEXPRESS;Integrated Security=SSPI;AttachDBFilename=|DataDirectory|aspnetdb.mdf;User Instance=true" providerName="System.Data.SqlClient"/>
</connectionStrings>
- <appSettings>
- <!--Database Settings-->
+ <appSettings>
+ <!-- App settings -->
+ <add key="DefaultPaginationSize" value="30"/>
+ <!--Database Settings-->
+ <add key="DropDatabaseOnChange" value="1"/>
+
<add key="webpages:Version" value="1.0.0.0"/>
<add key="ClientValidationEnabled" value="true"/>
<add key="UnobtrusiveJavaScriptEnabled" value="true"/>
<add key="DefaultVAT" value="18"/>
<add key="DefaultAdvancePaymentTax" value="15"/>
+
<!--company details-->
<add key="MyCompanyName" value="Iván Loire"/>
<add key="MyCompanyID" value="29124609P"/>
- <add key="MyCompanyAddress" value="C/ San Pedro 79 2; 50800 Zuera"/> <!-- ";" will be replace by a break line -->
+ <add key="MyCompanyAddress" value="C/ San Pedro 79 2; 50800 Zuera"/>
+ <!-- ";" will be replace by a break line -->
<add key="MyCompanyPhone" value="654 249068"/>
+ <add key="MyEmail" value="ivan@iloire.com"/>
+ <add key="MyBankAccount" value="666-666-666-666666666"/>
<add key="demo" value="true"/>

0 comments on commit b4ca898

Please sign in to comment.