Permalink
Browse files

Merge pull request #19 from alastairs/master

Update ExcelImportService to use IMemberService for data access
  • Loading branch information...
2 parents 0f1ee5c + 6372691 commit 404665381a234508344e6d228711949636d6ff12 @kendallmiller kendallmiller committed Oct 28, 2011
Showing with 1,132 additions and 404 deletions.
  1. +2 −1 .gitignore
  2. +0 −70 src/GiveCRM.ImportExportService.Tests/ExcelImportService_Import_Should.cs
  3. +0 −79 src/GiveCRM.ImportExportService.Tests/GiveCRM.ImportExportService.Tests.csproj
  4. +0 −36 src/GiveCRM.ImportExportService.Tests/Properties/AssemblyInfo.cs
  5. +0 −5 src/GiveCRM.ImportExportService.Tests/packages.config
  6. +0 −6 src/GiveCRM.ImportExportService/App.config
  7. +0 −8 src/GiveCRM.ImportExportService/DataFormatException.cs
  8. +0 −77 src/GiveCRM.ImportExportService/GiveCRM.ImportExportService.csproj
  9. +0 −36 src/GiveCRM.ImportExportService/Properties/AssemblyInfo.cs
  10. +0 −6 src/GiveCRM.ImportExportService/packages.config
  11. +6 −0 src/GiveCRM.Web.Tests/GiveCRM.Web.Tests.csproj
  12. +78 −0 src/GiveCRM.Web.Tests/Services/ExcelImport/ExcelImportService_Import_Should.cs
  13. +254 −0 src/GiveCRM.Web.Tests/Services/ExcelImport/MemberFactory_CreateMember_Should.cs
  14. +1 −1 src/GiveCRM.Web/Controllers/ExcelImportController.cs
  15. +9 −4 src/GiveCRM.Web/GiveCRM.Web.csproj
  16. +30 −28 src/{GiveCRM.ImportExportService → GiveCRM.Web/Services/ExcelImport}/ExcelImportService.cs
  17. +1 −1 src/{GiveCRM.ImportExportService → GiveCRM.Web/Services/ExcelImport}/IExcelImportService.cs
  18. +10 −0 src/GiveCRM.Web/Services/ExcelImport/IMemberFactory.cs
  19. +1 −1 src/{GiveCRM.ImportExportService → GiveCRM.Web/Services/ExcelImport}/ImportDataCompletedEventArgs.cs
  20. +1 −1 src/{GiveCRM.ImportExportService → GiveCRM.Web/Services/ExcelImport}/ImportDataFailedEventArgs.cs
  21. +37 −0 src/GiveCRM.Web/Services/ExcelImport/MemberFactory.cs
  22. +15 −15 src/GiveCRM.Web/Services/IMemberService.cs
  23. +1 −0 src/GiveCRM.Web/packages.config
  24. +0 −29 src/GiveCRM.sln
  25. BIN src/packages/AutoMapper.2.0.0/AutoMapper.2.0.0.nupkg
  26. BIN src/packages/AutoMapper.2.0.0/lib/net40-client/AutoMapper.dll
  27. +15 −0 src/packages/AutoMapper.2.0.0/lib/net40-client/AutoMapper.xml
  28. +671 −0 src/packages/AutoMapper.2.0.0/lib/sl4/AutoMapper.XML
  29. BIN src/packages/AutoMapper.2.0.0/lib/sl4/AutoMapper.dll
View
@@ -23,4 +23,5 @@ src/GiveCRM.Database/sql/debug
src/GiveCRM.Database/sql/release
.DS_Store
*.user
-
+*.crunchproject.local.xml
+*.crunchsolution.local.xml
@@ -1,70 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.IO;
-using GiveCRM.ImportExport;
-using GiveCRM.ImportExportService;
-using Moq;
-using NUnit.Framework;
-
-namespace GiveCRM.Admin.BusinessLogic.Tests
-{
- [TestFixture]
- public class ExcelImportService_Import_Should
- {
- [Test]
- [Ignore("The Importer code is in the wrong place - it should be in the main app.")]
- public void FiresImportCompletedWhenEverythingsFine()
- {
- var dataToImport = new List<IDictionary<string, object>>
- {
- new Dictionary<string, object>
- {
- {"TwitterHandle", "@joebloggs"},
- {"FavouriteComputer", "MacBook Air"}
- }
- };
- bool eventFired = false;
- ExcelImportService importer = SetupImportService(dataToImport, (s,e) => eventFired = true);
- var inputStream = new Mock<Stream>();
-
- importer.Import(inputStream.Object);
-
- Assert.IsTrue(eventFired);
- }
-
- [Test]
- [Ignore("The Importer code is in the wrong place - it should be in the main app.")]
- public void FiresImportFailedWhenSomethingGoesWrong()
- {
- bool eventFired = false;
- ExcelImportService importer = SetupImportService(new DataFormatException(), (s,e) => eventFired = true);
- var inputStream = new Mock<Stream>();
-
- importer.Import(inputStream.Object);
-
- Assert.IsTrue(eventFired);
- }
-
- private ExcelImportService SetupImportService(IEnumerable<IDictionary<string, object>> dataToImport, Action<object, ImportDataCompletedEventArgs> eventHandler = null)
- {
- var excelImporter = new Mock<IExcelImport>();
- excelImporter.Setup(i => i.GetRowsAsKeyValuePairs(0)).Returns(dataToImport);
-
- var importService = new ExcelImportService(excelImporter.Object);
- importService.ImportCompleted += eventHandler;
-
- return importService;
- }
-
- private ExcelImportService SetupImportService(Exception exception, Action<object, ImportDataFailedEventArgs> eventHandler)
- {
- var excelImporter = new Mock<IExcelImport>();
- excelImporter.Setup(i => i.GetRowsAsKeyValuePairs(0)).Throws(exception);
-
- var importService = new ExcelImportService(excelImporter.Object);
- importService.ImportFailed += eventHandler;
-
- return importService;
- }
- }
-}
@@ -1,79 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
- <PropertyGroup>
- <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
- <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
- <ProductVersion>8.0.30703</ProductVersion>
- <SchemaVersion>2.0</SchemaVersion>
- <ProjectGuid>{7D5CFBB4-3674-4A47-8C60-7E127B113696}</ProjectGuid>
- <OutputType>Library</OutputType>
- <AppDesignerFolder>Properties</AppDesignerFolder>
- <RootNamespace>GiveCRM.Admin.BusinessLogic.Tests</RootNamespace>
- <AssemblyName>GiveCRM.Admin.BusinessLogic.Tests</AssemblyName>
- <TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
- <FileAlignment>512</FileAlignment>
- </PropertyGroup>
- <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
- <DebugSymbols>true</DebugSymbols>
- <DebugType>full</DebugType>
- <Optimize>false</Optimize>
- <OutputPath>bin\Debug\</OutputPath>
- <DefineConstants>DEBUG;TRACE</DefineConstants>
- <ErrorReport>prompt</ErrorReport>
- <WarningLevel>4</WarningLevel>
- </PropertyGroup>
- <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
- <DebugType>pdbonly</DebugType>
- <Optimize>true</Optimize>
- <OutputPath>bin\Release\</OutputPath>
- <DefineConstants>TRACE</DefineConstants>
- <ErrorReport>prompt</ErrorReport>
- <WarningLevel>4</WarningLevel>
- </PropertyGroup>
- <ItemGroup>
- <Reference Include="Moq">
- <HintPath>..\packages\Moq.4.0.10827\lib\NET40\Moq.dll</HintPath>
- </Reference>
- <Reference Include="nunit.framework">
- <HintPath>..\packages\NUnit.2.5.10.11092\lib\nunit.framework.dll</HintPath>
- </Reference>
- <Reference Include="nunit.mocks">
- <HintPath>..\packages\NUnit.2.5.10.11092\lib\nunit.mocks.dll</HintPath>
- </Reference>
- <Reference Include="pnunit.framework">
- <HintPath>..\packages\NUnit.2.5.10.11092\lib\pnunit.framework.dll</HintPath>
- </Reference>
- <Reference Include="System" />
- <Reference Include="System.Core" />
- <Reference Include="System.Xml.Linq" />
- <Reference Include="System.Data.DataSetExtensions" />
- <Reference Include="Microsoft.CSharp" />
- <Reference Include="System.Data" />
- <Reference Include="System.Xml" />
- </ItemGroup>
- <ItemGroup>
- <Compile Include="ExcelImportService_Import_Should.cs" />
- <Compile Include="Properties\AssemblyInfo.cs" />
- </ItemGroup>
- <ItemGroup>
- <None Include="packages.config" />
- </ItemGroup>
- <ItemGroup>
- <ProjectReference Include="..\GiveCRM.ImportExport\GiveCRM.ImportExport\GiveCRM.ImportExport.csproj">
- <Project>{191D37B7-B50F-45D5-9336-1A700F719617}</Project>
- <Name>GiveCRM.ImportExport</Name>
- </ProjectReference>
- <ProjectReference Include="..\GiveCRM.ImportExportService\GiveCRM.ImportExportService.csproj">
- <Project>{6442A87F-51D2-4694-B712-61D4512B162A}</Project>
- <Name>GiveCRM.ImportExportService</Name>
- </ProjectReference>
- </ItemGroup>
- <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>
- -->
-</Project>
@@ -1,36 +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("GiveCRM.Admin.BusinessLogic.Tests")]
-[assembly: AssemblyDescription("")]
-[assembly: AssemblyConfiguration("")]
-[assembly: AssemblyCompany("")]
-[assembly: AssemblyProduct("GiveCRM.Admin.BusinessLogic.Tests")]
-[assembly: AssemblyCopyright("Copyright © 2011")]
-[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("1e0d6fb8-f86d-41c9-9bc2-cf0e53d45b6c")]
-
-// 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")]
@@ -1,5 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<packages>
- <package id="Moq" version="4.0.10827" />
- <package id="NUnit" version="2.5.10.11092" />
-</packages>
@@ -1,6 +0,0 @@
-<?xml version="1.0" encoding="utf-8" ?>
-<configuration>
- <connectionStrings>
- <add name="GiveCRMTest" connectionString="Data Source=192.168.1.2;Initial Catalog=GiveCRM;User ID=GiveCRM;Password=demo"/>
- </connectionStrings>
-</configuration>
@@ -1,8 +0,0 @@
-using System;
-
-namespace GiveCRM.ImportExportService
-{
- public class DataFormatException : Exception
- {
- }
-}
@@ -1,77 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
- <PropertyGroup>
- <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
- <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
- <ProductVersion>8.0.30703</ProductVersion>
- <SchemaVersion>2.0</SchemaVersion>
- <ProjectGuid>{6442A87F-51D2-4694-B712-61D4512B162A}</ProjectGuid>
- <OutputType>Library</OutputType>
- <AppDesignerFolder>Properties</AppDesignerFolder>
- <RootNamespace>GiveCRM.ImportExportService</RootNamespace>
- <AssemblyName>GiveCRM.ImportExportService</AssemblyName>
- <TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
- <FileAlignment>512</FileAlignment>
- </PropertyGroup>
- <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
- <DebugSymbols>true</DebugSymbols>
- <DebugType>full</DebugType>
- <Optimize>false</Optimize>
- <OutputPath>bin\Debug\</OutputPath>
- <DefineConstants>DEBUG;TRACE</DefineConstants>
- <ErrorReport>prompt</ErrorReport>
- <WarningLevel>4</WarningLevel>
- </PropertyGroup>
- <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
- <DebugType>pdbonly</DebugType>
- <Optimize>true</Optimize>
- <OutputPath>bin\Release\</OutputPath>
- <DefineConstants>TRACE</DefineConstants>
- <ErrorReport>prompt</ErrorReport>
- <WarningLevel>4</WarningLevel>
- </PropertyGroup>
- <ItemGroup>
- <Reference Include="Simple.Data">
- <HintPath>..\packages\Simple.Data.Core.0.9.8.2\lib\net40\Simple.Data.dll</HintPath>
- </Reference>
- <Reference Include="Simple.Data.Ado">
- <HintPath>..\packages\Simple.Data.Ado.0.9.8.2\lib\net40\Simple.Data.Ado.dll</HintPath>
- </Reference>
- <Reference Include="Simple.Data.SqlServer">
- <HintPath>..\packages\Simple.Data.SqlServer.0.9.8.2\lib\net40\Simple.Data.SqlServer.dll</HintPath>
- </Reference>
- <Reference Include="System" />
- <Reference Include="System.Core" />
- <Reference Include="System.Xml.Linq" />
- <Reference Include="System.Data.DataSetExtensions" />
- <Reference Include="Microsoft.CSharp" />
- <Reference Include="System.Data" />
- <Reference Include="System.Xml" />
- </ItemGroup>
- <ItemGroup>
- <Compile Include="DataFormatException.cs" />
- <Compile Include="ExcelImportService.cs" />
- <Compile Include="IExcelImportService.cs" />
- <Compile Include="ImportDataCompletedEventArgs.cs" />
- <Compile Include="ImportDataFailedEventArgs.cs" />
- <Compile Include="Properties\AssemblyInfo.cs" />
- </ItemGroup>
- <ItemGroup>
- <ProjectReference Include="..\GiveCRM.ImportExport\GiveCRM.ImportExport\GiveCRM.ImportExport.csproj">
- <Project>{191D37B7-B50F-45D5-9336-1A700F719617}</Project>
- <Name>GiveCRM.ImportExport</Name>
- </ProjectReference>
- </ItemGroup>
- <ItemGroup>
- <None Include="App.config" />
- <None Include="packages.config" />
- </ItemGroup>
- <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>
- -->
-</Project>
@@ -1,36 +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("GiveCRM.Admin.BusinessLogic")]
-[assembly: AssemblyDescription("")]
-[assembly: AssemblyConfiguration("")]
-[assembly: AssemblyCompany("")]
-[assembly: AssemblyProduct("GiveCRM.Admin.BusinessLogic")]
-[assembly: AssemblyCopyright("Copyright © 2011")]
-[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("90e2b0af-0f9c-4c3f-8d86-243f8da9b0b1")]
-
-// 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")]
@@ -1,6 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<packages>
- <package id="Simple.Data.Ado" version="0.9.8.2" />
- <package id="Simple.Data.Core" version="0.9.8.2" />
- <package id="Simple.Data.SqlServer" version="0.9.8.2" />
-</packages>
@@ -63,12 +63,18 @@
<Compile Include="controllers\MemberController.Tests.cs" />
<Compile Include="controllers\SetUpController.Tests.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
+ <Compile Include="Services\ExcelImport\ExcelImportService_Import_Should.cs" />
+ <Compile Include="Services\ExcelImport\MemberFactory_CreateMember_Should.cs" />
</ItemGroup>
<ItemGroup>
<None Include="app.config" />
<None Include="packages.config" />
</ItemGroup>
<ItemGroup>
+ <ProjectReference Include="..\GiveCRM.ImportExport\GiveCRM.ImportExport\GiveCRM.ImportExport.csproj">
+ <Project>{191D37B7-B50F-45D5-9336-1A700F719617}</Project>
+ <Name>GiveCRM.ImportExport</Name>
+ </ProjectReference>
<ProjectReference Include="..\GiveCRM.Models\GiveCRM.Models.csproj">
<Project>{EF13BB24-17A9-4A39-BB5C-9A3B36519CB1}</Project>
<Name>GiveCRM.Models</Name>
Oops, something went wrong.

0 comments on commit 4046653

Please sign in to comment.