Commit 5c0b2861 authored by Sebastian Barbosa's avatar Sebastian Barbosa
Browse files

Echo punto 7 del practico utilizando el TEst entregado por los docentes, pise lo que teniamos

parent a6c7268f
Pipeline #206 skipped
......@@ -11,16 +11,16 @@ namespace DataAccessLayer
{
private List<Employee> employeesRepository = new List<Employee>()
{
new PartTimeEmployee(){HourlyRate = 100},
new PartTimeEmployee(){HourlyRate = 150},
new PartTimeEmployee(){HourlyRate = 200},
new PartTimeEmployee(){HourlyRate = 250},
new PartTimeEmployee(){HourlyRate = 300},
new FullTimeEmployee(){},
new FullTimeEmployee(){},
new FullTimeEmployee(){},
new FullTimeEmployee(){},
new FullTimeEmployee(){},
new PartTimeEmployee(){Id=1, HourlyRate = 100},
new PartTimeEmployee(){Id=2, HourlyRate = 150},
new PartTimeEmployee(){Id=3, HourlyRate = 200},
new PartTimeEmployee(){Id=4, HourlyRate = 250},
new PartTimeEmployee(){Id=5, HourlyRate = 300},
new FullTimeEmployee(){Id=6},
new FullTimeEmployee(){Id=7},
new FullTimeEmployee(){Id=8},
new FullTimeEmployee(){Id=9},
new FullTimeEmployee(){Id=10},
};
public void AddEmployee(Employee emp)
......@@ -45,7 +45,7 @@ namespace DataAccessLayer
public Employee GetEmployee(int id)
{
throw new NotImplementedException();
return employeesRepository.Where(i => i.Id == id).FirstOrDefault();
}
}
}
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<configSections>
<!-- For more information on Entity Framework configuration, visit http://go.microsoft.com/fwlink/?LinkID=237468 -->
<section name="entityFramework" type="System.Data.Entity.Internal.ConfigFile.EntityFrameworkSection, EntityFramework, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false" />
<!-- For more information on Entity Framework configuration, visit http://go.microsoft.com/fwlink/?LinkID=237468 --></configSections>
<connectionStrings>
<add name="tsi_pr1Entities" connectionString="metadata=res://*/Model.Model.csdl|res://*/Model.Model.ssdl|res://*/Model.Model.msl;provider=System.Data.SqlClient;provider connection string=&quot;data source=ts1sb.database.windows.net;initial catalog=tsi_pr1;persist security info=True;user id=tsiroot;password=Passw0rd.;MultipleActiveResultSets=True;App=EntityFramework&quot;" providerName="System.Data.EntityClient" />
</connectionStrings>
<entityFramework>
<defaultConnectionFactory type="System.Data.Entity.Infrastructure.SqlConnectionFactory, EntityFramework" />
<providers>
<provider invariantName="System.Data.SqlClient" type="System.Data.Entity.SqlServer.SqlProviderServices, EntityFramework.SqlServer" />
</providers>
</entityFramework>
</configuration>
\ No newline at end of file
......@@ -19,7 +19,7 @@ namespace Test
Helper.RegisterTypes(container);
}
//[TestMethod()]
[TestMethod()]
public void CalcPartTimeEmployeeSalaryTestMethod()
{
//arrange
......@@ -32,43 +32,7 @@ namespace Test
var sum = partTimeEmployees.Sum(emp => blHandler.CalcPartTimeEmployeeSalary(emp.Id, hours));
//assert
Assert.AreEqual(sum, 500);
}
[TestMethod()]
public void ReadEmployeeMethod()
{
// TODO: Sacar metodo, es para probar nada mas
IBLEmployees blHandler = container.Resolve<IBLEmployees>();
List<Employee> result = blHandler.GetAllEmployees();
//assert
Assert.IsNotNull(result);
}
//[TestMethod()]
public void UpdateEmployeeMethod()
{
// Este metodo deberia tener un Crear pero sirvio para la primera vez
//(Anda el Update de Name y SD con EF)
IBLEmployees blHandler = container.Resolve<IBLEmployees>();
Employee emp = blHandler.GetEmployee(1);
emp.Name = "Pepito Gonzalez";
DateTime hoy = System.DateTime.Today;
emp.StartDate = hoy;
blHandler.UpdateEmployee(emp);
Employee updated = blHandler.GetEmployee(1);
Assert.AreEqual("Pepito Gonzalez", emp.Name);
Assert.AreEqual(hoy, emp.StartDate);
//assert
Assert.IsNotNull(emp);
Assert.AreEqual(1, emp.Id);
Assert.AreEqual(sum, 10000);
}
}
......
......@@ -13,20 +13,6 @@ namespace Test
{
public static void RegisterTypes(UnityContainer container)
{
// TODO: Lo deje apuntando al EF, antes de entregar habria que mandarlo al Mock (Lo que esta comentado abajo)
//register the concrete implementation for interfaces
container.RegisterType<IDALEmployees, DALEmployeesMongo>();
container.RegisterType<IBLEmployees, BLEmployees>();
//register a singleton for DAL
DALEmployeesMongo dalEmployeesEF = new DALEmployeesMongo();
container.RegisterInstance(dalEmployeesEF);
//register a singleton for BL
BLEmployees blEmployees = new BLEmployees(container.Resolve<IDALEmployees>());
container.RegisterInstance(blEmployees);
/*
//register the concrete implementation for interfaces
container.RegisterType<IDALEmployees, DALEmployeesMock>();
container.RegisterType<IBLEmployees, BLEmployees>();
......@@ -38,7 +24,6 @@ namespace Test
//register a singleton for BL
BLEmployees blEmployees = new BLEmployees(container.Resolve<IDALEmployees>());
container.RegisterInstance(blEmployees);
*/
}
}
......
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("Test")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("Test")]
[assembly: AssemblyCopyright("Copyright © 2015")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("98f36d3c-7b5b-4b8f-b498-60519518936b")]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("Test")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("Test")]
[assembly: AssemblyCopyright("Copyright © 2015")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("98f36d3c-7b5b-4b8f-b498-60519518936b")]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]
......@@ -35,31 +35,10 @@
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<ItemGroup>
<Reference Include="EntityFramework, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089, processorArchitecture=MSIL">
<HintPath>..\packages\EntityFramework.6.1.3\lib\net45\EntityFramework.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="EntityFramework.SqlServer, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089, processorArchitecture=MSIL">
<HintPath>..\packages\EntityFramework.6.1.3\lib\net45\EntityFramework.SqlServer.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="Microsoft.Practices.Unity">
<HintPath>..\Unity3\Microsoft.Practices.Unity.dll</HintPath>
</Reference>
<Reference Include="MongoDB.Bson, Version=2.2.3.3, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\MongoDB.Bson.2.2.3\lib\net45\MongoDB.Bson.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="MongoDB.Driver, Version=2.2.3.3, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\MongoDB.Driver.2.2.3\lib\net45\MongoDB.Driver.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="MongoDB.Driver.Core, Version=2.2.3.3, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\MongoDB.Driver.Core.2.2.3\lib\net45\MongoDB.Driver.Core.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="System" />
<Reference Include="System.ComponentModel.DataAnnotations" />
</ItemGroup>
<Choose>
<When Condition="('$(VisualStudioVersion)' == '10.0' or '$(VisualStudioVersion)' == '') and '$(TargetFrameworkVersion)' == 'v3.5'">
......@@ -92,13 +71,6 @@
<Name>DataAccessLayer</Name>
</ProjectReference>
</ItemGroup>
<ItemGroup>
<None Include="App.Config" />
<None Include="packages.config" />
</ItemGroup>
<ItemGroup>
<WCFMetadata Include="Service References\" />
</ItemGroup>
<Choose>
<When Condition="'$(VisualStudioVersion)' == '10.0' And '$(IsCodedUITest)' == 'True'">
<ItemGroup>
......@@ -119,11 +91,11 @@
</Choose>
<Import Project="$(VSToolsPath)\TeamTest\Microsoft.TestTools.targets" Condition="Exists('$(VSToolsPath)\TeamTest\Microsoft.TestTools.targets')" />
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets.
<Target Name="BeforeBuild">
</Target>
<Target Name="AfterBuild">
</Target>
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets.
<Target Name="BeforeBuild">
</Target>
<Target Name="AfterBuild">
</Target>
-->
</Project>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="EntityFramework" version="6.1.3" targetFramework="net45" />
<package id="MongoDB.Bson" version="2.2.3" targetFramework="net45" />
<package id="MongoDB.Driver" version="2.2.3" targetFramework="net45" />
<package id="MongoDB.Driver.Core" version="2.2.3" targetFramework="net45" />
</packages>
\ No newline at end of file
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment