diff --git a/src/PetStore.sln b/src/PetStore.sln index ce0a40c..747fe6e 100644 --- a/src/PetStore.sln +++ b/src/PetStore.sln @@ -9,6 +9,8 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Test", "Test", "{78965154-D EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "PetStore.Core.Test", "Test\PetStore.Core.Test\PetStore.Core.Test.csproj", "{BF525221-D587-4727-A48D-9AFDADF2A3CB}" EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "PetStore.TestBase", "Test\PetStore.TestBase\PetStore.TestBase.csproj", "{BE801B36-49C9-4770-952C-76259F81F5FF}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU @@ -27,11 +29,16 @@ Global {BF525221-D587-4727-A48D-9AFDADF2A3CB}.Debug|Any CPU.Build.0 = Debug|Any CPU {BF525221-D587-4727-A48D-9AFDADF2A3CB}.Release|Any CPU.ActiveCfg = Release|Any CPU {BF525221-D587-4727-A48D-9AFDADF2A3CB}.Release|Any CPU.Build.0 = Release|Any CPU + {BE801B36-49C9-4770-952C-76259F81F5FF}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {BE801B36-49C9-4770-952C-76259F81F5FF}.Debug|Any CPU.Build.0 = Debug|Any CPU + {BE801B36-49C9-4770-952C-76259F81F5FF}.Release|Any CPU.ActiveCfg = Release|Any CPU + {BE801B36-49C9-4770-952C-76259F81F5FF}.Release|Any CPU.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE EndGlobalSection GlobalSection(NestedProjects) = preSolution {BF525221-D587-4727-A48D-9AFDADF2A3CB} = {78965154-DBB2-4B27-AC6E-5B56E0C85A22} + {BE801B36-49C9-4770-952C-76259F81F5FF} = {78965154-DBB2-4B27-AC6E-5B56E0C85A22} EndGlobalSection EndGlobal diff --git a/src/Test/PetStore.TestBase/Mocks/Core/Infrastructure/Crypt/CryptographyMock.cs b/src/Test/PetStore.TestBase/Mocks/Core/Infrastructure/Crypt/CryptographyMock.cs new file mode 100644 index 0000000..d90d6f4 --- /dev/null +++ b/src/Test/PetStore.TestBase/Mocks/Core/Infrastructure/Crypt/CryptographyMock.cs @@ -0,0 +1,31 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using PetStore.Core.Infrastructure.Crypt; + +namespace PetStore.TestBase.Mocks.Core.Infrastructure.Crypt +{ + public class CryptographyMock : ICryptography + { + public string Encrypt(string value) + { + return value; + } + + public string Decrypt(string encryptedValue) + { + return encryptedValue; + } + + public string ComputeHash(string value) + { + return value; + } + + public string ComputeHash(byte[] value) + { + return value.ToString(); + } + } +} diff --git a/src/Test/PetStore.TestBase/Mocks/Core/Infrastructure/Logging/LoggerMock.cs b/src/Test/PetStore.TestBase/Mocks/Core/Infrastructure/Logging/LoggerMock.cs new file mode 100644 index 0000000..843b325 --- /dev/null +++ b/src/Test/PetStore.TestBase/Mocks/Core/Infrastructure/Logging/LoggerMock.cs @@ -0,0 +1,51 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using PetStore.Core.Infrastructure.Logging; + +namespace PetStore.TestBase.Mocks.Core.Infrastructure.Logging +{ + public class LoggerMock : ILogger + { + #region Static Properties + + private static List _messages; + + public static List Messages + { + get { return _messages ?? (_messages = new List()); } + } + + #endregion + + #region Public Methods + + public void Info(string message) + { + Messages.Add(message); + } + + public void Warning(string message) + { + Messages.Add(message); + } + + public void Error(string message) + { + Messages.Add(message); + } + + public void Exception(Exception exception) + { + Messages.Add(exception.Message); + } + + public void Exception(Exception exception, string message) + { + Messages.Add(message + " " + exception.Message); + } + + #endregion + } +} diff --git a/src/Test/PetStore.TestBase/Mocks/Core/Infrastructure/Mail/EmailSenderMock.cs b/src/Test/PetStore.TestBase/Mocks/Core/Infrastructure/Mail/EmailSenderMock.cs new file mode 100644 index 0000000..77885a6 --- /dev/null +++ b/src/Test/PetStore.TestBase/Mocks/Core/Infrastructure/Mail/EmailSenderMock.cs @@ -0,0 +1,28 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Net.Mail; +using System.Text; +using PetStore.Core.Infrastructure.Mail; + +namespace PetStore.TestBase.Mocks.Core.Infrastructure.Mail +{ + public class EmailSenderMock : IEmailSender + { + #region Properties + + public int SendEmailCallCount { get; private set; } + + #endregion + + public void SendEmail(MailMessage mailMessage) + { + SendEmailCallCount++; + } + + public void SendEmail(string from, string recipients, string subject, string body) + { + SendEmailCallCount++; + } + } +} diff --git a/src/Test/PetStore.TestBase/PetStore.TestBase.csproj b/src/Test/PetStore.TestBase/PetStore.TestBase.csproj new file mode 100644 index 0000000..41941fa --- /dev/null +++ b/src/Test/PetStore.TestBase/PetStore.TestBase.csproj @@ -0,0 +1,62 @@ + + + + Debug + AnyCPU + 8.0.30703 + 2.0 + {BE801B36-49C9-4770-952C-76259F81F5FF} + Library + Properties + PetStore.TestBase + PetStore.TestBase + v4.0 + 512 + + + true + full + false + bin\Debug\ + DEBUG;TRACE + prompt + 4 + + + pdbonly + true + bin\Release\ + TRACE + prompt + 4 + + + + + + + + + + + + + + + + + + + {FF79E5EE-F489-4239-B935-DA2C06848BFA} + PetStore.Core + + + + + \ No newline at end of file diff --git a/src/Test/PetStore.TestBase/Properties/AssemblyInfo.cs b/src/Test/PetStore.TestBase/Properties/AssemblyInfo.cs new file mode 100644 index 0000000..c96675a --- /dev/null +++ b/src/Test/PetStore.TestBase/Properties/AssemblyInfo.cs @@ -0,0 +1,36 @@ +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("PetStore.TestBase")] +[assembly: AssemblyDescription("")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("Microsoft")] +[assembly: AssemblyProduct("PetStore.TestBase")] +[assembly: AssemblyCopyright("Copyright © Microsoft 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("c96b1f82-85ef-4629-9561-cba7662c8e9d")] + +// 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")]