From 2771ec50d66a317635eb8c80b035ac0e277c8cd6 Mon Sep 17 00:00:00 2001 From: David Breyer Date: Fri, 3 Mar 2017 08:44:10 -0500 Subject: [PATCH] Update to Code Coverage Report --- CodeCoverageReport/Summary.tex | 6033 +++++++++++++++++ CodeCoverageReport/badge_linecoverage.svg | 4 +- CodeCoverageReport/combined.js | 93 +- ...ry6.dll_AuditableBaseContext_TContext_.htm | 84 + ...epository6.dll_AuditableBaseRepository.htm | 79 + ...ory6.dll_AuditableBaseRepository_C__T_.htm | 81 + ...repository6.dll_BaseContext_TContext_.htm} | 86 +- ...itable.repository6.dll_BaseRepository.htm} | 499 +- ....repository6.dll_BaseRepository_C__T_.htm} | 559 +- ...le.repository6.dll_DatabaseFactory_C_.htm} | 10 +- ...rk.auditable.repository6.dll_Delta_T_.htm} | 114 +- ...able.repository6.tests.dll_DeltaTests.htm} | 274 +- ...itory6.tests.dll_RepositoryCreateTests.htm | 230 + ...itory6.tests.dll_RepositoryDeleteTests.htm | 142 + ...sitory6.tests.dll_RepositoryReadTests.htm} | 102 +- ...tory6.tests.dll_RepositoryUpdateTests.htm} | 80 +- ...pository6.tests.dll_TestDbInitializer.htm} | 18 +- ....tests.dll_TestExampleDatabaseFactory.htm} | 30 +- ...auditing.dll_AuditConfigurationSection.htm | 2 +- ...yframework.auditing.dll_AuditDbContext.htm | 686 +- ...tityframework.auditing.dll_AuditEntity.htm | 2 +- ...tyframework.auditing.dll_AuditTypeInfo.htm | 2 +- ...framework.auditing.dll_AuditableEntity.htm | 2 +- ...tyframework.auditing.dll_EntityElement.htm | 2 +- ...k.auditing.dll_EntityElementCollection.htm | 2 +- ...ramework.auditing.test.dll_AuditDbTest.htm | 2 +- ...ityframework.auditing.test.dll_Context.htm | 2 +- ...tyframework.auditing.test.dll_Customer.htm | 2 +- ...mework.auditing.test.dll_CustomerAudit.htm | 2 +- ...repository6.dll_BaseContext_TContext_.htm} | 69 +- ...mework.repository6.dll_BaseRepository.htm} | 477 +- ....repository6.dll_BaseRepository_C__T_.htm} | 537 +- ...rk.repository6.dll_DatabaseFactory_C_.htm} | 93 +- ...ityframework.repository6.dll_Delta_T_.htm} | 114 +- ...work.repository6.tests.dll_DeltaTests.htm} | 84 +- ...tory6.tests.dll_RepositoryCreateTests.htm} | 320 +- ...tory6.tests.dll_RepositoryDeleteTests.htm} | 209 +- ...sitory6.tests.dll_RepositoryReadTests.htm} | 98 +- ...tory6.tests.dll_RepositoryUpdateTests.htm} | 247 +- ...pository6.tests.dll_TestDbInitializer.htm} | 10 +- ....tests.dll_TestExampleDatabaseFactory.htm} | 12 +- CodeCoverageReport/index.htm | 101 +- ...ntlayer.auditable.dll_MyDbInitializer.htm} | 18 +- ...tlayer.auditable.dll_PersistentEntity.htm} | 10 +- ...uditable.dll_SimpleCompositeKeyEntity.htm} | 10 +- ...ll_SimpleCompositeKeyEntityRepository.htm} | 66 +- ...tlayer.auditable.dll_SimpleDataEntity.htm} | 10 +- ...r.auditable.dll_SimpleDataEntityAudit.htm} | 10 +- ...itable.dll_SimpleDataEntityRepository.htm} | 71 +- ...r.auditable.dll_YourCustomDataContext.htm} | 24 +- .../persistentlayer.dll_MyDbInitializer.htm | 2 +- .../persistentlayer.dll_PersistentEntity.htm | 2 +- ...tentlayer.dll_SimpleCompositeKeyEntity.htm | 2 +- ...dll_SimpleCompositeKeyEntityRepository.htm | 61 +- .../persistentlayer.dll_SimpleDataEntity.htm | 2 +- ...ntlayer.dll_SimpleDataEntityRepository.htm | 61 +- ...sistentlayer.dll_YourCustomDataContext.htm | 4 +- badge_linecoverage.svg | 4 +- 58 files changed, 9397 insertions(+), 2555 deletions(-) create mode 100644 CodeCoverageReport/Summary.tex create mode 100644 CodeCoverageReport/entityframework.auditable.repository6.dll_AuditableBaseContext_TContext_.htm create mode 100644 CodeCoverageReport/entityframework.auditable.repository6.dll_AuditableBaseRepository.htm create mode 100644 CodeCoverageReport/entityframework.auditable.repository6.dll_AuditableBaseRepository_C__T_.htm rename CodeCoverageReport/{entityframeworkauditablerepository6.dll_BaseContext_TContext_.htm => entityframework.auditable.repository6.dll_BaseContext_TContext_.htm} (59%) rename CodeCoverageReport/{entityframeworkauditablerepository6.dll_BaseRepository.htm => entityframework.auditable.repository6.dll_BaseRepository.htm} (76%) rename CodeCoverageReport/{entityframeworkauditablerepository6.dll_BaseRepository_C__T_.htm => entityframework.auditable.repository6.dll_BaseRepository_C__T_.htm} (61%) rename CodeCoverageReport/{entityframeworkrepository6.dll_DatabaseFactory_C_.htm => entityframework.auditable.repository6.dll_DatabaseFactory_C_.htm} (96%) rename CodeCoverageReport/{entityframeworkauditablerepository6.dll_Delta_T_.htm => entityframework.auditable.repository6.dll_Delta_T_.htm} (77%) rename CodeCoverageReport/{entityframeworkauditablerepository6tests.dll_RepositoryCreateTests.htm => entityframework.auditable.repository6.tests.dll_DeltaTests.htm} (73%) create mode 100644 CodeCoverageReport/entityframework.auditable.repository6.tests.dll_RepositoryCreateTests.htm create mode 100644 CodeCoverageReport/entityframework.auditable.repository6.tests.dll_RepositoryDeleteTests.htm rename CodeCoverageReport/{entityframeworkauditablerepository6tests.dll_RepositoryReadTests.htm => entityframework.auditable.repository6.tests.dll_RepositoryReadTests.htm} (63%) rename CodeCoverageReport/{entityframeworkauditablerepository6tests.dll_RepositoryUpdateTests.htm => entityframework.auditable.repository6.tests.dll_RepositoryUpdateTests.htm} (92%) rename CodeCoverageReport/{entityframeworkauditablerepository6tests.dll_TestDbInitializer.htm => entityframework.auditable.repository6.tests.dll_TestDbInitializer.htm} (91%) rename CodeCoverageReport/{entityframeworkauditablerepository6tests.dll_TestExampleDatabaseFactory.htm => entityframework.auditable.repository6.tests.dll_TestExampleDatabaseFactory.htm} (93%) rename CodeCoverageReport/{entityframeworkrepository6.dll_BaseContext_TContext_.htm => entityframework.repository6.dll_BaseContext_TContext_.htm} (63%) rename CodeCoverageReport/{entityframeworkrepository6.dll_BaseRepository.htm => entityframework.repository6.dll_BaseRepository.htm} (80%) rename CodeCoverageReport/{entityframeworkrepository6.dll_BaseRepository_C__T_.htm => entityframework.repository6.dll_BaseRepository_C__T_.htm} (63%) rename CodeCoverageReport/{entityframeworkauditablerepository6.dll_DatabaseFactory_C_.htm => entityframework.repository6.dll_DatabaseFactory_C_.htm} (70%) rename CodeCoverageReport/{entityframeworkrepository6.dll_Delta_T_.htm => entityframework.repository6.dll_Delta_T_.htm} (77%) rename CodeCoverageReport/{entityframeworkauditablerepository6tests.dll_DeltaTests.htm => entityframework.repository6.tests.dll_DeltaTests.htm} (77%) rename CodeCoverageReport/{entityframeworkrepository6tests.dll_RepositoryCreateTests.htm => entityframework.repository6.tests.dll_RepositoryCreateTests.htm} (69%) rename CodeCoverageReport/{entityframeworkrepository6tests.dll_DeltaTests.htm => entityframework.repository6.tests.dll_RepositoryDeleteTests.htm} (70%) rename CodeCoverageReport/{entityframeworkrepository6tests.dll_RepositoryReadTests.htm => entityframework.repository6.tests.dll_RepositoryReadTests.htm} (62%) rename CodeCoverageReport/{entityframeworkrepository6tests.dll_RepositoryUpdateTests.htm => entityframework.repository6.tests.dll_RepositoryUpdateTests.htm} (83%) rename CodeCoverageReport/{entityframeworkrepository6tests.dll_TestDbInitializer.htm => entityframework.repository6.tests.dll_TestDbInitializer.htm} (95%) rename CodeCoverageReport/{entityframeworkrepository6tests.dll_TestExampleDatabaseFactory.htm => entityframework.repository6.tests.dll_TestExampleDatabaseFactory.htm} (97%) rename CodeCoverageReport/{persistentlayerauditable.dll_MyDbInitializer.htm => persistentlayer.auditable.dll_MyDbInitializer.htm} (91%) rename CodeCoverageReport/{persistentlayerauditable.dll_PersistentEntity.htm => persistentlayer.auditable.dll_PersistentEntity.htm} (93%) rename CodeCoverageReport/{persistentlayerauditable.dll_SimpleCompositeKeyEntity.htm => persistentlayer.auditable.dll_SimpleCompositeKeyEntity.htm} (95%) rename CodeCoverageReport/{persistentlayerauditable.dll_SimpleCompositeKeyEntityRepository.htm => persistentlayer.auditable.dll_SimpleCompositeKeyEntityRepository.htm} (71%) rename CodeCoverageReport/{persistentlayerauditable.dll_SimpleDataEntity.htm => persistentlayer.auditable.dll_SimpleDataEntity.htm} (93%) rename CodeCoverageReport/{persistentlayerauditable.dll_SimpleDataEntityAudit.htm => persistentlayer.auditable.dll_SimpleDataEntityAudit.htm} (94%) rename CodeCoverageReport/{persistentlayerauditable.dll_SimpleDataEntityRepository.htm => persistentlayer.auditable.dll_SimpleDataEntityRepository.htm} (63%) rename CodeCoverageReport/{persistentlayerauditable.dll_YourCustomDataContext.htm => persistentlayer.auditable.dll_YourCustomDataContext.htm} (90%) diff --git a/CodeCoverageReport/Summary.tex b/CodeCoverageReport/Summary.tex new file mode 100644 index 0000000..a017437 --- /dev/null +++ b/CodeCoverageReport/Summary.tex @@ -0,0 +1,6033 @@ +\documentclass[a4paper,10pt]{article} +\usepackage[paper=a4paper,left=20mm,right=20mm,top=20mm,bottom=20mm]{geometry} +\usepackage{longtable} +\usepackage{fancyhdr} +\usepackage[pdftex]{color} +\usepackage{colortbl} +\definecolor{green}{rgb}{0,1,0.12} +\definecolor{red}{rgb}{1,0,0} +\definecolor{gray}{rgb}{0.86,0.86,0.86} + +\usepackage[pdftex, + colorlinks=true, linkcolor=red, urlcolor=green, citecolor=red,% + raiselinks=true,% + bookmarks=true,% + bookmarksopenlevel=1,% + bookmarksopen=true,% + bookmarksnumbered=true,% + hyperindex=true,% + plainpages=false,% correct hyperlinks + pdfpagelabels=true%,% view TeX pagenumber in PDF reader + %pdfborder={0 0 0.5} + ]{hyperref} + +\hypersetup{pdftitle={Coverage Report}, + pdfauthor={ReportGenerator - 2.5.5.0} + } + +\pagestyle{fancy} +\fancyhead[LE,LO]{\leftmark} +\fancyhead[R]{\thepage} +\fancyfoot[C]{ReportGenerator - 2.5.5.0} + +\begin{document} + +\setcounter{secnumdepth}{-1} +\section{Summary} +\begin{longtable}[l]{ll} +\textbf{Generated on:} & 3/3/2017 - 8:38:07 AM\\ +\textbf{Parser:} & VisualStudioParser\\ +\textbf{Assemblies:} & 8\\ +\textbf{Classes:} & 53\\ +\textbf{Files:} & 46\\ +\textbf{Covered lines:} & 1445\\ +\textbf{Uncovered lines:} & 175\\ +\textbf{Coverable lines:} & 1620\\ +\textbf{Total lines:} & 4298\\ +\textbf{Line coverage:} & 89.1\%\\ +\end{longtable} +\section{Assemblies} +\begin{longtable}[l]{ll} +\textbf{entityframework.auditable.repository6.dll} & \textbf{81.4\%}\\ +EntityFramework.Auditable.Repository6.AuditableBaseContext & 28.5\%\\ +EntityFramework.Auditable.Repository6.AuditableBaseRepository & 0\%\\ +EntityFramework.Auditable.Repository6.AuditableBaseRepository & 100\%\\ +EntityFramework.Repository6.BaseContext & 0\%\\ +EntityFramework.Repository6.BaseRepository & 63.1\%\\ +EntityFramework.Repository6.BaseRepository & 96.7\%\\ +EntityFramework.Repository6.DatabaseFactory & 0\%\\ +EntityFramework.Repository6.Delta & 100\%\\ +\textbf{entityframework.auditable.repository6.tests.dll} & \textbf{98.2\%}\\ +EntityFramework.Auditable.Repository6.Tests.RepositoryCreateTests & 98.7\%\\ +EntityFramework.Auditable.Repository6.Tests.RepositoryDeleteTests & 100\%\\ +EntityFramework.Auditable.Repository6.Tests.RepositoryReadTests & 100\%\\ +EntityFramework.Auditable.Repository6.Tests.RepositoryUpdateTests & 98.3\%\\ +EntityFramework.Auditable.Repository6.Tests.TestDbInitializer & 100\%\\ +EntityFramework.Auditable.Repository6.Tests.TestExampleDatabaseFactory & 100\%\\ +EntityFramework.Repository6.Tests.DeltaTests & 94.1\%\\ +\textbf{entityframework.auditing.dll} & \textbf{79.4\%}\\ +EntityFramework.Auditing.AuditableEntity & 100\%\\ +EntityFramework.Auditing.AuditConfigurationSection & 66.6\%\\ +EntityFramework.Auditing.AuditDbContext & 83.9\%\\ +EntityFramework.Auditing.AuditEntity & 100\%\\ +EntityFramework.Auditing.AuditTypeInfo & 100\%\\ +EntityFramework.Auditing.EntityElement & 50\%\\ +EntityFramework.Auditing.EntityElementCollection & 37.5\%\\ +\textbf{entityframework.auditing.test.dll} & \textbf{88\%}\\ +EntityFramework.Auditing.Test.AuditDbTest & 87.5\%\\ +EntityFramework.Auditing.Test.Context & 100\%\\ +EntityFramework.Auditing.Test.Customer & 100\%\\ +EntityFramework.Auditing.Test.CustomerAudit & 100\%\\ +\textbf{entityframework.repository6.dll} & \textbf{85.2\%}\\ +EntityFramework.Repository6.BaseContext & 28.5\%\\ +EntityFramework.Repository6.BaseRepository & 63.1\%\\ +EntityFramework.Repository6.BaseRepository & 96.7\%\\ +EntityFramework.Repository6.DatabaseFactory & 0\%\\ +EntityFramework.Repository6.Delta & 100\%\\ +\textbf{entityframework.repository6.tests.dll} & \textbf{98.7\%}\\ +EntityFramework.Repository6.Tests.DeltaTests & 96\%\\ +EntityFramework.Repository6.Tests.RepositoryCreateTests & 98.7\%\\ +EntityFramework.Repository6.Tests.RepositoryDeleteTests & 100\%\\ +EntityFramework.Repository6.Tests.RepositoryReadTests & 100\%\\ +EntityFramework.Repository6.Tests.RepositoryUpdateTests & 97.8\%\\ +EntityFramework.Repository6.Tests.TestDbInitializer & 100\%\\ +EntityFramework.Repository6.Tests.TestExampleDatabaseFactory & 100\%\\ +\textbf{persistentlayer.auditable.dll} & \textbf{68.9\%}\\ +PersistentLayer.Auditable.Contexts.YourCustomDataContext & 80\%\\ +PersistentLayer.Auditable.Entities.PersistentEntity & 0\%\\ +PersistentLayer.Auditable.Entities.SimpleCompositeKeyEntity & 100\%\\ +PersistentLayer.Auditable.Entities.SimpleDataEntity & 100\%\\ +PersistentLayer.Auditable.Entities.SimpleDataEntityAudit & 100\%\\ +PersistentLayer.Auditable.Initializers.MyDbInitializer & 0\%\\ +PersistentLayer.Auditable.Repositories.SimpleCompositeKeyEntityRepository & 100\%\\ +PersistentLayer.Auditable.Repositories.SimpleDataEntityRepository & 100\%\\ +\textbf{persistentlayer.dll} & \textbf{61.9\%}\\ +PersistentLayer.Contexts.YourCustomDataContext & 75\%\\ +PersistentLayer.Entities.PersistentEntity & 100\%\\ +PersistentLayer.Entities.SimpleCompositeKeyEntity & 100\%\\ +PersistentLayer.Entities.SimpleDataEntity & 100\%\\ +PersistentLayer.Initializers.MyDbInitializer & 0\%\\ +PersistentLayer.Repositories.SimpleCompositeKeyEntityRepository & 100\%\\ +PersistentLayer.Repositories.SimpleDataEntityRepository & 100\%\\ +\end{longtable} +\newpage +\section{EntityFramework.Auditable.Repository6.AuditableBaseContext} +\subsection{Summary} +\begin{longtable}[l]{ll} +\textbf{Class:} & EntityFramework.Auditable.Repository6.AuditableBaseContext\\ +\textbf{Assembly:} & entityframework.auditable.repository6.dll\\ +\textbf{File(s):} & \begin{minipage}[t]{12cm}{ameworkRepository6\textbackslash EntityFrameworkAuditableRepository6\textbackslash AuditableBaseContext.cs}\end{minipage} \\ +\textbf{Covered lines:} & 2\\ +\textbf{Uncovered lines:} & 5\\ +\textbf{Coverable lines:} & 7\\ +\textbf{Total lines:} & 24\\ +\textbf{Line coverage:} & 28.5\%\\ +\end{longtable} +\subsection{Metrics} +\begin{longtable}[l]{|l|l|l|} +\hline +\textbf{Method} & \textbf{Blocks covered} & \textbf{Blocks not covered}\\ +\hline +\textbf{AuditableBaseContext} & 1 & 0\\ +\hline +\textbf{AuditableBaseContext} & 3 & 0\\ +\hline +\textbf{AuditableBaseContext} & 0 & 3\\ +\hline +\textbf{AuditableBaseContext} & 0 & 3\\ +\hline +\textbf{AuditableBaseContext} & 0 & 3\\ +\hline +\textbf{AuditableBaseContext} & 0 & 3\\ +\hline +\textbf{AuditableBaseContext} & 0 & 3\\ +\hline +\end{longtable} +\subsection{File(s)} +\subsubsection{ameworkRepository6\textbackslash EntityFrameworkAuditableRepository6\textbackslash AuditableBaseContext.cs} +\begin{longtable}[l]{lrrll} +\textbf{} & \textbf{\#} & \textbf{Line} & \textbf{} & \textbf{Line coverage}\\ +\cellcolor{gray} & & \verb~1~ & & \verb~using EntityFramework.Auditing;~\\ +\cellcolor{gray} & & \verb~2~ & & \verb~using System.Data.Common;~\\ +\cellcolor{gray} & & \verb~3~ & & \verb~using System.Data.Entity;~\\ +\cellcolor{gray} & & \verb~4~ & & \verb~~\\ +\cellcolor{gray} & & \verb~5~ & & \verb~namespace EntityFramework.Auditable.Repository6~\\ +\cellcolor{gray} & & \verb~6~ & & \verb~{~\\ +\cellcolor{gray} & & \verb~7~ & & \verb~ public class AuditableBaseContext : AuditDbContext~\\ +\cellcolor{gray} & & \verb~8~ & & \verb~ where TContext : AuditDbContext~\\ +\cellcolor{gray} & & \verb~9~ & & \verb~ {~\\ +\cellcolor{green} & 1 & \verb~10~ & & \verb~ static AuditableBaseContext() { }~\\ +\cellcolor{gray} & & \verb~11~ & & \verb~~\\ +\cellcolor{green} & 1 & \verb~12~ & & \verb~ protected AuditableBaseContext(DbConnection dbConnection) : base(dbCon~\\ +\cellcolor{gray} & & \verb~13~ & & \verb~~\\ +\cellcolor{red} & 0 & \verb~14~ & & \verb~ protected AuditableBaseContext(DbConnection dbConnection, bool context~\\ +\cellcolor{gray} & & \verb~15~ & & \verb~~\\ +\cellcolor{red} & 0 & \verb~16~ & & \verb~ protected AuditableBaseContext(string connectionString) : base(connect~\\ +\cellcolor{gray} & & \verb~17~ & & \verb~~\\ +\cellcolor{red} & 0 & \verb~18~ & & \verb~ protected AuditableBaseContext(string connectionString, IDatabaseIniti~\\ +\cellcolor{gray} & & \verb~19~ & & \verb~~\\ +\cellcolor{red} & 0 & \verb~20~ & & \verb~ protected AuditableBaseContext(DbConnection dbConnection, IDatabaseIni~\\ +\cellcolor{gray} & & \verb~21~ & & \verb~~\\ +\cellcolor{red} & 0 & \verb~22~ & & \verb~ protected AuditableBaseContext(DbConnection dbConnection, IDatabaseIni~\\ +\cellcolor{gray} & & \verb~23~ & & \verb~ }~\\ +\cellcolor{gray} & & \verb~24~ & & \verb~}~\\ +\end{longtable} +\newpage +\section{EntityFramework.Auditable.Repository6.AuditableBaseRepository} +\subsection{Summary} +\begin{longtable}[l]{ll} +\textbf{Class:} & EntityFramework.Auditable.Repository6.AuditableBaseRepository\\ +\textbf{Assembly:} & entityframework.auditable.repository6.dll\\ +\textbf{File(s):} & \begin{minipage}[t]{12cm}{workRepository6\textbackslash EntityFrameworkAuditableRepository6\textbackslash AuditableBaseRepository.cs}\end{minipage} \\ +\textbf{Covered lines:} & 0\\ +\textbf{Uncovered lines:} & 3\\ +\textbf{Coverable lines:} & 3\\ +\textbf{Total lines:} & 31\\ +\textbf{Line coverage:} & 0\%\\ +\end{longtable} +\subsection{Metrics} +\begin{longtable}[l]{|l|l|l|} +\hline +\textbf{Method} & \textbf{Blocks covered} & \textbf{Blocks not covered}\\ +\hline +\textbf{SaveAsync()} & 0 & 5\\ +\hline +\end{longtable} +\subsection{File(s)} +\subsubsection{workRepository6\textbackslash EntityFrameworkAuditableRepository6\textbackslash AuditableBaseRepository.cs} +\begin{longtable}[l]{lrrll} +\textbf{} & \textbf{\#} & \textbf{Line} & \textbf{} & \textbf{Line coverage}\\ +\cellcolor{gray} & & \verb~1~ & & \verb~using EntityFramework.Auditing;~\\ +\cellcolor{gray} & & \verb~2~ & & \verb~using EntityFramework.Repository6;~\\ +\cellcolor{gray} & & \verb~3~ & & \verb~using EntityFramework.Repository6.Interfaces;~\\ +\cellcolor{gray} & & \verb~4~ & & \verb~using System;~\\ +\cellcolor{gray} & & \verb~5~ & & \verb~using System.Threading.Tasks;~\\ +\cellcolor{gray} & & \verb~6~ & & \verb~~\\ +\cellcolor{gray} & & \verb~7~ & & \verb~namespace EntityFramework.Auditable.Repository6~\\ +\cellcolor{gray} & & \verb~8~ & & \verb~{~\\ +\cellcolor{gray} & & \verb~9~ & & \verb~ public abstract class AuditableBaseRepository :~\\ +\cellcolor{gray} & & \verb~10~ & & \verb~ BaseRepository~\\ +\cellcolor{gray} & & \verb~11~ & & \verb~ , IBaseRepository~\\ +\cellcolor{gray} & & \verb~12~ & & \verb~ , IDisposable~\\ +\cellcolor{gray} & & \verb~13~ & & \verb~ , IAuditSaveFunctions~\\ +\cellcolor{gray} & & \verb~14~ & & \verb~ where T : class~\\ +\cellcolor{gray} & & \verb~15~ & & \verb~ where C : AuditDbContext~\\ +\cellcolor{gray} & & \verb~16~ & & \verb~ {~\\ +\cellcolor{gray} & & \verb~17~ & & \verb~ protected AuditableBaseRepository(C context) : base(context)~\\ +\cellcolor{gray} & & \verb~18~ & & \verb~ {~\\ +\cellcolor{gray} & & \verb~19~ & & \verb~ }~\\ +\cellcolor{gray} & & \verb~20~ & & \verb~~\\ +\cellcolor{gray} & & \verb~21~ & & \verb~ public async virtual Task SaveAsync(string userName)~\\ +\cellcolor{red} & 0 & \verb~22~ & & \verb~ {~\\ +\cellcolor{red} & 0 & \verb~23~ & & \verb~ return await Context.SaveChangesAsync(userName);~\\ +\cellcolor{red} & 0 & \verb~24~ & & \verb~ }~\\ +\cellcolor{gray} & & \verb~25~ & & \verb~~\\ +\cellcolor{gray} & & \verb~26~ & & \verb~ public virtual int Save(string userName)~\\ +\cellcolor{gray} & & \verb~27~ & & \verb~ {~\\ +\cellcolor{gray} & & \verb~28~ & & \verb~ return Context.SaveChanges(userName);~\\ +\cellcolor{gray} & & \verb~29~ & & \verb~ }~\\ +\cellcolor{gray} & & \verb~30~ & & \verb~ }~\\ +\cellcolor{gray} & & \verb~31~ & & \verb~}~\\ +\end{longtable} +\newpage +\section{EntityFramework.Auditable.Repository6.AuditableBaseRepository} +\subsection{Summary} +\begin{longtable}[l]{ll} +\textbf{Class:} & EntityFramework.Auditable.Repository6.AuditableBaseRepository\\ +\textbf{Assembly:} & entityframework.auditable.repository6.dll\\ +\textbf{File(s):} & \begin{minipage}[t]{12cm}{workRepository6\textbackslash EntityFrameworkAuditableRepository6\textbackslash AuditableBaseRepository.cs}\end{minipage} \\ +\textbf{Covered lines:} & 6\\ +\textbf{Uncovered lines:} & 0\\ +\textbf{Coverable lines:} & 6\\ +\textbf{Total lines:} & 31\\ +\textbf{Line coverage:} & 100\%\\ +\end{longtable} +\subsection{Metrics} +\begin{longtable}[l]{|l|l|l|} +\hline +\textbf{Method} & \textbf{Blocks covered} & \textbf{Blocks not covered}\\ +\hline +\textbf{AuditableBaseReposit} & 2 & 0\\ +\hline +\textbf{Save(string)} & 4 & 0\\ +\hline +\end{longtable} +\subsection{File(s)} +\subsubsection{workRepository6\textbackslash EntityFrameworkAuditableRepository6\textbackslash AuditableBaseRepository.cs} +\begin{longtable}[l]{lrrll} +\textbf{} & \textbf{\#} & \textbf{Line} & \textbf{} & \textbf{Line coverage}\\ +\cellcolor{gray} & & \verb~1~ & & \verb~using EntityFramework.Auditing;~\\ +\cellcolor{gray} & & \verb~2~ & & \verb~using EntityFramework.Repository6;~\\ +\cellcolor{gray} & & \verb~3~ & & \verb~using EntityFramework.Repository6.Interfaces;~\\ +\cellcolor{gray} & & \verb~4~ & & \verb~using System;~\\ +\cellcolor{gray} & & \verb~5~ & & \verb~using System.Threading.Tasks;~\\ +\cellcolor{gray} & & \verb~6~ & & \verb~~\\ +\cellcolor{gray} & & \verb~7~ & & \verb~namespace EntityFramework.Auditable.Repository6~\\ +\cellcolor{gray} & & \verb~8~ & & \verb~{~\\ +\cellcolor{gray} & & \verb~9~ & & \verb~ public abstract class AuditableBaseRepository :~\\ +\cellcolor{gray} & & \verb~10~ & & \verb~ BaseRepository~\\ +\cellcolor{gray} & & \verb~11~ & & \verb~ , IBaseRepository~\\ +\cellcolor{gray} & & \verb~12~ & & \verb~ , IDisposable~\\ +\cellcolor{gray} & & \verb~13~ & & \verb~ , IAuditSaveFunctions~\\ +\cellcolor{gray} & & \verb~14~ & & \verb~ where T : class~\\ +\cellcolor{gray} & & \verb~15~ & & \verb~ where C : AuditDbContext~\\ +\cellcolor{gray} & & \verb~16~ & & \verb~ {~\\ +\cellcolor{green} & 1 & \verb~17~ & & \verb~ protected AuditableBaseRepository(C context) : base(context)~\\ +\cellcolor{green} & 1 & \verb~18~ & & \verb~ {~\\ +\cellcolor{green} & 1 & \verb~19~ & & \verb~ }~\\ +\cellcolor{gray} & & \verb~20~ & & \verb~~\\ +\cellcolor{gray} & & \verb~21~ & & \verb~ public async virtual Task SaveAsync(string userName)~\\ +\cellcolor{gray} & & \verb~22~ & & \verb~ {~\\ +\cellcolor{gray} & & \verb~23~ & & \verb~ return await Context.SaveChangesAsync(userName);~\\ +\cellcolor{gray} & & \verb~24~ & & \verb~ }~\\ +\cellcolor{gray} & & \verb~25~ & & \verb~~\\ +\cellcolor{gray} & & \verb~26~ & & \verb~ public virtual int Save(string userName)~\\ +\cellcolor{green} & 1 & \verb~27~ & & \verb~ {~\\ +\cellcolor{green} & 1 & \verb~28~ & & \verb~ return Context.SaveChanges(userName);~\\ +\cellcolor{green} & 1 & \verb~29~ & & \verb~ }~\\ +\cellcolor{gray} & & \verb~30~ & & \verb~ }~\\ +\cellcolor{gray} & & \verb~31~ & & \verb~}~\\ +\end{longtable} +\newpage +\section{EntityFramework.Repository6.BaseContext} +\subsection{Summary} +\begin{longtable}[l]{ll} +\textbf{Class:} & EntityFramework.Repository6.BaseContext\\ +\textbf{Assembly:} & entityframework.auditable.repository6.dll\\ +\textbf{File(s):} & \begin{minipage}[t]{12cm}{velopment\textbackslash EntityFrameworkRepository6\textbackslash EntityFrameworkRepository6\textbackslash BaseContext.cs}\end{minipage} \\ +\textbf{Covered lines:} & 0\\ +\textbf{Uncovered lines:} & 7\\ +\textbf{Coverable lines:} & 7\\ +\textbf{Total lines:} & 23\\ +\textbf{Line coverage:} & 0\%\\ +\end{longtable} +\subsection{Metrics} +\begin{longtable}[l]{|l|l|l|} +\hline +\textbf{Method} & \textbf{Blocks covered} & \textbf{Blocks not covered}\\ +\hline +\textbf{BaseContext()} & 0 & 1\\ +\hline +\textbf{BaseContext(System.D} & 0 & 3\\ +\hline +\textbf{BaseContext(System.D} & 0 & 3\\ +\hline +\textbf{BaseContext(string)} & 0 & 3\\ +\hline +\textbf{BaseContext(string, } & 0 & 3\\ +\hline +\textbf{BaseContext(System.D} & 0 & 3\\ +\hline +\textbf{BaseContext(System.D} & 0 & 3\\ +\hline +\end{longtable} +\subsection{File(s)} +\subsubsection{velopment\textbackslash EntityFrameworkRepository6\textbackslash EntityFrameworkRepository6\textbackslash BaseContext.cs} +\begin{longtable}[l]{lrrll} +\textbf{} & \textbf{\#} & \textbf{Line} & \textbf{} & \textbf{Line coverage}\\ +\cellcolor{gray} & & \verb~1~ & & \verb~using System.Data.Common;~\\ +\cellcolor{gray} & & \verb~2~ & & \verb~using System.Data.Entity;~\\ +\cellcolor{gray} & & \verb~3~ & & \verb~~\\ +\cellcolor{gray} & & \verb~4~ & & \verb~namespace EntityFramework.Repository6~\\ +\cellcolor{gray} & & \verb~5~ & & \verb~{~\\ +\cellcolor{gray} & & \verb~6~ & & \verb~ public class BaseContext : DbContext~\\ +\cellcolor{gray} & & \verb~7~ & & \verb~ where TContext : DbContext~\\ +\cellcolor{gray} & & \verb~8~ & & \verb~ {~\\ +\cellcolor{red} & 0 & \verb~9~ & & \verb~ static BaseContext() { }~\\ +\cellcolor{gray} & & \verb~10~ & & \verb~~\\ +\cellcolor{red} & 0 & \verb~11~ & & \verb~ protected BaseContext(DbConnection dbConnection) : base(dbConnection, ~\\ +\cellcolor{gray} & & \verb~12~ & & \verb~~\\ +\cellcolor{red} & 0 & \verb~13~ & & \verb~ protected BaseContext(DbConnection dbConnection, bool contextOwnsConne~\\ +\cellcolor{gray} & & \verb~14~ & & \verb~~\\ +\cellcolor{red} & 0 & \verb~15~ & & \verb~ protected BaseContext(string connectionString) : base(connectionString~\\ +\cellcolor{gray} & & \verb~16~ & & \verb~~\\ +\cellcolor{red} & 0 & \verb~17~ & & \verb~ protected BaseContext(string connectionString, IDatabaseInitializer :~\\ +\cellcolor{gray} & & \verb~12~ & & \verb~ IBaseRepository~\\ +\cellcolor{gray} & & \verb~13~ & & \verb~ , IDisposable~\\ +\cellcolor{gray} & & \verb~14~ & & \verb~ where T : class~\\ +\cellcolor{gray} & & \verb~15~ & & \verb~ where C : DbContext~\\ +\cellcolor{gray} & & \verb~16~ & & \verb~ {~\\ +\cellcolor{gray} & & \verb~17~ & & \verb~ protected C Context { get; set; }~\\ +\cellcolor{gray} & & \verb~18~ & & \verb~ protected Lazy> IgnoreFieldsOnUpdate = new Lazy>>> IgnoreFieldsOnUpdate2 ~\\ +\cellcolor{gray} & & \verb~20~ & & \verb~~\\ +\cellcolor{gray} & & \verb~21~ & & \verb~ protected BaseRepository(C context)~\\ +\cellcolor{gray} & & \verb~22~ & & \verb~ {~\\ +\cellcolor{gray} & & \verb~23~ & & \verb~ Context = context;~\\ +\cellcolor{gray} & & \verb~24~ & & \verb~ }~\\ +\cellcolor{gray} & & \verb~25~ & & \verb~~\\ +\cellcolor{gray} & & \verb~26~ & & \verb~ public virtual void AddUpdateIgnoreField(string fieldName)~\\ +\cellcolor{gray} & & \verb~27~ & & \verb~ {~\\ +\cellcolor{gray} & & \verb~28~ & & \verb~ IgnoreFieldsOnUpdate.Value.Add(fieldName);~\\ +\cellcolor{gray} & & \verb~29~ & & \verb~ }~\\ +\cellcolor{gray} & & \verb~30~ & & \verb~~\\ +\cellcolor{gray} & & \verb~31~ & & \verb~ public virtual void AddUpdateIgnoreField(Expression> fie~\\ +\cellcolor{gray} & & \verb~32~ & & \verb~ {~\\ +\cellcolor{gray} & & \verb~33~ & & \verb~ IgnoreFieldsOnUpdate2.Value.Add(fieldName);~\\ +\cellcolor{gray} & & \verb~34~ & & \verb~ }~\\ +\cellcolor{gray} & & \verb~35~ & & \verb~~\\ +\cellcolor{gray} & & \verb~36~ & & \verb~ public virtual T Find(int id)~\\ +\cellcolor{gray} & & \verb~37~ & & \verb~ {~\\ +\cellcolor{gray} & & \verb~38~ & & \verb~ T entity = Context.Set().Find(id);~\\ +\cellcolor{gray} & & \verb~39~ & & \verb~~\\ +\cellcolor{gray} & & \verb~40~ & & \verb~ return entity;~\\ +\cellcolor{gray} & & \verb~41~ & & \verb~ }~\\ +\cellcolor{gray} & & \verb~42~ & & \verb~~\\ +\cellcolor{gray} & & \verb~43~ & & \verb~ public virtual T Find(params object[] ids)~\\ +\cellcolor{gray} & & \verb~44~ & & \verb~ {~\\ +\cellcolor{gray} & & \verb~45~ & & \verb~ T entity = Context.Set().Find(ids);~\\ +\cellcolor{gray} & & \verb~46~ & & \verb~~\\ +\cellcolor{gray} & & \verb~47~ & & \verb~ return entity;~\\ +\cellcolor{gray} & & \verb~48~ & & \verb~ }~\\ +\cellcolor{gray} & & \verb~49~ & & \verb~~\\ +\cellcolor{gray} & & \verb~50~ & & \verb~ public virtual async Task FindAsync(int id)~\\ +\cellcolor{green} & 1 & \verb~51~ & & \verb~ {~\\ +\cellcolor{green} & 1 & \verb~52~ & & \verb~ var query = Context.Set().FindAsync(id);~\\ +\cellcolor{green} & 1 & \verb~53~ & & \verb~ return await query;~\\ +\cellcolor{green} & 1 & \verb~54~ & & \verb~ }~\\ +\cellcolor{gray} & & \verb~55~ & & \verb~~\\ +\cellcolor{gray} & & \verb~56~ & & \verb~ public virtual async Task FindAsync(params object[] ids)~\\ +\cellcolor{green} & 1 & \verb~57~ & & \verb~ {~\\ +\cellcolor{green} & 1 & \verb~58~ & & \verb~ var query = Context.Set().FindAsync(ids);~\\ +\cellcolor{green} & 1 & \verb~59~ & & \verb~ return await query;~\\ +\cellcolor{green} & 1 & \verb~60~ & & \verb~ }~\\ +\cellcolor{gray} & & \verb~61~ & & \verb~~\\ +\cellcolor{gray} & & \verb~62~ & & \verb~ public virtual IQueryable FindBy(Expression> predicat~\\ +\cellcolor{gray} & & \verb~63~ & & \verb~ {~\\ +\cellcolor{gray} & & \verb~64~ & & \verb~ IQueryable query = Context.Set().Where(predicate);~\\ +\cellcolor{gray} & & \verb~65~ & & \verb~ return query;~\\ +\cellcolor{gray} & & \verb~66~ & & \verb~ }~\\ +\cellcolor{gray} & & \verb~67~ & & \verb~~\\ +\cellcolor{gray} & & \verb~68~ & & \verb~ public virtual bool Exists(Expression> predicate)~\\ +\cellcolor{gray} & & \verb~69~ & & \verb~ {~\\ +\cellcolor{gray} & & \verb~70~ & & \verb~ return Context.Set().AsNoTracking().Any(predicate);~\\ +\cellcolor{gray} & & \verb~71~ & & \verb~ }~\\ +\cellcolor{gray} & & \verb~72~ & & \verb~~\\ +\cellcolor{gray} & & \verb~73~ & & \verb~ public virtual void Delete(T entity)~\\ +\cellcolor{gray} & & \verb~74~ & & \verb~ {~\\ +\cellcolor{gray} & & \verb~75~ & & \verb~ Context.Set().Remove(entity);~\\ +\cellcolor{gray} & & \verb~76~ & & \verb~ }~\\ +\cellcolor{gray} & & \verb~77~ & & \verb~~\\ +\cellcolor{gray} & & \verb~78~ & & \verb~ public virtual void Delete(IEnumerable entities)~\\ +\cellcolor{gray} & & \verb~79~ & & \verb~ {~\\ +\cellcolor{gray} & & \verb~80~ & & \verb~ foreach (T entity in entities)~\\ +\cellcolor{gray} & & \verb~81~ & & \verb~ {~\\ +\cellcolor{gray} & & \verb~82~ & & \verb~ Delete(entity);~\\ +\cellcolor{gray} & & \verb~83~ & & \verb~ }~\\ +\cellcolor{gray} & & \verb~84~ & & \verb~ }~\\ +\cellcolor{gray} & & \verb~85~ & & \verb~~\\ +\cellcolor{gray} & & \verb~86~ & & \verb~ public virtual void Reload(T entity)~\\ +\cellcolor{gray} & & \verb~87~ & & \verb~ {~\\ +\cellcolor{gray} & & \verb~88~ & & \verb~ Context.Entry(entity).Reload();~\\ +\cellcolor{gray} & & \verb~89~ & & \verb~ }~\\ +\cellcolor{gray} & & \verb~90~ & & \verb~~\\ +\cellcolor{gray} & & \verb~91~ & & \verb~ public async virtual Task ReloadAsync(T entity)~\\ +\cellcolor{green} & 1 & \verb~92~ & & \verb~ {~\\ +\cellcolor{green} & 1 & \verb~93~ & & \verb~ await Context.Entry(entity).ReloadAsync();~\\ +\cellcolor{green} & 1 & \verb~94~ & & \verb~ }~\\ +\cellcolor{gray} & & \verb~95~ & & \verb~~\\ +\cellcolor{gray} & & \verb~96~ & & \verb~ public virtual IQueryable FindByReadOnly(Expression> ~\\ +\cellcolor{gray} & & \verb~97~ & & \verb~ {~\\ +\cellcolor{gray} & & \verb~98~ & & \verb~ IQueryable query = Context.Set().AsNoTracking().Where(predic~\\ +\cellcolor{gray} & & \verb~99~ & & \verb~ return query;~\\ +\cellcolor{gray} & & \verb~100~ & & \verb~ }~\\ +\cellcolor{gray} & & \verb~101~ & & \verb~~\\ +\cellcolor{gray} & & \verb~102~ & & \verb~ public virtual IQueryable GetAll()~\\ +\cellcolor{gray} & & \verb~103~ & & \verb~ {~\\ +\cellcolor{gray} & & \verb~104~ & & \verb~ IQueryable query = Context.Set().AsNoTracking();~\\ +\cellcolor{gray} & & \verb~105~ & & \verb~~\\ +\cellcolor{gray} & & \verb~106~ & & \verb~ return query;~\\ +\cellcolor{gray} & & \verb~107~ & & \verb~ }~\\ +\cellcolor{gray} & & \verb~108~ & & \verb~~\\ +\cellcolor{gray} & & \verb~109~ & & \verb~ public virtual T Add(T entity)~\\ +\cellcolor{gray} & & \verb~110~ & & \verb~ {~\\ +\cellcolor{gray} & & \verb~111~ & & \verb~ Context.Set().Add(entity);~\\ +\cellcolor{gray} & & \verb~112~ & & \verb~~\\ +\cellcolor{gray} & & \verb~113~ & & \verb~ return entity;~\\ +\cellcolor{gray} & & \verb~114~ & & \verb~ }~\\ +\cellcolor{gray} & & \verb~115~ & & \verb~~\\ +\cellcolor{gray} & & \verb~116~ & & \verb~ public virtual IEnumerable Add(IEnumerable entities)~\\ +\cellcolor{gray} & & \verb~117~ & & \verb~ {~\\ +\cellcolor{gray} & & \verb~118~ & & \verb~ Context.Set().AddRange(entities);~\\ +\cellcolor{gray} & & \verb~119~ & & \verb~~\\ +\cellcolor{gray} & & \verb~120~ & & \verb~ return entities;~\\ +\cellcolor{gray} & & \verb~121~ & & \verb~ }~\\ +\cellcolor{gray} & & \verb~122~ & & \verb~~\\ +\cellcolor{gray} & & \verb~123~ & & \verb~ public virtual void Update(T entity, int id)~\\ +\cellcolor{gray} & & \verb~124~ & & \verb~ {~\\ +\cellcolor{gray} & & \verb~125~ & & \verb~ var entityToUpdate = Context.Set().Find(id);~\\ +\cellcolor{gray} & & \verb~126~ & & \verb~~\\ +\cellcolor{gray} & & \verb~127~ & & \verb~ if (entityToUpdate == null) throw CreateEntityNotFoundException> predica~\\ +\cellcolor{gray} & & \verb~135~ & & \verb~ {~\\ +\cellcolor{gray} & & \verb~136~ & & \verb~ var entityToUpdate = Context.Set().Where(predicate).SingleOrDef~\\ +\cellcolor{gray} & & \verb~137~ & & \verb~~\\ +\cellcolor{gray} & & \verb~138~ & & \verb~ if (entityToUpdate == null) throw CreateEntityNotFoundException delta, params object[] ids)~\\ +\cellcolor{gray} & & \verb~146~ & & \verb~ {~\\ +\cellcolor{gray} & & \verb~147~ & & \verb~ var entityToUpdate = Context.Set().Find(ids);~\\ +\cellcolor{gray} & & \verb~148~ & & \verb~~\\ +\cellcolor{gray} & & \verb~149~ & & \verb~ if (entityToUpdate == null) throw CreateEntityNotFoundException delta, Expression> predicate~\\ +\cellcolor{gray} & & \verb~163~ & & \verb~ {~\\ +\cellcolor{gray} & & \verb~164~ & & \verb~ var entityToUpdate = Context.Set().Where(predicate).SingleOrDef~\\ +\cellcolor{gray} & & \verb~165~ & & \verb~~\\ +\cellcolor{gray} & & \verb~166~ & & \verb~ if (entityToUpdate == null) throw CreateEntityNotFoundException(string entityId, ~\\ +\cellcolor{gray} & & \verb~180~ & & \verb~ {~\\ +\cellcolor{gray} & & \verb~181~ & & \verb~ return (E)Activator.CreateInstance(typeof(E), string.Format("{0} i~\\ +\cellcolor{gray} & & \verb~182~ & & \verb~ }~\\ +\cellcolor{gray} & & \verb~183~ & & \verb~~\\ +\cellcolor{gray} & & \verb~184~ & & \verb~ protected virtual void MarkIgnoreFields(T entityToUpdate)~\\ +\cellcolor{gray} & & \verb~185~ & & \verb~ {~\\ +\cellcolor{gray} & & \verb~186~ & & \verb~ if(IgnoreFieldsOnUpdate.IsValueCreated)~\\ +\cellcolor{green} & 1 & \verb~187~ & & \verb~ { IgnoreFieldsOnUpdate.Value.ForEach(ignoreField => Context.Entry(~\\ +\cellcolor{gray} & & \verb~188~ & & \verb~~\\ +\cellcolor{gray} & & \verb~189~ & & \verb~~\\ +\cellcolor{gray} & & \verb~190~ & & \verb~ if(IgnoreFieldsOnUpdate2.IsValueCreated)~\\ +\cellcolor{red} & 0 & \verb~191~ & & \verb~ { IgnoreFieldsOnUpdate2.Value.ForEach(ignoreField => Context.Entry~\\ +\cellcolor{gray} & & \verb~192~ & & \verb~ }~\\ +\cellcolor{gray} & & \verb~193~ & & \verb~~\\ +\cellcolor{gray} & & \verb~194~ & & \verb~ public async virtual Task SaveAsync()~\\ +\cellcolor{red} & 0 & \verb~195~ & & \verb~ {~\\ +\cellcolor{red} & 0 & \verb~196~ & & \verb~ return await Context.SaveChangesAsync();~\\ +\cellcolor{red} & 0 & \verb~197~ & & \verb~ }~\\ +\cellcolor{gray} & & \verb~198~ & & \verb~~\\ +\cellcolor{gray} & & \verb~199~ & & \verb~ public virtual int Save()~\\ +\cellcolor{gray} & & \verb~200~ & & \verb~ {~\\ +\cellcolor{gray} & & \verb~201~ & & \verb~ return Context.SaveChanges();~\\ +\cellcolor{gray} & & \verb~202~ & & \verb~ }~\\ +\cellcolor{gray} & & \verb~203~ & & \verb~~\\ +\cellcolor{gray} & & \verb~204~ & & \verb~ public virtual int Count()~\\ +\cellcolor{gray} & & \verb~205~ & & \verb~ {~\\ +\cellcolor{gray} & & \verb~206~ & & \verb~ return Context.Set().Count();~\\ +\cellcolor{gray} & & \verb~207~ & & \verb~ }~\\ +\cellcolor{gray} & & \verb~208~ & & \verb~~\\ +\cellcolor{gray} & & \verb~209~ & & \verb~ public async virtual Task CountAsync()~\\ +\cellcolor{red} & 0 & \verb~210~ & & \verb~ {~\\ +\cellcolor{red} & 0 & \verb~211~ & & \verb~ return await Context.Set().CountAsync();~\\ +\cellcolor{red} & 0 & \verb~212~ & & \verb~ }~\\ +\cellcolor{gray} & & \verb~213~ & & \verb~~\\ +\cellcolor{gray} & & \verb~214~ & & \verb~ #region IDisposable Support~\\ +\cellcolor{gray} & & \verb~215~ & & \verb~ private bool disposedValue = false; // To detect redundant calls~\\ +\cellcolor{gray} & & \verb~216~ & & \verb~~\\ +\cellcolor{gray} & & \verb~217~ & & \verb~ protected virtual void Dispose(bool disposing)~\\ +\cellcolor{gray} & & \verb~218~ & & \verb~ {~\\ +\cellcolor{gray} & & \verb~219~ & & \verb~ if (!disposedValue)~\\ +\cellcolor{gray} & & \verb~220~ & & \verb~ {~\\ +\cellcolor{gray} & & \verb~221~ & & \verb~ if (disposing)~\\ +\cellcolor{gray} & & \verb~222~ & & \verb~ {~\\ +\cellcolor{gray} & & \verb~223~ & & \verb~ if (Context != null)~\\ +\cellcolor{gray} & & \verb~224~ & & \verb~ {~\\ +\cellcolor{gray} & & \verb~225~ & & \verb~ Context.Dispose();~\\ +\cellcolor{gray} & & \verb~226~ & & \verb~ Context = null;~\\ +\cellcolor{gray} & & \verb~227~ & & \verb~ }~\\ +\cellcolor{gray} & & \verb~228~ & & \verb~ }~\\ +\cellcolor{gray} & & \verb~229~ & & \verb~~\\ +\cellcolor{gray} & & \verb~230~ & & \verb~ disposedValue = true;~\\ +\cellcolor{gray} & & \verb~231~ & & \verb~ }~\\ +\cellcolor{gray} & & \verb~232~ & & \verb~ }~\\ +\cellcolor{gray} & & \verb~233~ & & \verb~~\\ +\cellcolor{gray} & & \verb~234~ & & \verb~ public void Dispose()~\\ +\cellcolor{gray} & & \verb~235~ & & \verb~ {~\\ +\cellcolor{gray} & & \verb~236~ & & \verb~ Dispose(true);~\\ +\cellcolor{gray} & & \verb~237~ & & \verb~ }~\\ +\cellcolor{gray} & & \verb~238~ & & \verb~ #endregion~\\ +\cellcolor{gray} & & \verb~239~ & & \verb~~\\ +\cellcolor{gray} & & \verb~240~ & & \verb~ }~\\ +\cellcolor{gray} & & \verb~241~ & & \verb~}~\\ +\end{longtable} +\newpage +\section{EntityFramework.Repository6.BaseRepository} +\subsection{Summary} +\begin{longtable}[l]{ll} +\textbf{Class:} & EntityFramework.Repository6.BaseRepository\\ +\textbf{Assembly:} & entityframework.auditable.repository6.dll\\ +\textbf{File(s):} & \begin{minipage}[t]{12cm}{opment\textbackslash EntityFrameworkRepository6\textbackslash EntityFrameworkRepository6\textbackslash BaseRepository.cs}\end{minipage} \\ +\textbf{Covered lines:} & 119\\ +\textbf{Uncovered lines:} & 4\\ +\textbf{Coverable lines:} & 123\\ +\textbf{Total lines:} & 241\\ +\textbf{Line coverage:} & 96.7\%\\ +\end{longtable} +\subsection{Metrics} +\begin{longtable}[l]{|l|l|l|} +\hline +\textbf{Method} & \textbf{Blocks covered} & \textbf{Blocks not covered}\\ +\hline +\textbf{BaseRepository(C)} & 5 & 0\\ +\hline +\textbf{AddUpdateIgnoreField} & 3 & 0\\ +\hline +\textbf{AddUpdateIgnoreField} & 0 & 3\\ +\hline +\textbf{Find(int)} & 5 & 0\\ +\hline +\textbf{Find(object[])} & 5 & 0\\ +\hline +\textbf{FindBy(System.Linq.E} & 5 & 0\\ +\hline +\textbf{Exists(System.Linq.E} & 6 & 0\\ +\hline +\textbf{Delete(T)} & 4 & 0\\ +\hline +\textbf{Delete(System.Collec} & 9 & 0\\ +\hline +\textbf{Reload(T)} & 4 & 0\\ +\hline +\textbf{FindByReadOnly(Syste} & 6 & 0\\ +\hline +\textbf{GetAll()} & 5 & 0\\ +\hline +\textbf{Add(T)} & 5 & 0\\ +\hline +\textbf{Add(System.Collectio} & 5 & 0\\ +\hline +\textbf{Update(T, int)} & 10 & 5\\ +\hline +\textbf{Update(T, System.Lin} & 16 & 0\\ +\hline +\textbf{Update(EntityFramewo} & 27 & 0\\ +\hline +\textbf{Update(EntityFramewo} & 28 & 0\\ +\hline +\textbf{CreateEntityNotFound} & 5 & 0\\ +\hline +\textbf{MarkIgnoreFields(T)} & 9 & 4\\ +\hline +\textbf{Save()} & 4 & 0\\ +\hline +\textbf{Count()} & 5 & 0\\ +\hline +\textbf{Dispose(bool)} & 11 & 0\\ +\hline +\textbf{Dispose()} & 2 & 0\\ +\hline +\end{longtable} +\subsection{File(s)} +\subsubsection{opment\textbackslash EntityFrameworkRepository6\textbackslash EntityFrameworkRepository6\textbackslash BaseRepository.cs} +\begin{longtable}[l]{lrrll} +\textbf{} & \textbf{\#} & \textbf{Line} & \textbf{} & \textbf{Line coverage}\\ +\cellcolor{gray} & & \verb~1~ & & \verb~using EntityFramework.Repository6.Interfaces;~\\ +\cellcolor{gray} & & \verb~2~ & & \verb~using System;~\\ +\cellcolor{gray} & & \verb~3~ & & \verb~using System.Collections.Generic;~\\ +\cellcolor{gray} & & \verb~4~ & & \verb~using System.Data.Entity;~\\ +\cellcolor{gray} & & \verb~5~ & & \verb~using System.Linq;~\\ +\cellcolor{gray} & & \verb~6~ & & \verb~using System.Linq.Expressions;~\\ +\cellcolor{gray} & & \verb~7~ & & \verb~using System.Threading.Tasks;~\\ +\cellcolor{gray} & & \verb~8~ & & \verb~~\\ +\cellcolor{gray} & & \verb~9~ & & \verb~namespace EntityFramework.Repository6~\\ +\cellcolor{gray} & & \verb~10~ & & \verb~{~\\ +\cellcolor{gray} & & \verb~11~ & & \verb~ public abstract class BaseRepository :~\\ +\cellcolor{gray} & & \verb~12~ & & \verb~ IBaseRepository~\\ +\cellcolor{gray} & & \verb~13~ & & \verb~ , IDisposable~\\ +\cellcolor{gray} & & \verb~14~ & & \verb~ where T : class~\\ +\cellcolor{gray} & & \verb~15~ & & \verb~ where C : DbContext~\\ +\cellcolor{gray} & & \verb~16~ & & \verb~ {~\\ +\cellcolor{green} & 1 & \verb~17~ & & \verb~ protected C Context { get; set; }~\\ +\cellcolor{green} & 1 & \verb~18~ & & \verb~ protected Lazy> IgnoreFieldsOnUpdate = new Lazy>>> IgnoreFieldsOnUpdate2 ~\\ +\cellcolor{gray} & & \verb~20~ & & \verb~~\\ +\cellcolor{green} & 1 & \verb~21~ & & \verb~ protected BaseRepository(C context)~\\ +\cellcolor{green} & 1 & \verb~22~ & & \verb~ {~\\ +\cellcolor{green} & 1 & \verb~23~ & & \verb~ Context = context;~\\ +\cellcolor{green} & 1 & \verb~24~ & & \verb~ }~\\ +\cellcolor{gray} & & \verb~25~ & & \verb~~\\ +\cellcolor{gray} & & \verb~26~ & & \verb~ public virtual void AddUpdateIgnoreField(string fieldName)~\\ +\cellcolor{green} & 1 & \verb~27~ & & \verb~ {~\\ +\cellcolor{green} & 1 & \verb~28~ & & \verb~ IgnoreFieldsOnUpdate.Value.Add(fieldName);~\\ +\cellcolor{green} & 1 & \verb~29~ & & \verb~ }~\\ +\cellcolor{gray} & & \verb~30~ & & \verb~~\\ +\cellcolor{gray} & & \verb~31~ & & \verb~ public virtual void AddUpdateIgnoreField(Expression> fie~\\ +\cellcolor{red} & 0 & \verb~32~ & & \verb~ {~\\ +\cellcolor{red} & 0 & \verb~33~ & & \verb~ IgnoreFieldsOnUpdate2.Value.Add(fieldName);~\\ +\cellcolor{red} & 0 & \verb~34~ & & \verb~ }~\\ +\cellcolor{gray} & & \verb~35~ & & \verb~~\\ +\cellcolor{gray} & & \verb~36~ & & \verb~ public virtual T Find(int id)~\\ +\cellcolor{green} & 1 & \verb~37~ & & \verb~ {~\\ +\cellcolor{green} & 1 & \verb~38~ & & \verb~ T entity = Context.Set().Find(id);~\\ +\cellcolor{gray} & & \verb~39~ & & \verb~~\\ +\cellcolor{green} & 1 & \verb~40~ & & \verb~ return entity;~\\ +\cellcolor{green} & 1 & \verb~41~ & & \verb~ }~\\ +\cellcolor{gray} & & \verb~42~ & & \verb~~\\ +\cellcolor{gray} & & \verb~43~ & & \verb~ public virtual T Find(params object[] ids)~\\ +\cellcolor{green} & 1 & \verb~44~ & & \verb~ {~\\ +\cellcolor{green} & 1 & \verb~45~ & & \verb~ T entity = Context.Set().Find(ids);~\\ +\cellcolor{gray} & & \verb~46~ & & \verb~~\\ +\cellcolor{green} & 1 & \verb~47~ & & \verb~ return entity;~\\ +\cellcolor{green} & 1 & \verb~48~ & & \verb~ }~\\ +\cellcolor{gray} & & \verb~49~ & & \verb~~\\ +\cellcolor{gray} & & \verb~50~ & & \verb~ public virtual async Task FindAsync(int id)~\\ +\cellcolor{gray} & & \verb~51~ & & \verb~ {~\\ +\cellcolor{gray} & & \verb~52~ & & \verb~ var query = Context.Set().FindAsync(id);~\\ +\cellcolor{gray} & & \verb~53~ & & \verb~ return await query;~\\ +\cellcolor{gray} & & \verb~54~ & & \verb~ }~\\ +\cellcolor{gray} & & \verb~55~ & & \verb~~\\ +\cellcolor{gray} & & \verb~56~ & & \verb~ public virtual async Task FindAsync(params object[] ids)~\\ +\cellcolor{gray} & & \verb~57~ & & \verb~ {~\\ +\cellcolor{gray} & & \verb~58~ & & \verb~ var query = Context.Set().FindAsync(ids);~\\ +\cellcolor{gray} & & \verb~59~ & & \verb~ return await query;~\\ +\cellcolor{gray} & & \verb~60~ & & \verb~ }~\\ +\cellcolor{gray} & & \verb~61~ & & \verb~~\\ +\cellcolor{gray} & & \verb~62~ & & \verb~ public virtual IQueryable FindBy(Expression> predicat~\\ +\cellcolor{green} & 1 & \verb~63~ & & \verb~ {~\\ +\cellcolor{green} & 1 & \verb~64~ & & \verb~ IQueryable query = Context.Set().Where(predicate);~\\ +\cellcolor{green} & 1 & \verb~65~ & & \verb~ return query;~\\ +\cellcolor{green} & 1 & \verb~66~ & & \verb~ }~\\ +\cellcolor{gray} & & \verb~67~ & & \verb~~\\ +\cellcolor{gray} & & \verb~68~ & & \verb~ public virtual bool Exists(Expression> predicate)~\\ +\cellcolor{green} & 1 & \verb~69~ & & \verb~ {~\\ +\cellcolor{green} & 1 & \verb~70~ & & \verb~ return Context.Set().AsNoTracking().Any(predicate);~\\ +\cellcolor{green} & 1 & \verb~71~ & & \verb~ }~\\ +\cellcolor{gray} & & \verb~72~ & & \verb~~\\ +\cellcolor{gray} & & \verb~73~ & & \verb~ public virtual void Delete(T entity)~\\ +\cellcolor{green} & 1 & \verb~74~ & & \verb~ {~\\ +\cellcolor{green} & 1 & \verb~75~ & & \verb~ Context.Set().Remove(entity);~\\ +\cellcolor{green} & 1 & \verb~76~ & & \verb~ }~\\ +\cellcolor{gray} & & \verb~77~ & & \verb~~\\ +\cellcolor{gray} & & \verb~78~ & & \verb~ public virtual void Delete(IEnumerable entities)~\\ +\cellcolor{green} & 1 & \verb~79~ & & \verb~ {~\\ +\cellcolor{green} & 1 & \verb~80~ & & \verb~ foreach (T entity in entities)~\\ +\cellcolor{green} & 1 & \verb~81~ & & \verb~ {~\\ +\cellcolor{green} & 1 & \verb~82~ & & \verb~ Delete(entity);~\\ +\cellcolor{green} & 1 & \verb~83~ & & \verb~ }~\\ +\cellcolor{green} & 1 & \verb~84~ & & \verb~ }~\\ +\cellcolor{gray} & & \verb~85~ & & \verb~~\\ +\cellcolor{gray} & & \verb~86~ & & \verb~ public virtual void Reload(T entity)~\\ +\cellcolor{green} & 1 & \verb~87~ & & \verb~ {~\\ +\cellcolor{green} & 1 & \verb~88~ & & \verb~ Context.Entry(entity).Reload();~\\ +\cellcolor{green} & 1 & \verb~89~ & & \verb~ }~\\ +\cellcolor{gray} & & \verb~90~ & & \verb~~\\ +\cellcolor{gray} & & \verb~91~ & & \verb~ public async virtual Task ReloadAsync(T entity)~\\ +\cellcolor{gray} & & \verb~92~ & & \verb~ {~\\ +\cellcolor{gray} & & \verb~93~ & & \verb~ await Context.Entry(entity).ReloadAsync();~\\ +\cellcolor{gray} & & \verb~94~ & & \verb~ }~\\ +\cellcolor{gray} & & \verb~95~ & & \verb~~\\ +\cellcolor{gray} & & \verb~96~ & & \verb~ public virtual IQueryable FindByReadOnly(Expression> ~\\ +\cellcolor{green} & 1 & \verb~97~ & & \verb~ {~\\ +\cellcolor{green} & 1 & \verb~98~ & & \verb~ IQueryable query = Context.Set().AsNoTracking().Where(predic~\\ +\cellcolor{green} & 1 & \verb~99~ & & \verb~ return query;~\\ +\cellcolor{green} & 1 & \verb~100~ & & \verb~ }~\\ +\cellcolor{gray} & & \verb~101~ & & \verb~~\\ +\cellcolor{gray} & & \verb~102~ & & \verb~ public virtual IQueryable GetAll()~\\ +\cellcolor{green} & 1 & \verb~103~ & & \verb~ {~\\ +\cellcolor{green} & 1 & \verb~104~ & & \verb~ IQueryable query = Context.Set().AsNoTracking();~\\ +\cellcolor{gray} & & \verb~105~ & & \verb~~\\ +\cellcolor{green} & 1 & \verb~106~ & & \verb~ return query;~\\ +\cellcolor{green} & 1 & \verb~107~ & & \verb~ }~\\ +\cellcolor{gray} & & \verb~108~ & & \verb~~\\ +\cellcolor{gray} & & \verb~109~ & & \verb~ public virtual T Add(T entity)~\\ +\cellcolor{green} & 1 & \verb~110~ & & \verb~ {~\\ +\cellcolor{green} & 1 & \verb~111~ & & \verb~ Context.Set().Add(entity);~\\ +\cellcolor{gray} & & \verb~112~ & & \verb~~\\ +\cellcolor{green} & 1 & \verb~113~ & & \verb~ return entity;~\\ +\cellcolor{green} & 1 & \verb~114~ & & \verb~ }~\\ +\cellcolor{gray} & & \verb~115~ & & \verb~~\\ +\cellcolor{gray} & & \verb~116~ & & \verb~ public virtual IEnumerable Add(IEnumerable entities)~\\ +\cellcolor{green} & 1 & \verb~117~ & & \verb~ {~\\ +\cellcolor{green} & 1 & \verb~118~ & & \verb~ Context.Set().AddRange(entities);~\\ +\cellcolor{gray} & & \verb~119~ & & \verb~~\\ +\cellcolor{green} & 1 & \verb~120~ & & \verb~ return entities;~\\ +\cellcolor{green} & 1 & \verb~121~ & & \verb~ }~\\ +\cellcolor{gray} & & \verb~122~ & & \verb~~\\ +\cellcolor{gray} & & \verb~123~ & & \verb~ public virtual void Update(T entity, int id)~\\ +\cellcolor{green} & 1 & \verb~124~ & & \verb~ {~\\ +\cellcolor{green} & 1 & \verb~125~ & & \verb~ var entityToUpdate = Context.Set().Find(id);~\\ +\cellcolor{gray} & & \verb~126~ & & \verb~~\\ +\cellcolor{green} & 1 & \verb~127~ & & \verb~ if (entityToUpdate == null) throw CreateEntityNotFoundException> predica~\\ +\cellcolor{green} & 1 & \verb~135~ & & \verb~ {~\\ +\cellcolor{green} & 1 & \verb~136~ & & \verb~ var entityToUpdate = Context.Set().Where(predicate).SingleOrDef~\\ +\cellcolor{gray} & & \verb~137~ & & \verb~~\\ +\cellcolor{green} & 1 & \verb~138~ & & \verb~ if (entityToUpdate == null) throw CreateEntityNotFoundException delta, params object[] ids)~\\ +\cellcolor{green} & 1 & \verb~146~ & & \verb~ {~\\ +\cellcolor{green} & 1 & \verb~147~ & & \verb~ var entityToUpdate = Context.Set().Find(ids);~\\ +\cellcolor{gray} & & \verb~148~ & & \verb~~\\ +\cellcolor{green} & 1 & \verb~149~ & & \verb~ if (entityToUpdate == null) throw CreateEntityNotFoundException delta, Expression> predicate~\\ +\cellcolor{green} & 1 & \verb~163~ & & \verb~ {~\\ +\cellcolor{green} & 1 & \verb~164~ & & \verb~ var entityToUpdate = Context.Set().Where(predicate).SingleOrDef~\\ +\cellcolor{gray} & & \verb~165~ & & \verb~~\\ +\cellcolor{green} & 1 & \verb~166~ & & \verb~ if (entityToUpdate == null) throw CreateEntityNotFoundException(string entityId, ~\\ +\cellcolor{green} & 1 & \verb~180~ & & \verb~ {~\\ +\cellcolor{green} & 1 & \verb~181~ & & \verb~ return (E)Activator.CreateInstance(typeof(E), string.Format("{0} i~\\ +\cellcolor{green} & 1 & \verb~182~ & & \verb~ }~\\ +\cellcolor{gray} & & \verb~183~ & & \verb~~\\ +\cellcolor{gray} & & \verb~184~ & & \verb~ protected virtual void MarkIgnoreFields(T entityToUpdate)~\\ +\cellcolor{green} & 1 & \verb~185~ & & \verb~ {~\\ +\cellcolor{green} & 1 & \verb~186~ & & \verb~ if(IgnoreFieldsOnUpdate.IsValueCreated)~\\ +\cellcolor{green} & 1 & \verb~187~ & & \verb~ { IgnoreFieldsOnUpdate.Value.ForEach(ignoreField => Context.Entry(~\\ +\cellcolor{gray} & & \verb~188~ & & \verb~~\\ +\cellcolor{gray} & & \verb~189~ & & \verb~~\\ +\cellcolor{green} & 1 & \verb~190~ & & \verb~ if(IgnoreFieldsOnUpdate2.IsValueCreated)~\\ +\cellcolor{red} & 0 & \verb~191~ & & \verb~ { IgnoreFieldsOnUpdate2.Value.ForEach(ignoreField => Context.Entry~\\ +\cellcolor{green} & 1 & \verb~192~ & & \verb~ }~\\ +\cellcolor{gray} & & \verb~193~ & & \verb~~\\ +\cellcolor{gray} & & \verb~194~ & & \verb~ public async virtual Task SaveAsync()~\\ +\cellcolor{gray} & & \verb~195~ & & \verb~ {~\\ +\cellcolor{gray} & & \verb~196~ & & \verb~ return await Context.SaveChangesAsync();~\\ +\cellcolor{gray} & & \verb~197~ & & \verb~ }~\\ +\cellcolor{gray} & & \verb~198~ & & \verb~~\\ +\cellcolor{gray} & & \verb~199~ & & \verb~ public virtual int Save()~\\ +\cellcolor{green} & 1 & \verb~200~ & & \verb~ {~\\ +\cellcolor{green} & 1 & \verb~201~ & & \verb~ return Context.SaveChanges();~\\ +\cellcolor{green} & 1 & \verb~202~ & & \verb~ }~\\ +\cellcolor{gray} & & \verb~203~ & & \verb~~\\ +\cellcolor{gray} & & \verb~204~ & & \verb~ public virtual int Count()~\\ +\cellcolor{green} & 1 & \verb~205~ & & \verb~ {~\\ +\cellcolor{green} & 1 & \verb~206~ & & \verb~ return Context.Set().Count();~\\ +\cellcolor{green} & 1 & \verb~207~ & & \verb~ }~\\ +\cellcolor{gray} & & \verb~208~ & & \verb~~\\ +\cellcolor{gray} & & \verb~209~ & & \verb~ public async virtual Task CountAsync()~\\ +\cellcolor{gray} & & \verb~210~ & & \verb~ {~\\ +\cellcolor{gray} & & \verb~211~ & & \verb~ return await Context.Set().CountAsync();~\\ +\cellcolor{gray} & & \verb~212~ & & \verb~ }~\\ +\cellcolor{gray} & & \verb~213~ & & \verb~~\\ +\cellcolor{gray} & & \verb~214~ & & \verb~ #region IDisposable Support~\\ +\cellcolor{green} & 1 & \verb~215~ & & \verb~ private bool disposedValue = false; // To detect redundant calls~\\ +\cellcolor{gray} & & \verb~216~ & & \verb~~\\ +\cellcolor{gray} & & \verb~217~ & & \verb~ protected virtual void Dispose(bool disposing)~\\ +\cellcolor{green} & 1 & \verb~218~ & & \verb~ {~\\ +\cellcolor{green} & 1 & \verb~219~ & & \verb~ if (!disposedValue)~\\ +\cellcolor{green} & 1 & \verb~220~ & & \verb~ {~\\ +\cellcolor{green} & 1 & \verb~221~ & & \verb~ if (disposing)~\\ +\cellcolor{green} & 1 & \verb~222~ & & \verb~ {~\\ +\cellcolor{green} & 1 & \verb~223~ & & \verb~ if (Context != null)~\\ +\cellcolor{green} & 1 & \verb~224~ & & \verb~ {~\\ +\cellcolor{green} & 1 & \verb~225~ & & \verb~ Context.Dispose();~\\ +\cellcolor{green} & 1 & \verb~226~ & & \verb~ Context = null;~\\ +\cellcolor{green} & 1 & \verb~227~ & & \verb~ }~\\ +\cellcolor{green} & 1 & \verb~228~ & & \verb~ }~\\ +\cellcolor{gray} & & \verb~229~ & & \verb~~\\ +\cellcolor{green} & 1 & \verb~230~ & & \verb~ disposedValue = true;~\\ +\cellcolor{green} & 1 & \verb~231~ & & \verb~ }~\\ +\cellcolor{green} & 1 & \verb~232~ & & \verb~ }~\\ +\cellcolor{gray} & & \verb~233~ & & \verb~~\\ +\cellcolor{gray} & & \verb~234~ & & \verb~ public void Dispose()~\\ +\cellcolor{green} & 1 & \verb~235~ & & \verb~ {~\\ +\cellcolor{green} & 1 & \verb~236~ & & \verb~ Dispose(true);~\\ +\cellcolor{green} & 1 & \verb~237~ & & \verb~ }~\\ +\cellcolor{gray} & & \verb~238~ & & \verb~ #endregion~\\ +\cellcolor{gray} & & \verb~239~ & & \verb~~\\ +\cellcolor{gray} & & \verb~240~ & & \verb~ }~\\ +\cellcolor{gray} & & \verb~241~ & & \verb~}~\\ +\end{longtable} +\newpage +\section{EntityFramework.Repository6.DatabaseFactory} +\subsection{Summary} +\begin{longtable}[l]{ll} +\textbf{Class:} & EntityFramework.Repository6.DatabaseFactory\\ +\textbf{Assembly:} & entityframework.auditable.repository6.dll\\ +\textbf{File(s):} & \begin{minipage}[t]{12cm}{pment\textbackslash EntityFrameworkRepository6\textbackslash EntityFrameworkRepository6\textbackslash DatabaseFactory.cs}\end{minipage} \\ +\textbf{Covered lines:} & 0\\ +\textbf{Uncovered lines:} & 11\\ +\textbf{Coverable lines:} & 11\\ +\textbf{Total lines:} & 33\\ +\textbf{Line coverage:} & 0\%\\ +\end{longtable} +\subsection{Metrics} +\begin{longtable}[l]{|l|l|l|} +\hline +\textbf{Method} & \textbf{Blocks covered} & \textbf{Blocks not covered}\\ +\hline +\textbf{DatabaseFactory(stri} & 0 & 3\\ +\hline +\textbf{GetNewDbContext()} & 0 & 11\\ +\hline +\end{longtable} +\subsection{File(s)} +\subsubsection{pment\textbackslash EntityFrameworkRepository6\textbackslash EntityFrameworkRepository6\textbackslash DatabaseFactory.cs} +\begin{longtable}[l]{lrrll} +\textbf{} & \textbf{\#} & \textbf{Line} & \textbf{} & \textbf{Line coverage}\\ +\cellcolor{gray} & & \verb~1~ & & \verb~using System;~\\ +\cellcolor{gray} & & \verb~2~ & & \verb~using System.Data.Entity;~\\ +\cellcolor{gray} & & \verb~3~ & & \verb~~\\ +\cellcolor{gray} & & \verb~4~ & & \verb~namespace EntityFramework.Repository6~\\ +\cellcolor{gray} & & \verb~5~ & & \verb~{~\\ +\cellcolor{gray} & & \verb~6~ & & \verb~ public interface IDatabaseFactory~\\ +\cellcolor{gray} & & \verb~7~ & & \verb~ {~\\ +\cellcolor{gray} & & \verb~8~ & & \verb~ C GetNewDbContext();~\\ +\cellcolor{gray} & & \verb~9~ & & \verb~ Action Logging { get; set; }~\\ +\cellcolor{gray} & & \verb~10~ & & \verb~ }~\\ +\cellcolor{gray} & & \verb~11~ & & \verb~~\\ +\cellcolor{gray} & & \verb~12~ & & \verb~ public class DatabaseFactory : IDatabaseFactory~\\ +\cellcolor{gray} & & \verb~13~ & & \verb~ where C : DbContext~\\ +\cellcolor{gray} & & \verb~14~ & & \verb~ {~\\ +\cellcolor{red} & 0 & \verb~15~ & & \verb~ public Action Logging { get; set; }~\\ +\cellcolor{gray} & & \verb~16~ & & \verb~~\\ +\cellcolor{red} & 0 & \verb~17~ & & \verb~ protected string dbConnectionString { get; set; }~\\ +\cellcolor{gray} & & \verb~18~ & & \verb~~\\ +\cellcolor{red} & 0 & \verb~19~ & & \verb~ public DatabaseFactory(string connectionString)~\\ +\cellcolor{red} & 0 & \verb~20~ & & \verb~ {~\\ +\cellcolor{red} & 0 & \verb~21~ & & \verb~ dbConnectionString = connectionString;~\\ +\cellcolor{red} & 0 & \verb~22~ & & \verb~ }~\\ +\cellcolor{gray} & & \verb~23~ & & \verb~~\\ +\cellcolor{gray} & & \verb~24~ & & \verb~ public virtual C GetNewDbContext()~\\ +\cellcolor{red} & 0 & \verb~25~ & & \verb~ {~\\ +\cellcolor{red} & 0 & \verb~26~ & & \verb~ var newContext = (C)Activator.CreateInstance(typeof(C), dbConnecti~\\ +\cellcolor{gray} & & \verb~27~ & & \verb~~\\ +\cellcolor{red} & 0 & \verb~28~ & & \verb~ if (Logging != null) { newContext.Database.Log = Logging; }~\\ +\cellcolor{gray} & & \verb~29~ & & \verb~~\\ +\cellcolor{red} & 0 & \verb~30~ & & \verb~ return newContext;~\\ +\cellcolor{red} & 0 & \verb~31~ & & \verb~ }~\\ +\cellcolor{gray} & & \verb~32~ & & \verb~ }~\\ +\cellcolor{gray} & & \verb~33~ & & \verb~}~\\ +\end{longtable} +\newpage +\section{EntityFramework.Repository6.Delta} +\subsection{Summary} +\begin{longtable}[l]{ll} +\textbf{Class:} & EntityFramework.Repository6.Delta\\ +\textbf{Assembly:} & entityframework.auditable.repository6.dll\\ +\textbf{File(s):} & \begin{minipage}[t]{12cm}{velopment\textbackslash EntityFrameworkRepository6\textbackslash EntityFramework.SharedRepository\textbackslash Delta.cs}\end{minipage} \\ +\textbf{Covered lines:} & 23\\ +\textbf{Uncovered lines:} & 0\\ +\textbf{Coverable lines:} & 23\\ +\textbf{Total lines:} & 43\\ +\textbf{Line coverage:} & 100\%\\ +\end{longtable} +\subsection{Metrics} +\begin{longtable}[l]{|l|l|l|} +\hline +\textbf{Method} & \textbf{Blocks covered} & \textbf{Blocks not covered}\\ +\hline +\textbf{UpdatedFields()} & 3 & 0\\ +\hline +\textbf{Delta()} & 7 & 0\\ +\hline +\textbf{SetValue(string, obj} & 14 & 0\\ +\hline +\end{longtable} +\subsection{File(s)} +\subsubsection{velopment\textbackslash EntityFrameworkRepository6\textbackslash EntityFramework.SharedRepository\textbackslash Delta.cs} +\begin{longtable}[l]{lrrll} +\textbf{} & \textbf{\#} & \textbf{Line} & \textbf{} & \textbf{Line coverage}\\ +\cellcolor{gray} & & \verb~1~ & & \verb~using System;~\\ +\cellcolor{gray} & & \verb~2~ & & \verb~using System.Collections.Generic;~\\ +\cellcolor{gray} & & \verb~3~ & & \verb~using System.Linq;~\\ +\cellcolor{gray} & & \verb~4~ & & \verb~using System.Text;~\\ +\cellcolor{gray} & & \verb~5~ & & \verb~using System.Threading.Tasks;~\\ +\cellcolor{gray} & & \verb~6~ & & \verb~~\\ +\cellcolor{gray} & & \verb~7~ & & \verb~namespace EntityFramework.Repository6~\\ +\cellcolor{gray} & & \verb~8~ & & \verb~{~\\ +\cellcolor{gray} & & \verb~9~ & & \verb~ public class Delta where T : class~\\ +\cellcolor{gray} & & \verb~10~ & & \verb~ {~\\ +\cellcolor{green} & 1 & \verb~11~ & & \verb~ List Fields { get; set; }~\\ +\cellcolor{green} & 1 & \verb~12~ & & \verb~ public T Internal { get; set; }~\\ +\cellcolor{gray} & & \verb~13~ & & \verb~~\\ +\cellcolor{gray} & & \verb~14~ & & \verb~ public List UpdatedFields()~\\ +\cellcolor{green} & 1 & \verb~15~ & & \verb~ {~\\ +\cellcolor{green} & 1 & \verb~16~ & & \verb~ return Fields;~\\ +\cellcolor{green} & 1 & \verb~17~ & & \verb~ }~\\ +\cellcolor{gray} & & \verb~18~ & & \verb~~\\ +\cellcolor{green} & 1 & \verb~19~ & & \verb~ public Delta()~\\ +\cellcolor{green} & 1 & \verb~20~ & & \verb~ {~\\ +\cellcolor{green} & 1 & \verb~21~ & & \verb~ Internal = (T)Activator.CreateInstance(typeof(T));~\\ +\cellcolor{green} & 1 & \verb~22~ & & \verb~ Fields = new List();~\\ +\cellcolor{green} & 1 & \verb~23~ & & \verb~ }~\\ +\cellcolor{gray} & & \verb~24~ & & \verb~~\\ +\cellcolor{gray} & & \verb~25~ & & \verb~ public void SetValue(string fieldName, object data)~\\ +\cellcolor{green} & 1 & \verb~26~ & & \verb~ {~\\ +\cellcolor{green} & 1 & \verb~27~ & & \verb~ var prop1 = typeof(T).GetProperty(fieldName);~\\ +\cellcolor{green} & 1 & \verb~28~ & & \verb~ if (prop1 == null)~\\ +\cellcolor{green} & 1 & \verb~29~ & & \verb~ {~\\ +\cellcolor{green} & 1 & \verb~30~ & & \verb~ throw new ArgumentException($"{fieldName} was not a property f~\\ +\cellcolor{gray} & & \verb~31~ & & \verb~ }~\\ +\cellcolor{gray} & & \verb~32~ & & \verb~ try~\\ +\cellcolor{green} & 1 & \verb~33~ & & \verb~ {~\\ +\cellcolor{green} & 1 & \verb~34~ & & \verb~ prop1.SetValue(Internal, data);~\\ +\cellcolor{green} & 1 & \verb~35~ & & \verb~ Fields.Add(fieldName);~\\ +\cellcolor{green} & 1 & \verb~36~ & & \verb~ }~\\ +\cellcolor{green} & 1 & \verb~37~ & & \verb~ catch (ArgumentException ex)~\\ +\cellcolor{green} & 1 & \verb~38~ & & \verb~ {~\\ +\cellcolor{green} & 1 & \verb~39~ & & \verb~ throw ex;~\\ +\cellcolor{gray} & & \verb~40~ & & \verb~ }~\\ +\cellcolor{green} & 1 & \verb~41~ & & \verb~ }~\\ +\cellcolor{gray} & & \verb~42~ & & \verb~ }~\\ +\cellcolor{gray} & & \verb~43~ & & \verb~}~\\ +\end{longtable} +\newpage +\section{EntityFramework.Auditable.Repository6.Tests.RepositoryCreateTests} +\subsection{Summary} +\begin{longtable}[l]{ll} +\textbf{Class:} & EntityFramework.Auditable.Repository6.Tests.RepositoryCreateTests\\ +\textbf{Assembly:} & entityframework.auditable.repository6.tests.dll\\ +\textbf{File(s):} & \begin{minipage}[t]{12cm}{kRepository6\textbackslash EntityFrameworkAuditableRepository6Tests\textbackslash RepositoryCreateTests.cs}\end{minipage} \\ +\textbf{Covered lines:} & 80\\ +\textbf{Uncovered lines:} & 1\\ +\textbf{Coverable lines:} & 81\\ +\textbf{Total lines:} & 168\\ +\textbf{Line coverage:} & 98.7\%\\ +\end{longtable} +\subsection{Metrics} +\begin{longtable}[l]{|l|l|l|} +\hline +\textbf{Method} & \textbf{Blocks covered} & \textbf{Blocks not covered}\\ +\hline +\textbf{Setup()} & 18 & 0\\ +\hline +\textbf{InsertTestMethodAudi} & 14 & 0\\ +\hline +\textbf{InsertTestMethod2Aud} & 14 & 0\\ +\hline +\textbf{InsertTestMethod3Aud} & 14 & 0\\ +\hline +\textbf{InsertMultipleTestAu} & 20 & 0\\ +\hline +\textbf{InsertIntoCompositeK} & 24 & 0\\ +\hline +\textbf{InsertDuplicateIntoC} & 17 & 1\\ +\hline +\end{longtable} +\subsection{File(s)} +\subsubsection{kRepository6\textbackslash EntityFrameworkAuditableRepository6Tests\textbackslash RepositoryCreateTests.cs} +\begin{longtable}[l]{lrrll} +\textbf{} & \textbf{\#} & \textbf{Line} & \textbf{} & \textbf{Line coverage}\\ +\cellcolor{gray} & & \verb~1~ & & \verb~using System;~\\ +\cellcolor{gray} & & \verb~2~ & & \verb~using Microsoft.VisualStudio.TestTools.UnitTesting;~\\ +\cellcolor{gray} & & \verb~3~ & & \verb~using System.Diagnostics;~\\ +\cellcolor{gray} & & \verb~4~ & & \verb~using Microsoft.Practices.Unity;~\\ +\cellcolor{gray} & & \verb~5~ & & \verb~using PersistentLayer.Auditable.Repositories;~\\ +\cellcolor{gray} & & \verb~6~ & & \verb~using System.Linq;~\\ +\cellcolor{gray} & & \verb~7~ & & \verb~using PersistentLayer.Auditable.Entities;~\\ +\cellcolor{gray} & & \verb~8~ & & \verb~using System.Data.Entity.Infrastructure;~\\ +\cellcolor{gray} & & \verb~9~ & & \verb~using EntityFramework.Auditing;~\\ +\cellcolor{gray} & & \verb~10~ & & \verb~using EntityFramework.Repository6;~\\ +\cellcolor{gray} & & \verb~11~ & & \verb~using System.Collections.Generic;~\\ +\cellcolor{gray} & & \verb~12~ & & \verb~~\\ +\cellcolor{gray} & & \verb~13~ & & \verb~namespace EntityFramework.Auditable.Repository6.Tests~\\ +\cellcolor{gray} & & \verb~14~ & & \verb~{~\\ +\cellcolor{gray} & & \verb~15~ & & \verb~ [TestClass]~\\ +\cellcolor{gray} & & \verb~16~ & & \verb~ public class RepositoryCreateTests~\\ +\cellcolor{gray} & & \verb~17~ & & \verb~ {~\\ +\cellcolor{green} & 1 & \verb~18~ & & \verb~ UnityContainer LocalIoCContainer { get; set; }~\\ +\cellcolor{gray} & & \verb~19~ & & \verb~~\\ +\cellcolor{gray} & & \verb~20~ & & \verb~ [TestInitialize]~\\ +\cellcolor{gray} & & \verb~21~ & & \verb~ public void Setup()~\\ +\cellcolor{green} & 1 & \verb~22~ & & \verb~ {~\\ +\cellcolor{green} & 1 & \verb~23~ & & \verb~ Action logSetup = message => Debug.WriteLine(message);~\\ +\cellcolor{gray} & & \verb~24~ & & \verb~~\\ +\cellcolor{green} & 1 & \verb~25~ & & \verb~ LocalIoCContainer = new UnityContainer();~\\ +\cellcolor{green} & 1 & \verb~26~ & & \verb~ LocalIoCContainer.RegisterType), typeo~\\ +\cellcolor{gray} & & \verb~36~ & & \verb~ // , new HierarchicalLifetimeManager()~\\ +\cellcolor{gray} & & \verb~37~ & & \verb~ // , new InjectionConstructor(connectionString)~\\ +\cellcolor{gray} & & \verb~38~ & & \verb~ // , new InjectionProperty("Logging", logSetup));~\\ +\cellcolor{gray} & & \verb~39~ & & \verb~~\\ +\cellcolor{gray} & & \verb~40~ & & \verb~ //Use an nmemory database~\\ +\cellcolor{green} & 1 & \verb~41~ & & \verb~ LocalIoCContainer.RegisterType(typeof(IDatabaseFactory<>), typeof(~\\ +\cellcolor{green} & 1 & \verb~42~ & & \verb~ , new HierarchicalLifetimeManager()~\\ +\cellcolor{green} & 1 & \verb~43~ & & \verb~ , new InjectionProperty("Logging", logSetup));~\\ +\cellcolor{green} & 1 & \verb~44~ & & \verb~ }~\\ +\cellcolor{gray} & & \verb~45~ & & \verb~~\\ +\cellcolor{gray} & & \verb~46~ & & \verb~ [TestCategory("AuditRepository")]~\\ +\cellcolor{gray} & & \verb~47~ & & \verb~ [TestMethod]~\\ +\cellcolor{gray} & & \verb~48~ & & \verb~ public void InsertTestMethodAudit()~\\ +\cellcolor{green} & 1 & \verb~49~ & & \verb~ {~\\ +\cellcolor{green} & 1 & \verb~50~ & & \verb~ var repository = LocalIoCContainer.Resolve~\\ +\cellcolor{green} & 1 & \verb~112~ & & \verb~ {~\\ +\cellcolor{green} & 1 & \verb~113~ & & \verb~ newItem1~\\ +\cellcolor{green} & 1 & \verb~114~ & & \verb~ , newItem2~\\ +\cellcolor{green} & 1 & \verb~115~ & & \verb~ , newItem3~\\ +\cellcolor{green} & 1 & \verb~116~ & & \verb~ });~\\ +\cellcolor{green} & 1 & \verb~117~ & & \verb~ var result = repository.Save();~\\ +\cellcolor{gray} & & \verb~118~ & & \verb~~\\ +\cellcolor{green} & 1 & \verb~119~ & & \verb~ var actual2 = repository.Count();~\\ +\cellcolor{gray} & & \verb~120~ & & \verb~~\\ +\cellcolor{green} & 1 & \verb~121~ & & \verb~ Assert.AreEqual(7, actual1);~\\ +\cellcolor{green} & 1 & \verb~122~ & & \verb~ Assert.AreEqual(10, actual2);~\\ +\cellcolor{gray} & & \verb~123~ & & \verb~~\\ +\cellcolor{green} & 1 & \verb~124~ & & \verb~ repository.Dispose();~\\ +\cellcolor{green} & 1 & \verb~125~ & & \verb~ }~\\ +\cellcolor{gray} & & \verb~126~ & & \verb~~\\ +\cellcolor{gray} & & \verb~127~ & & \verb~ [TestCategory("AuditRepository")]~\\ +\cellcolor{gray} & & \verb~128~ & & \verb~ [TestMethod]~\\ +\cellcolor{gray} & & \verb~129~ & & \verb~ public void InsertIntoCompositeKeyTableMethodAudit()~\\ +\cellcolor{green} & 1 & \verb~130~ & & \verb~ {~\\ +\cellcolor{green} & 1 & \verb~131~ & & \verb~ var repository = LocalIoCContainer.Resolve), typeo~\\ +\cellcolor{gray} & & \verb~34~ & & \verb~ // , new HierarchicalLifetimeManager()~\\ +\cellcolor{gray} & & \verb~35~ & & \verb~ // , new InjectionConstructor(connectionString)~\\ +\cellcolor{gray} & & \verb~36~ & & \verb~ // , new InjectionProperty("Logging", logSetup));~\\ +\cellcolor{gray} & & \verb~37~ & & \verb~~\\ +\cellcolor{gray} & & \verb~38~ & & \verb~ //Use an nmemory database~\\ +\cellcolor{green} & 1 & \verb~39~ & & \verb~ LocalIoCContainer.RegisterType(typeof(IDatabaseFactory<>), typeof(~\\ +\cellcolor{green} & 1 & \verb~40~ & & \verb~ , new HierarchicalLifetimeManager()~\\ +\cellcolor{green} & 1 & \verb~41~ & & \verb~ , new InjectionProperty("Logging", logSetup));~\\ +\cellcolor{green} & 1 & \verb~42~ & & \verb~ }~\\ +\cellcolor{gray} & & \verb~43~ & & \verb~~\\ +\cellcolor{gray} & & \verb~44~ & & \verb~ [TestCategory("AuditRepository")]~\\ +\cellcolor{gray} & & \verb~45~ & & \verb~ [TestMethod]~\\ +\cellcolor{gray} & & \verb~46~ & & \verb~ public void DeleteTestMethod()~\\ +\cellcolor{green} & 1 & \verb~47~ & & \verb~ {~\\ +\cellcolor{green} & 1 & \verb~48~ & & \verb~ var repository = LocalIoCContainer.Resolve x.Id == 1 || x.Id == 2)~\\ +\cellcolor{gray} & & \verb~75~ & & \verb~~\\ +\cellcolor{green} & 1 & \verb~76~ & & \verb~ repository.Delete(itemsToDelete);~\\ +\cellcolor{gray} & & \verb~77~ & & \verb~~\\ +\cellcolor{green} & 1 & \verb~78~ & & \verb~ repository.Save();~\\ +\cellcolor{gray} & & \verb~79~ & & \verb~~\\ +\cellcolor{green} & 1 & \verb~80~ & & \verb~ var actual2 = repository.Count();~\\ +\cellcolor{gray} & & \verb~81~ & & \verb~~\\ +\cellcolor{green} & 1 & \verb~82~ & & \verb~ Assert.AreEqual(7, actual1);~\\ +\cellcolor{green} & 1 & \verb~83~ & & \verb~ Assert.AreEqual(5, actual2);~\\ +\cellcolor{gray} & & \verb~84~ & & \verb~~\\ +\cellcolor{green} & 1 & \verb~85~ & & \verb~ repository.Dispose();~\\ +\cellcolor{green} & 1 & \verb~86~ & & \verb~ }~\\ +\cellcolor{gray} & & \verb~87~ & & \verb~ }~\\ +\cellcolor{gray} & & \verb~88~ & & \verb~}~\\ +\end{longtable} +\newpage +\section{EntityFramework.Auditable.Repository6.Tests.RepositoryReadTests} +\subsection{Summary} +\begin{longtable}[l]{ll} +\textbf{Class:} & EntityFramework.Auditable.Repository6.Tests.RepositoryReadTests\\ +\textbf{Assembly:} & entityframework.auditable.repository6.tests.dll\\ +\textbf{File(s):} & \begin{minipage}[t]{12cm}{orkRepository6\textbackslash EntityFrameworkAuditableRepository6Tests\textbackslash RepositoryReadTests.cs}\end{minipage} \\ +\textbf{Covered lines:} & 78\\ +\textbf{Uncovered lines:} & 0\\ +\textbf{Coverable lines:} & 78\\ +\textbf{Total lines:} & 182\\ +\textbf{Line coverage:} & 100\%\\ +\end{longtable} +\subsection{Metrics} +\begin{longtable}[l]{|l|l|l|} +\hline +\textbf{Method} & \textbf{Blocks covered} & \textbf{Blocks not covered}\\ +\hline +\textbf{Setup()} & 18 & 0\\ +\hline +\textbf{GetAllFromSimpleData} & 7 & 0\\ +\hline +\textbf{CountOfSimpleDataEnt} & 6 & 0\\ +\hline +\textbf{FindTestMethod1Audit} & 7 & 0\\ +\hline +\textbf{SelectTestMethodAudi} & 16 & 0\\ +\hline +\textbf{FindAsyncTestAudit()} & 8 & 0\\ +\hline +\textbf{FindAsyncMultiplePar} & 8 & 0\\ +\hline +\textbf{FindByReadOnlyTestAu} & 16 & 0\\ +\hline +\textbf{ExistsTestAudit()} & 14 & 0\\ +\hline +\textbf{FindAndReloadAsyncTe} & 15 & 0\\ +\hline +\textbf{FindAndReloadTestAud} & 13 & 0\\ +\hline +\end{longtable} +\subsection{File(s)} +\subsubsection{orkRepository6\textbackslash EntityFrameworkAuditableRepository6Tests\textbackslash RepositoryReadTests.cs} +\begin{longtable}[l]{lrrll} +\textbf{} & \textbf{\#} & \textbf{Line} & \textbf{} & \textbf{Line coverage}\\ +\cellcolor{gray} & & \verb~1~ & & \verb~using System;~\\ +\cellcolor{gray} & & \verb~2~ & & \verb~using Microsoft.VisualStudio.TestTools.UnitTesting;~\\ +\cellcolor{gray} & & \verb~3~ & & \verb~using System.Diagnostics;~\\ +\cellcolor{gray} & & \verb~4~ & & \verb~using Microsoft.Practices.Unity;~\\ +\cellcolor{gray} & & \verb~5~ & & \verb~using PersistentLayer.Auditable.Repositories;~\\ +\cellcolor{gray} & & \verb~6~ & & \verb~using System.Linq;~\\ +\cellcolor{gray} & & \verb~7~ & & \verb~using EntityFramework.Auditing;~\\ +\cellcolor{gray} & & \verb~8~ & & \verb~using PersistentLayer.Auditable.Entities;~\\ +\cellcolor{gray} & & \verb~9~ & & \verb~using EntityFramework.Repository6;~\\ +\cellcolor{gray} & & \verb~10~ & & \verb~~\\ +\cellcolor{gray} & & \verb~11~ & & \verb~namespace EntityFramework.Auditable.Repository6.Tests~\\ +\cellcolor{gray} & & \verb~12~ & & \verb~{~\\ +\cellcolor{gray} & & \verb~13~ & & \verb~ [TestClass]~\\ +\cellcolor{gray} & & \verb~14~ & & \verb~ public class RepositoryReadTests~\\ +\cellcolor{gray} & & \verb~15~ & & \verb~ {~\\ +\cellcolor{green} & 1 & \verb~16~ & & \verb~ UnityContainer LocalIoCContainer { get; set; }~\\ +\cellcolor{gray} & & \verb~17~ & & \verb~~\\ +\cellcolor{gray} & & \verb~18~ & & \verb~ [TestInitialize]~\\ +\cellcolor{gray} & & \verb~19~ & & \verb~ public void Setup()~\\ +\cellcolor{green} & 1 & \verb~20~ & & \verb~ {~\\ +\cellcolor{green} & 1 & \verb~21~ & & \verb~ Action logSetup = message => Debug.WriteLine(message);~\\ +\cellcolor{gray} & & \verb~22~ & & \verb~~\\ +\cellcolor{green} & 1 & \verb~23~ & & \verb~ LocalIoCContainer = new UnityContainer();~\\ +\cellcolor{green} & 1 & \verb~24~ & & \verb~ LocalIoCContainer.RegisterType), typeo~\\ +\cellcolor{gray} & & \verb~34~ & & \verb~ // , new HierarchicalLifetimeManager()~\\ +\cellcolor{gray} & & \verb~35~ & & \verb~ // , new InjectionConstructor(connectionString)~\\ +\cellcolor{gray} & & \verb~36~ & & \verb~ // , new InjectionProperty("Logging", logSetup));~\\ +\cellcolor{gray} & & \verb~37~ & & \verb~~\\ +\cellcolor{gray} & & \verb~38~ & & \verb~ //Use an nmemory database~\\ +\cellcolor{green} & 1 & \verb~39~ & & \verb~ LocalIoCContainer.RegisterType(typeof(IDatabaseFactory<>), typeof(~\\ +\cellcolor{green} & 1 & \verb~40~ & & \verb~ , new HierarchicalLifetimeManager()~\\ +\cellcolor{green} & 1 & \verb~41~ & & \verb~ , new InjectionProperty("Logging", logSetup));~\\ +\cellcolor{green} & 1 & \verb~42~ & & \verb~ }~\\ +\cellcolor{gray} & & \verb~43~ & & \verb~~\\ +\cellcolor{gray} & & \verb~44~ & & \verb~ [TestCategory("AuditRepository")]~\\ +\cellcolor{gray} & & \verb~45~ & & \verb~ [TestMethod]~\\ +\cellcolor{gray} & & \verb~46~ & & \verb~ public void GetAllFromSimpleDataEntitiesTableAudit()~\\ +\cellcolor{green} & 1 & \verb~47~ & & \verb~ {~\\ +\cellcolor{green} & 1 & \verb~48~ & & \verb~ var repository = LocalIoCContainer.Resolve x.Id == 2).FirstOrDefault();~\\ +\cellcolor{green} & 1 & \verb~87~ & & \verb~ Assert.AreEqual("Test 2", actual.Name);~\\ +\cellcolor{gray} & & \verb~88~ & & \verb~~\\ +\cellcolor{green} & 1 & \verb~89~ & & \verb~ repository.Dispose();~\\ +\cellcolor{green} & 1 & \verb~90~ & & \verb~ }~\\ +\cellcolor{gray} & & \verb~91~ & & \verb~~\\ +\cellcolor{gray} & & \verb~92~ & & \verb~ [TestCategory("AuditRepository")]~\\ +\cellcolor{gray} & & \verb~93~ & & \verb~ [TestMethod]~\\ +\cellcolor{gray} & & \verb~94~ & & \verb~ public void FindAsyncTestAudit()~\\ +\cellcolor{green} & 1 & \verb~95~ & & \verb~ {~\\ +\cellcolor{green} & 1 & \verb~96~ & & \verb~ var repository = LocalIoCContainer.Resolvex.Id == 1).SingleOrDefau~\\ +\cellcolor{green} & 1 & \verb~123~ & & \verb~ Assert.AreEqual("Test 1", actual.Name);~\\ +\cellcolor{gray} & & \verb~124~ & & \verb~~\\ +\cellcolor{green} & 1 & \verb~125~ & & \verb~ repository.Dispose();~\\ +\cellcolor{green} & 1 & \verb~126~ & & \verb~ }~\\ +\cellcolor{gray} & & \verb~127~ & & \verb~~\\ +\cellcolor{gray} & & \verb~128~ & & \verb~ [TestCategory("AuditRepository")]~\\ +\cellcolor{gray} & & \verb~129~ & & \verb~ [TestMethod]~\\ +\cellcolor{gray} & & \verb~130~ & & \verb~ public void ExistsTestAudit()~\\ +\cellcolor{green} & 1 & \verb~131~ & & \verb~ {~\\ +\cellcolor{green} & 1 & \verb~132~ & & \verb~ var repository = LocalIoCContainer.Resolve x.Id == 1);~\\ +\cellcolor{green} & 1 & \verb~135~ & & \verb~ Assert.IsTrue(actual);~\\ +\cellcolor{gray} & & \verb~136~ & & \verb~~\\ +\cellcolor{green} & 1 & \verb~137~ & & \verb~ repository.Dispose();~\\ +\cellcolor{green} & 1 & \verb~138~ & & \verb~ }~\\ +\cellcolor{gray} & & \verb~139~ & & \verb~~\\ +\cellcolor{gray} & & \verb~140~ & & \verb~ [TestCategory("AuditRepository")]~\\ +\cellcolor{gray} & & \verb~141~ & & \verb~ [TestMethod]~\\ +\cellcolor{gray} & & \verb~142~ & & \verb~ public void FindAndReloadAsyncTestAudit()~\\ +\cellcolor{green} & 1 & \verb~143~ & & \verb~ {~\\ +\cellcolor{green} & 1 & \verb~144~ & & \verb~ var repository = LocalIoCContainer.Resolve logSetup = message => Debug.WriteLine(message);~\\ +\cellcolor{gray} & & \verb~23~ & & \verb~~\\ +\cellcolor{green} & 1 & \verb~24~ & & \verb~ LocalIoCContainer = new UnityContainer();~\\ +\cellcolor{green} & 1 & \verb~25~ & & \verb~ LocalIoCContainer.RegisterType), typeo~\\ +\cellcolor{gray} & & \verb~39~ & & \verb~ // , new HierarchicalLifetimeManager()~\\ +\cellcolor{gray} & & \verb~40~ & & \verb~ // , new InjectionConstructor(connectionString)~\\ +\cellcolor{gray} & & \verb~41~ & & \verb~ // , new InjectionProperty("Logging", logSetup));~\\ +\cellcolor{gray} & & \verb~42~ & & \verb~~\\ +\cellcolor{gray} & & \verb~43~ & & \verb~ //Use an nmemory database~\\ +\cellcolor{green} & 1 & \verb~44~ & & \verb~ LocalIoCContainer.RegisterType(typeof(IDatabaseFactory<>), typeof(~\\ +\cellcolor{green} & 1 & \verb~45~ & & \verb~ , new HierarchicalLifetimeManager()~\\ +\cellcolor{green} & 1 & \verb~46~ & & \verb~ , new InjectionProperty("Logging", logSetup));~\\ +\cellcolor{green} & 1 & \verb~47~ & & \verb~ }~\\ +\cellcolor{gray} & & \verb~48~ & & \verb~~\\ +\cellcolor{gray} & & \verb~49~ & & \verb~ [TestCategory("AuditRepository")]~\\ +\cellcolor{gray} & & \verb~50~ & & \verb~ [TestMethod]~\\ +\cellcolor{gray} & & \verb~51~ & & \verb~ public void UpdateTestMethodAudit()~\\ +\cellcolor{green} & 1 & \verb~52~ & & \verb~ {~\\ +\cellcolor{green} & 1 & \verb~53~ & & \verb~ var repository = LocalIoCContainer.Resolve x.Id == 2);~\\ +\cellcolor{green} & 1 & \verb~95~ & & \verb~ repository.Save();~\\ +\cellcolor{gray} & & \verb~96~ & & \verb~~\\ +\cellcolor{green} & 1 & \verb~97~ & & \verb~ var actual = repository.Find(2);~\\ +\cellcolor{gray} & & \verb~98~ & & \verb~~\\ +\cellcolor{green} & 1 & \verb~99~ & & \verb~ Assert.AreEqual("Updated Name 2", actual.Name);~\\ +\cellcolor{gray} & & \verb~100~ & & \verb~~\\ +\cellcolor{green} & 1 & \verb~101~ & & \verb~ repository.Dispose();~\\ +\cellcolor{green} & 1 & \verb~102~ & & \verb~ }~\\ +\cellcolor{gray} & & \verb~103~ & & \verb~~\\ +\cellcolor{gray} & & \verb~104~ & & \verb~ [TestCategory("AuditRepository")]~\\ +\cellcolor{gray} & & \verb~105~ & & \verb~ [TestMethod]~\\ +\cellcolor{gray} & & \verb~106~ & & \verb~ public void UpdateByAuditTestMethod()~\\ +\cellcolor{green} & 1 & \verb~107~ & & \verb~ {~\\ +\cellcolor{green} & 1 & \verb~108~ & & \verb~ var repository = LocalIoCContainer.Resolve x.Id == 2);~\\ +\cellcolor{gray} & & \verb~116~ & & \verb~~\\ +\cellcolor{green} & 1 & \verb~117~ & & \verb~ repository.Save("UserName2");~\\ +\cellcolor{gray} & & \verb~118~ & & \verb~~\\ +\cellcolor{green} & 1 & \verb~119~ & & \verb~ var actual = repository.Find(2);~\\ +\cellcolor{gray} & & \verb~120~ & & \verb~~\\ +\cellcolor{green} & 1 & \verb~121~ & & \verb~ var auditactual = repository.GetExistingContext().SimpleDataEntity~\\ +\cellcolor{gray} & & \verb~122~ & & \verb~~\\ +\cellcolor{green} & 1 & \verb~123~ & & \verb~ Assert.AreEqual("Updated Name 3", actual.Name);~\\ +\cellcolor{green} & 1 & \verb~124~ & & \verb~ Assert.AreEqual("Test 2", auditactual?.Name);~\\ +\cellcolor{green} & 1 & \verb~125~ & & \verb~ Assert.AreEqual("UserName2", auditactual?.AuditUser);~\\ +\cellcolor{gray} & & \verb~126~ & & \verb~~\\ +\cellcolor{green} & 1 & \verb~127~ & & \verb~ repository.Dispose();~\\ +\cellcolor{green} & 1 & \verb~128~ & & \verb~ }~\\ +\cellcolor{gray} & & \verb~129~ & & \verb~~\\ +\cellcolor{gray} & & \verb~130~ & & \verb~ [TestCategory("AuditRepository")]~\\ +\cellcolor{gray} & & \verb~131~ & & \verb~ [TestMethod]~\\ +\cellcolor{gray} & & \verb~132~ & & \verb~ [ExpectedException(typeof(ArgumentOutOfRangeException))]~\\ +\cellcolor{gray} & & \verb~133~ & & \verb~ public void UpdateByTestMethodIncorrectIdAudit()~\\ +\cellcolor{green} & 1 & \verb~134~ & & \verb~ {~\\ +\cellcolor{green} & 1 & \verb~135~ & & \verb~ var repository = LocalIoCContainer.Resolve x.Id == 55);~\\ +\cellcolor{red} & 0 & \verb~140~ & & \verb~ }~\\ +\cellcolor{gray} & & \verb~141~ & & \verb~ }~\\ +\cellcolor{gray} & & \verb~142~ & & \verb~}~\\ +\end{longtable} +\newpage +\section{EntityFramework.Auditable.Repository6.Tests.TestDbInitializer} +\subsection{Summary} +\begin{longtable}[l]{ll} +\textbf{Class:} & EntityFramework.Auditable.Repository6.Tests.TestDbInitializer\\ +\textbf{Assembly:} & entityframework.auditable.repository6.tests.dll\\ +\textbf{File(s):} & \begin{minipage}[t]{12cm}{tory6\textbackslash EntityFrameworkAuditableRepository6Tests\textbackslash SampleData\textbackslash TestDbInitializer.cs}\end{minipage} \\ +\textbf{Covered lines:} & 7\\ +\textbf{Uncovered lines:} & 0\\ +\textbf{Coverable lines:} & 7\\ +\textbf{Total lines:} & 24\\ +\textbf{Line coverage:} & 100\%\\ +\end{longtable} +\subsection{Metrics} +\begin{longtable}[l]{|l|l|l|} +\hline +\textbf{Method} & \textbf{Blocks covered} & \textbf{Blocks not covered}\\ +\hline +\textbf{Seed(PersistentLayer} & 11 & 0\\ +\hline +\end{longtable} +\subsection{File(s)} +\subsubsection{tory6\textbackslash EntityFrameworkAuditableRepository6Tests\textbackslash SampleData\textbackslash TestDbInitializer.cs} +\begin{longtable}[l]{lrrll} +\textbf{} & \textbf{\#} & \textbf{Line} & \textbf{} & \textbf{Line coverage}\\ +\cellcolor{gray} & & \verb~1~ & & \verb~using PersistentLayer.Auditable.Contexts;~\\ +\cellcolor{gray} & & \verb~2~ & & \verb~using PersistentLayer.Auditable.Entities;~\\ +\cellcolor{gray} & & \verb~3~ & & \verb~using System;~\\ +\cellcolor{gray} & & \verb~4~ & & \verb~using System.Collections.Generic;~\\ +\cellcolor{gray} & & \verb~5~ & & \verb~using System.Data.Entity;~\\ +\cellcolor{gray} & & \verb~6~ & & \verb~using System.Linq;~\\ +\cellcolor{gray} & & \verb~7~ & & \verb~using System.Text;~\\ +\cellcolor{gray} & & \verb~8~ & & \verb~using System.Threading.Tasks;~\\ +\cellcolor{gray} & & \verb~9~ & & \verb~~\\ +\cellcolor{gray} & & \verb~10~ & & \verb~namespace EntityFramework.Auditable.Repository6.Tests~\\ +\cellcolor{gray} & & \verb~11~ & & \verb~{~\\ +\cellcolor{gray} & & \verb~12~ & & \verb~ public class TestDbInitializer : DropCreateDatabaseAlways Logging { get; set; }~\\ +\cellcolor{gray} & & \verb~18~ & & \verb~~\\ +\cellcolor{gray} & & \verb~19~ & & \verb~ public YourCustomDataContext GetNewDbContext()~\\ +\cellcolor{green} & 1 & \verb~20~ & & \verb~ {~\\ +\cellcolor{green} & 1 & \verb~21~ & & \verb~ var data = new ObjectData();~\\ +\cellcolor{gray} & & \verb~22~ & & \verb~~\\ +\cellcolor{green} & 1 & \verb~23~ & & \verb~ data.Table("SimpleDataEntities").Add(new SimpleD~\\ +\cellcolor{green} & 1 & \verb~24~ & & \verb~ data.Table("SimpleDataEntities").Add(new SimpleD~\\ +\cellcolor{green} & 1 & \verb~25~ & & \verb~ data.Table("SimpleDataEntities").Add(new SimpleD~\\ +\cellcolor{green} & 1 & \verb~26~ & & \verb~ data.Table("SimpleDataEntities").Add(new SimpleD~\\ +\cellcolor{green} & 1 & \verb~27~ & & \verb~ data.Table("SimpleDataEntities").Add(new SimpleD~\\ +\cellcolor{gray} & & \verb~28~ & & \verb~~\\ +\cellcolor{green} & 1 & \verb~29~ & & \verb~ data.Table("SimpleCompositeKeyEntities")~\\ +\cellcolor{gray} & & \verb~30~ & & \verb~~\\ +\cellcolor{green} & 1 & \verb~31~ & & \verb~ var dataLoader = new ObjectDataLoader(data);~\\ +\cellcolor{gray} & & \verb~32~ & & \verb~~\\ +\cellcolor{green} & 1 & \verb~33~ & & \verb~ var connection = Effort.DbConnectionFactory.CreateTransient(dataLo~\\ +\cellcolor{gray} & & \verb~34~ & & \verb~~\\ +\cellcolor{green} & 1 & \verb~35~ & & \verb~ var _context = new YourCustomDataContext(connection);~\\ +\cellcolor{gray} & & \verb~36~ & & \verb~~\\ +\cellcolor{green} & 1 & \verb~37~ & & \verb~ _context.Database.CreateIfNotExists();~\\ +\cellcolor{green} & 1 & \verb~38~ & & \verb~ _context.Database.Initialize(true);~\\ +\cellcolor{gray} & & \verb~39~ & & \verb~~\\ +\cellcolor{green} & 1 & \verb~40~ & & \verb~ if (Logging != null) { _context.Database.Log = Logging; }~\\ +\cellcolor{gray} & & \verb~41~ & & \verb~~\\ +\cellcolor{green} & 1 & \verb~42~ & & \verb~ return _context;~\\ +\cellcolor{green} & 1 & \verb~43~ & & \verb~ }~\\ +\cellcolor{gray} & & \verb~44~ & & \verb~ }~\\ +\cellcolor{gray} & & \verb~45~ & & \verb~}~\\ +\end{longtable} +\newpage +\section{EntityFramework.Repository6.Tests.DeltaTests} +\subsection{Summary} +\begin{longtable}[l]{ll} +\textbf{Class:} & EntityFramework.Repository6.Tests.DeltaTests\\ +\textbf{Assembly:} & entityframework.auditable.repository6.tests.dll\\ +\textbf{File(s):} & \begin{minipage}[t]{12cm}{ityFrameworkRepository6\textbackslash EntityFrameworkAuditableRepository6Tests\textbackslash DeltaTests.cs}\end{minipage} \\ +\textbf{Covered lines:} & 64\\ +\textbf{Uncovered lines:} & 4\\ +\textbf{Coverable lines:} & 68\\ +\textbf{Total lines:} & 144\\ +\textbf{Line coverage:} & 94.1\%\\ +\end{longtable} +\subsection{Metrics} +\begin{longtable}[l]{|l|l|l|} +\hline +\textbf{Method} & \textbf{Blocks covered} & \textbf{Blocks not covered}\\ +\hline +\textbf{Setup()} & 18 & 0\\ +\hline +\textbf{DeltaTest1Audit()} & 16 & 0\\ +\hline +\textbf{DeltaTestWrongDataTy} & 8 & 1\\ +\hline +\textbf{DeltaTestInvalidFiel} & 8 & 1\\ +\hline +\textbf{DeltaTest2Audit()} & 27 & 0\\ +\hline +\textbf{DeltaTestFailAudit()} & 9 & 1\\ +\hline +\textbf{DeltaTestFailWithPre} & 17 & 1\\ +\hline +\end{longtable} +\subsection{File(s)} +\subsubsection{ityFrameworkRepository6\textbackslash EntityFrameworkAuditableRepository6Tests\textbackslash DeltaTests.cs} +\begin{longtable}[l]{lrrll} +\textbf{} & \textbf{\#} & \textbf{Line} & \textbf{} & \textbf{Line coverage}\\ +\cellcolor{gray} & & \verb~1~ & & \verb~using System;~\\ +\cellcolor{gray} & & \verb~2~ & & \verb~using Microsoft.VisualStudio.TestTools.UnitTesting;~\\ +\cellcolor{gray} & & \verb~3~ & & \verb~using System.Diagnostics;~\\ +\cellcolor{gray} & & \verb~4~ & & \verb~using Microsoft.Practices.Unity;~\\ +\cellcolor{gray} & & \verb~5~ & & \verb~using System.Linq;~\\ +\cellcolor{gray} & & \verb~6~ & & \verb~using System.Data.Entity.Infrastructure;~\\ +\cellcolor{gray} & & \verb~7~ & & \verb~using PersistentLayer.Auditable.Repositories;~\\ +\cellcolor{gray} & & \verb~8~ & & \verb~using EntityFramework.Auditable.Repository6.Tests;~\\ +\cellcolor{gray} & & \verb~9~ & & \verb~using PersistentLayer.Auditable.Entities;~\\ +\cellcolor{gray} & & \verb~10~ & & \verb~using EntityFramework.Repository6;~\\ +\cellcolor{gray} & & \verb~11~ & & \verb~~\\ +\cellcolor{gray} & & \verb~12~ & & \verb~namespace EntityFramework.Repository6.Tests~\\ +\cellcolor{gray} & & \verb~13~ & & \verb~{~\\ +\cellcolor{gray} & & \verb~14~ & & \verb~ [TestClass]~\\ +\cellcolor{gray} & & \verb~15~ & & \verb~ public class DeltaTests~\\ +\cellcolor{gray} & & \verb~16~ & & \verb~ {~\\ +\cellcolor{green} & 1 & \verb~17~ & & \verb~ UnityContainer LocalIoCContainer { get; set; }~\\ +\cellcolor{gray} & & \verb~18~ & & \verb~~\\ +\cellcolor{gray} & & \verb~19~ & & \verb~ [TestInitialize]~\\ +\cellcolor{gray} & & \verb~20~ & & \verb~ public void Setup()~\\ +\cellcolor{green} & 1 & \verb~21~ & & \verb~ {~\\ +\cellcolor{green} & 1 & \verb~22~ & & \verb~ Action logSetup = message => Debug.WriteLine(message);~\\ +\cellcolor{gray} & & \verb~23~ & & \verb~~\\ +\cellcolor{green} & 1 & \verb~24~ & & \verb~ LocalIoCContainer = new UnityContainer();~\\ +\cellcolor{green} & 1 & \verb~25~ & & \verb~ LocalIoCContainer.RegisterType), typeo~\\ +\cellcolor{gray} & & \verb~33~ & & \verb~ // , new HierarchicalLifetimeManager()~\\ +\cellcolor{gray} & & \verb~34~ & & \verb~ // , new InjectionConstructor(connectionString)~\\ +\cellcolor{gray} & & \verb~35~ & & \verb~ // , new InjectionProperty("Logging", logSetup));~\\ +\cellcolor{gray} & & \verb~36~ & & \verb~~\\ +\cellcolor{gray} & & \verb~37~ & & \verb~ //Use an nmemory database~\\ +\cellcolor{green} & 1 & \verb~38~ & & \verb~ LocalIoCContainer.RegisterType(typeof(IDatabaseFactory<>), typeof(~\\ +\cellcolor{green} & 1 & \verb~39~ & & \verb~ , new HierarchicalLifetimeManager()~\\ +\cellcolor{green} & 1 & \verb~40~ & & \verb~ , new InjectionProperty("Logging", logSetup));~\\ +\cellcolor{green} & 1 & \verb~41~ & & \verb~ }~\\ +\cellcolor{gray} & & \verb~42~ & & \verb~~\\ +\cellcolor{gray} & & \verb~43~ & & \verb~ [TestCategory("AuditRepository")]~\\ +\cellcolor{gray} & & \verb~44~ & & \verb~ [TestMethod]~\\ +\cellcolor{gray} & & \verb~45~ & & \verb~ public void DeltaTest1Audit()~\\ +\cellcolor{green} & 1 & \verb~46~ & & \verb~ {~\\ +\cellcolor{green} & 1 & \verb~47~ & & \verb~ var repository = LocalIoCContainer.Resolve();~\\ +\cellcolor{green} & 1 & \verb~53~ & & \verb~ delta1.SetValue("Name", "Delta Change Test");~\\ +\cellcolor{gray} & & \verb~54~ & & \verb~~\\ +\cellcolor{green} & 1 & \verb~55~ & & \verb~ repository.Update(delta1, newItem.Id);~\\ +\cellcolor{gray} & & \verb~56~ & & \verb~~\\ +\cellcolor{green} & 1 & \verb~57~ & & \verb~ repository.Save();~\\ +\cellcolor{gray} & & \verb~58~ & & \verb~~\\ +\cellcolor{green} & 1 & \verb~59~ & & \verb~ var updatedValue = repository.Find(actual.Id);~\\ +\cellcolor{green} & 1 & \verb~60~ & & \verb~ Assert.AreEqual("Delta Change Test", updatedValue.Name);~\\ +\cellcolor{green} & 1 & \verb~61~ & & \verb~ }~\\ +\cellcolor{gray} & & \verb~62~ & & \verb~~\\ +\cellcolor{gray} & & \verb~63~ & & \verb~ [TestCategory("AuditRepository")]~\\ +\cellcolor{gray} & & \verb~64~ & & \verb~ [TestMethod]~\\ +\cellcolor{gray} & & \verb~65~ & & \verb~ [ExpectedException(typeof(ArgumentException))]~\\ +\cellcolor{gray} & & \verb~66~ & & \verb~ public void DeltaTestWrongDataType1Audit()~\\ +\cellcolor{green} & 1 & \verb~67~ & & \verb~ {~\\ +\cellcolor{green} & 1 & \verb~68~ & & \verb~ var repository = LocalIoCContainer.Resolve();~\\ +\cellcolor{green} & 1 & \verb~74~ & & \verb~ delta1.SetValue("Name", 1);~\\ +\cellcolor{red} & 0 & \verb~75~ & & \verb~ }~\\ +\cellcolor{gray} & & \verb~76~ & & \verb~~\\ +\cellcolor{gray} & & \verb~77~ & & \verb~ [TestCategory("AuditRepository")]~\\ +\cellcolor{gray} & & \verb~78~ & & \verb~ [TestMethod]~\\ +\cellcolor{gray} & & \verb~79~ & & \verb~ [ExpectedException(typeof(ArgumentException))]~\\ +\cellcolor{gray} & & \verb~80~ & & \verb~ public void DeltaTestInvalidFieldName1Audit()~\\ +\cellcolor{green} & 1 & \verb~81~ & & \verb~ {~\\ +\cellcolor{green} & 1 & \verb~82~ & & \verb~ var repository = LocalIoCContainer.Resolve();~\\ +\cellcolor{green} & 1 & \verb~88~ & & \verb~ delta1.SetValue("NameNotRight", "Right data type");~\\ +\cellcolor{red} & 0 & \verb~89~ & & \verb~ }~\\ +\cellcolor{gray} & & \verb~90~ & & \verb~~\\ +\cellcolor{gray} & & \verb~91~ & & \verb~~\\ +\cellcolor{gray} & & \verb~92~ & & \verb~ [TestCategory("AuditRepository")]~\\ +\cellcolor{gray} & & \verb~93~ & & \verb~ [TestMethod]~\\ +\cellcolor{gray} & & \verb~94~ & & \verb~ public void DeltaTest2Audit()~\\ +\cellcolor{green} & 1 & \verb~95~ & & \verb~ {~\\ +\cellcolor{green} & 1 & \verb~96~ & & \verb~ var repository = LocalIoCContainer.Resolve();~\\ +\cellcolor{green} & 1 & \verb~102~ & & \verb~ delta2.SetValue("Name", "Delta Change Test 2");~\\ +\cellcolor{gray} & & \verb~103~ & & \verb~~\\ +\cellcolor{green} & 1 & \verb~104~ & & \verb~ repository.Update(delta2, e => e.Id == newItem.Id);~\\ +\cellcolor{gray} & & \verb~105~ & & \verb~~\\ +\cellcolor{green} & 1 & \verb~106~ & & \verb~ repository.Save();~\\ +\cellcolor{gray} & & \verb~107~ & & \verb~~\\ +\cellcolor{green} & 1 & \verb~108~ & & \verb~ var updatedValue = repository.Find(actual.Id);~\\ +\cellcolor{green} & 1 & \verb~109~ & & \verb~ Assert.AreEqual("Delta Change Test 2", updatedValue.Name);~\\ +\cellcolor{green} & 1 & \verb~110~ & & \verb~ }~\\ +\cellcolor{gray} & & \verb~111~ & & \verb~~\\ +\cellcolor{gray} & & \verb~112~ & & \verb~ [TestCategory("AuditRepository")]~\\ +\cellcolor{gray} & & \verb~113~ & & \verb~ [TestMethod]~\\ +\cellcolor{gray} & & \verb~114~ & & \verb~ [ExpectedException(typeof(ArgumentOutOfRangeException))]~\\ +\cellcolor{gray} & & \verb~115~ & & \verb~ public void DeltaTestFailAudit()~\\ +\cellcolor{green} & 1 & \verb~116~ & & \verb~ {~\\ +\cellcolor{green} & 1 & \verb~117~ & & \verb~ var repository = LocalIoCContainer.Resolve();~\\ +\cellcolor{green} & 1 & \verb~123~ & & \verb~ delta1.SetValue("Name", "Delta Change Test");~\\ +\cellcolor{gray} & & \verb~124~ & & \verb~~\\ +\cellcolor{green} & 1 & \verb~125~ & & \verb~ repository.Update(delta1, 55);~\\ +\cellcolor{red} & 0 & \verb~126~ & & \verb~ }~\\ +\cellcolor{gray} & & \verb~127~ & & \verb~~\\ +\cellcolor{gray} & & \verb~128~ & & \verb~ [TestCategory("AuditRepository")]~\\ +\cellcolor{gray} & & \verb~129~ & & \verb~ [TestMethod]~\\ +\cellcolor{gray} & & \verb~130~ & & \verb~ [ExpectedException(typeof(ArgumentOutOfRangeException))]~\\ +\cellcolor{gray} & & \verb~131~ & & \verb~ public void DeltaTestFailWithPredicateAudit()~\\ +\cellcolor{green} & 1 & \verb~132~ & & \verb~ {~\\ +\cellcolor{green} & 1 & \verb~133~ & & \verb~ var repository = LocalIoCContainer.Resolve();~\\ +\cellcolor{green} & 1 & \verb~139~ & & \verb~ delta1.SetValue("Name", "Delta Change Test");~\\ +\cellcolor{gray} & & \verb~140~ & & \verb~~\\ +\cellcolor{green} & 1 & \verb~141~ & & \verb~ repository.Update(delta1, x=>x.Id == 55);~\\ +\cellcolor{red} & 0 & \verb~142~ & & \verb~ }~\\ +\cellcolor{gray} & & \verb~143~ & & \verb~ }~\\ +\cellcolor{gray} & & \verb~144~ & & \verb~}~\\ +\end{longtable} +\newpage +\section{EntityFramework.Auditing.AuditableEntity} +\subsection{Summary} +\begin{longtable}[l]{ll} +\textbf{Class:} & EntityFramework.Auditing.AuditableEntity\\ +\textbf{Assembly:} & entityframework.auditing.dll\\ +\textbf{File(s):} & \begin{minipage}[t]{12cm}{\textbackslash Development\textbackslash EntityFrameworkRepository6\textbackslash AuditDbContextLocal\textbackslash AuditableEntity.cs}\end{minipage} \\ +\textbf{Covered lines:} & 2\\ +\textbf{Uncovered lines:} & 0\\ +\textbf{Coverable lines:} & 2\\ +\textbf{Total lines:} & 35\\ +\textbf{Line coverage:} & 100\%\\ +\end{longtable} +\subsection{File(s)} +\subsubsection{\textbackslash Development\textbackslash EntityFrameworkRepository6\textbackslash AuditDbContextLocal\textbackslash AuditableEntity.cs} +\begin{longtable}[l]{lrrll} +\textbf{} & \textbf{\#} & \textbf{Line} & \textbf{} & \textbf{Line coverage}\\ +\cellcolor{gray} & & \verb~1~ & & \verb~//-----------------------------------------------------------------------~\\ +\cellcolor{gray} & & \verb~2~ & & \verb~// ~\\ +\cellcolor{gray} & & \verb~3~ & & \verb~// Copyright (c) Russell Wilkins 2012. All Rights Reserved.~\\ +\cellcolor{gray} & & \verb~4~ & & \verb~// ~\\ +\cellcolor{gray} & & \verb~5~ & & \verb~// Russell Wilkins~\\ +\cellcolor{gray} & & \verb~6~ & & \verb~// ~\\ +\cellcolor{gray} & & \verb~7~ & & \verb~// The use of this software is governed by the Microsoft Public License~\\ +\cellcolor{gray} & & \verb~8~ & & \verb~// which is included with this distribution.~\\ +\cellcolor{gray} & & \verb~9~ & & \verb~// ~\\ +\cellcolor{gray} & & \verb~10~ & & \verb~//-----------------------------------------------------------------------~\\ +\cellcolor{gray} & & \verb~11~ & & \verb~namespace EntityFramework.Auditing~\\ +\cellcolor{gray} & & \verb~12~ & & \verb~{~\\ +\cellcolor{gray} & & \verb~13~ & & \verb~ using System;~\\ +\cellcolor{gray} & & \verb~14~ & & \verb~ using System.Collections.Generic;~\\ +\cellcolor{gray} & & \verb~15~ & & \verb~ using System.Linq;~\\ +\cellcolor{gray} & & \verb~16~ & & \verb~ using System.Text;~\\ +\cellcolor{gray} & & \verb~17~ & & \verb~~\\ +\cellcolor{gray} & & \verb~18~ & & \verb~ /// ~\\ +\cellcolor{gray} & & \verb~19~ & & \verb~ /// Base class for auditable entities.~\\ +\cellcolor{gray} & & \verb~20~ & & \verb~ /// ~\\ +\cellcolor{gray} & & \verb~21~ & & \verb~ public abstract class AuditableEntity : IAuditableEntity~\\ +\cellcolor{gray} & & \verb~22~ & & \verb~ {~\\ +\cellcolor{gray} & & \verb~23~ & & \verb~ /// ~\\ +\cellcolor{gray} & & \verb~24~ & & \verb~ /// Gets or sets the DateTime the entity was last updated.~\\ +\cellcolor{gray} & & \verb~25~ & & \verb~ /// Will be automatically set by AuditDbContext on SaveChanges.~\\ +\cellcolor{gray} & & \verb~26~ & & \verb~ /// ~\\ +\cellcolor{green} & 1 & \verb~27~ & & \verb~ public virtual DateTimeOffset? Updated { get; set; }~\\ +\cellcolor{gray} & & \verb~28~ & & \verb~~\\ +\cellcolor{gray} & & \verb~29~ & & \verb~ /// ~\\ +\cellcolor{gray} & & \verb~30~ & & \verb~ /// Gets or sets the User who last updated the entity on the database.~\\ +\cellcolor{gray} & & \verb~31~ & & \verb~ /// Will be automatically set by AuditDbContext on SaveChanges.~\\ +\cellcolor{gray} & & \verb~32~ & & \verb~ /// ~\\ +\cellcolor{green} & 1 & \verb~33~ & & \verb~ public virtual string UpdateUser { get; set; }~\\ +\cellcolor{gray} & & \verb~34~ & & \verb~ }~\\ +\cellcolor{gray} & & \verb~35~ & & \verb~}~\\ +\end{longtable} +\newpage +\section{EntityFramework.Auditing.AuditConfigurationSection} +\subsection{Summary} +\begin{longtable}[l]{ll} +\textbf{Class:} & EntityFramework.Auditing.AuditConfigurationSection\\ +\textbf{Assembly:} & entityframework.auditing.dll\\ +\textbf{File(s):} & \begin{minipage}[t]{12cm}{workRepository6\textbackslash AuditDbContextLocal\textbackslash Configuration\textbackslash AuditConfigurationSection.cs}\end{minipage} \\ +\textbf{Covered lines:} & 6\\ +\textbf{Uncovered lines:} & 3\\ +\textbf{Coverable lines:} & 9\\ +\textbf{Total lines:} & 42\\ +\textbf{Line coverage:} & 66.6\%\\ +\end{longtable} +\subsection{File(s)} +\subsubsection{workRepository6\textbackslash AuditDbContextLocal\textbackslash Configuration\textbackslash AuditConfigurationSection.cs} +\begin{longtable}[l]{lrrll} +\textbf{} & \textbf{\#} & \textbf{Line} & \textbf{} & \textbf{Line coverage}\\ +\cellcolor{gray} & & \verb~1~ & & \verb~//-----------------------------------------------------------------------~\\ +\cellcolor{gray} & & \verb~2~ & & \verb~// ~\\ +\cellcolor{gray} & & \verb~3~ & & \verb~// Copyright (c) Russell Wilkins 2012. All Rights Reserved.~\\ +\cellcolor{gray} & & \verb~4~ & & \verb~// ~\\ +\cellcolor{gray} & & \verb~5~ & & \verb~// Russell Wilkins~\\ +\cellcolor{gray} & & \verb~6~ & & \verb~// ~\\ +\cellcolor{gray} & & \verb~7~ & & \verb~// The use of this software is governed by the Microsoft Public License~\\ +\cellcolor{gray} & & \verb~8~ & & \verb~// which is included with this distribution.~\\ +\cellcolor{gray} & & \verb~9~ & & \verb~// ~\\ +\cellcolor{gray} & & \verb~10~ & & \verb~//-----------------------------------------------------------------------~\\ +\cellcolor{gray} & & \verb~11~ & & \verb~namespace EntityFramework.Auditing~\\ +\cellcolor{gray} & & \verb~12~ & & \verb~{~\\ +\cellcolor{gray} & & \verb~13~ & & \verb~ using System.Configuration;~\\ +\cellcolor{gray} & & \verb~14~ & & \verb~~\\ +\cellcolor{gray} & & \verb~15~ & & \verb~ internal class AuditConfigurationSection : ConfigurationSection~\\ +\cellcolor{gray} & & \verb~16~ & & \verb~ {~\\ +\cellcolor{gray} & & \verb~17~ & & \verb~ [ConfigurationProperty("entities", IsDefaultCollection = false)]~\\ +\cellcolor{gray} & & \verb~18~ & & \verb~ [ConfigurationCollection(typeof(EntityElementCollection),~\\ +\cellcolor{gray} & & \verb~19~ & & \verb~ AddItemName = "add")]~\\ +\cellcolor{gray} & & \verb~20~ & & \verb~ internal EntityElementCollection Entities~\\ +\cellcolor{gray} & & \verb~21~ & & \verb~ {~\\ +\cellcolor{gray} & & \verb~22~ & & \verb~ get~\\ +\cellcolor{green} & 1 & \verb~23~ & & \verb~ {~\\ +\cellcolor{green} & 1 & \verb~24~ & & \verb~ return (EntityElementCollection)base["entities"];~\\ +\cellcolor{green} & 1 & \verb~25~ & & \verb~ }~\\ +\cellcolor{gray} & & \verb~26~ & & \verb~ }~\\ +\cellcolor{gray} & & \verb~27~ & & \verb~~\\ +\cellcolor{gray} & & \verb~28~ & & \verb~ [ConfigurationProperty("enabled", IsRequired = false, DefaultValue = t~\\ +\cellcolor{gray} & & \verb~29~ & & \verb~ internal bool Enabled~\\ +\cellcolor{gray} & & \verb~30~ & & \verb~ {~\\ +\cellcolor{gray} & & \verb~31~ & & \verb~ get~\\ +\cellcolor{green} & 1 & \verb~32~ & & \verb~ {~\\ +\cellcolor{green} & 1 & \verb~33~ & & \verb~ return (bool)this["enabled"];~\\ +\cellcolor{green} & 1 & \verb~34~ & & \verb~ }~\\ +\cellcolor{gray} & & \verb~35~ & & \verb~~\\ +\cellcolor{gray} & & \verb~36~ & & \verb~ set~\\ +\cellcolor{red} & 0 & \verb~37~ & & \verb~ {~\\ +\cellcolor{red} & 0 & \verb~38~ & & \verb~ this["enabled"] = value;~\\ +\cellcolor{red} & 0 & \verb~39~ & & \verb~ }~\\ +\cellcolor{gray} & & \verb~40~ & & \verb~ }~\\ +\cellcolor{gray} & & \verb~41~ & & \verb~ }~\\ +\cellcolor{gray} & & \verb~42~ & & \verb~}~\\ +\end{longtable} +\newpage +\section{EntityFramework.Auditing.AuditDbContext} +\subsection{Summary} +\begin{longtable}[l]{ll} +\textbf{Class:} & EntityFramework.Auditing.AuditDbContext\\ +\textbf{Assembly:} & entityframework.auditing.dll\\ +\textbf{File(s):} & \begin{minipage}[t]{12cm}{:\textbackslash Development\textbackslash EntityFrameworkRepository6\textbackslash AuditDbContextLocal\textbackslash AuditDbContext.cs}\end{minipage} \\ +\textbf{Covered lines:} & 157\\ +\textbf{Uncovered lines:} & 30\\ +\textbf{Coverable lines:} & 187\\ +\textbf{Total lines:} & 400\\ +\textbf{Line coverage:} & 83.9\%\\ +\end{longtable} +\subsection{Metrics} +\begin{longtable}[l]{|l|l|l|} +\hline +\textbf{Method} & \textbf{Blocks covered} & \textbf{Blocks not covered}\\ +\hline +\textbf{AuditDbContext()} & 24 & 0\\ +\hline +\textbf{AuditDbContext(strin} & 2 & 0\\ +\hline +\textbf{AuditDbContext(Syste} & 0 & 2\\ +\hline +\textbf{AuditDbContext(Syste} & 2 & 0\\ +\hline +\textbf{RegisterAuditType(Sy} & 45 & 4\\ +\hline +\textbf{Reload(object)} & 3 & 0\\ +\hline +\textbf{Detach(object)} & 0 & 2\\ +\hline +\textbf{SaveChanges()} & 5 & 0\\ +\hline +\textbf{SaveChanges(string)} & 18 & 2\\ +\hline +\textbf{CreateAuditRecords(s} & 70 & 0\\ +\hline +\textbf{AuditEntity(System.D} & 40 & 7\\ +\hline +\textbf{GetComplexTypes(Enti} & 16 & 2\\ +\hline +\textbf{SaveChangesAsync()} & 6 & 0\\ +\hline +\textbf{SaveChangesAsync()} & 8 & 14\\ +\hline +\end{longtable} +\subsection{File(s)} +\subsubsection{:\textbackslash Development\textbackslash EntityFrameworkRepository6\textbackslash AuditDbContextLocal\textbackslash AuditDbContext.cs} +\begin{longtable}[l]{lrrll} +\textbf{} & \textbf{\#} & \textbf{Line} & \textbf{} & \textbf{Line coverage}\\ +\cellcolor{gray} & & \verb~1~ & & \verb~//-----------------------------------------------------------------------~\\ +\cellcolor{gray} & & \verb~2~ & & \verb~// ~\\ +\cellcolor{gray} & & \verb~3~ & & \verb~// Copyright (c) Russell Wilkins 2012. All Rights Reserved.~\\ +\cellcolor{gray} & & \verb~4~ & & \verb~// ~\\ +\cellcolor{gray} & & \verb~5~ & & \verb~// Russell Wilkins~\\ +\cellcolor{gray} & & \verb~6~ & & \verb~// ~\\ +\cellcolor{gray} & & \verb~7~ & & \verb~// The use of this software is governed by the Microsoft Public License~\\ +\cellcolor{gray} & & \verb~8~ & & \verb~// which is included with this distribution.~\\ +\cellcolor{gray} & & \verb~9~ & & \verb~// ~\\ +\cellcolor{gray} & & \verb~10~ & & \verb~//-----------------------------------------------------------------------~\\ +\cellcolor{gray} & & \verb~11~ & & \verb~~\\ +\cellcolor{gray} & & \verb~12~ & & \verb~using System.Data.Entity;~\\ +\cellcolor{gray} & & \verb~13~ & & \verb~~\\ +\cellcolor{gray} & & \verb~14~ & & \verb~namespace EntityFramework.Auditing~\\ +\cellcolor{gray} & & \verb~15~ & & \verb~{~\\ +\cellcolor{gray} & & \verb~16~ & & \verb~ using System;~\\ +\cellcolor{gray} & & \verb~17~ & & \verb~ using System.Collections.Generic;~\\ +\cellcolor{gray} & & \verb~18~ & & \verb~ using System.Configuration;~\\ +\cellcolor{gray} & & \verb~19~ & & \verb~ using System.Data;~\\ +\cellcolor{gray} & & \verb~20~ & & \verb~ using System.Data.Common;~\\ +\cellcolor{gray} & & \verb~21~ & & \verb~ using System.Data.Entity.Core;~\\ +\cellcolor{gray} & & \verb~22~ & & \verb~ using System.Data.Entity.Infrastructure;~\\ +\cellcolor{gray} & & \verb~23~ & & \verb~ using System.Linq;~\\ +\cellcolor{gray} & & \verb~24~ & & \verb~ using System.Security.Principal;~\\ +\cellcolor{gray} & & \verb~25~ & & \verb~ using System.Threading.Tasks;~\\ +\cellcolor{gray} & & \verb~26~ & & \verb~~\\ +\cellcolor{gray} & & \verb~27~ & & \verb~ /// ~\\ +\cellcolor{gray} & & \verb~28~ & & \verb~ /// The AuditDbContext adds auditing capabilities tot eh DbContext.~\\ +\cellcolor{gray} & & \verb~29~ & & \verb~ /// ~\\ +\cellcolor{gray} & & \verb~30~ & & \verb~ public class AuditDbContext : DbContext~\\ +\cellcolor{gray} & & \verb~31~ & & \verb~ {~\\ +\cellcolor{gray} & & \verb~32~ & & \verb~ private const string AuditUpdatedColumnName = "Audited";~\\ +\cellcolor{gray} & & \verb~33~ & & \verb~ private const string AuditUserColumnName = "AuditUser";~\\ +\cellcolor{gray} & & \verb~34~ & & \verb~ private const string AuditTypeColumnName = "AuditType";~\\ +\cellcolor{gray} & & \verb~35~ & & \verb~ private const string AuditSourceIdColumnName = "AuditSourceId";~\\ +\cellcolor{gray} & & \verb~36~ & & \verb~~\\ +\cellcolor{gray} & & \verb~37~ & & \verb~ private const string EntityUpdatedColumnName = "Updated";~\\ +\cellcolor{gray} & & \verb~38~ & & \verb~ private const string EntityUpdateUSerColumnName = "UpdateUser";~\\ +\cellcolor{gray} & & \verb~39~ & & \verb~~\\ +\cellcolor{green} & 1 & \verb~40~ & & \verb~ private static Dictionary auditTypes = new Dictio~\\ +\cellcolor{gray} & & \verb~41~ & & \verb~~\\ +\cellcolor{gray} & & \verb~42~ & & \verb~ #region Constructors~\\ +\cellcolor{gray} & & \verb~43~ & & \verb~ /// ~\\ +\cellcolor{gray} & & \verb~44~ & & \verb~ /// Initializes static members of the AuditDbContext class.~\\ +\cellcolor{gray} & & \verb~45~ & & \verb~ /// ~\\ +\cellcolor{gray} & & \verb~46~ & & \verb~ static AuditDbContext()~\\ +\cellcolor{green} & 1 & \verb~47~ & & \verb~ {~\\ +\cellcolor{green} & 1 & \verb~48~ & & \verb~ AuditConfigurationSection config = ConfigurationManager.GetSection~\\ +\cellcolor{gray} & & \verb~49~ & & \verb~~\\ +\cellcolor{green} & 1 & \verb~50~ & & \verb~ if (config == null)~\\ +\cellcolor{green} & 1 & \verb~51~ & & \verb~ {~\\ +\cellcolor{green} & 1 & \verb~52~ & & \verb~ config = new AuditConfigurationSection();~\\ +\cellcolor{green} & 1 & \verb~53~ & & \verb~ }~\\ +\cellcolor{gray} & & \verb~54~ & & \verb~~\\ +\cellcolor{green} & 1 & \verb~55~ & & \verb~ AuditEnabled = config.Enabled;~\\ +\cellcolor{gray} & & \verb~56~ & & \verb~~\\ +\cellcolor{green} & 1 & \verb~57~ & & \verb~ foreach (EntityElement item in config.Entities)~\\ +\cellcolor{green} & 1 & \verb~58~ & & \verb~ {~\\ +\cellcolor{green} & 1 & \verb~59~ & & \verb~ var entity = Type.GetType(item.Name);~\\ +\cellcolor{green} & 1 & \verb~60~ & & \verb~ var auditEntity = Type.GetType(item.Audit);~\\ +\cellcolor{gray} & & \verb~61~ & & \verb~~\\ +\cellcolor{green} & 1 & \verb~62~ & & \verb~ if (entity != null)~\\ +\cellcolor{green} & 1 & \verb~63~ & & \verb~ {~\\ +\cellcolor{green} & 1 & \verb~64~ & & \verb~ RegisterAuditType(entity, auditEntity);~\\ +\cellcolor{green} & 1 & \verb~65~ & & \verb~ }~\\ +\cellcolor{green} & 1 & \verb~66~ & & \verb~ }~\\ +\cellcolor{green} & 1 & \verb~67~ & & \verb~ }~\\ +\cellcolor{gray} & & \verb~68~ & & \verb~~\\ +\cellcolor{gray} & & \verb~69~ & & \verb~ /// ~\\ +\cellcolor{gray} & & \verb~70~ & & \verb~ /// Initializes a new instance of the AuditDbContext class~\\ +\cellcolor{gray} & & \verb~71~ & & \verb~ /// using the given string as the name or connection string~\\ +\cellcolor{gray} & & \verb~72~ & & \verb~ /// for the database to which a connection will be made.~\\ +\cellcolor{gray} & & \verb~73~ & & \verb~ /// ~\\ +\cellcolor{gray} & & \verb~74~ & & \verb~ /// Either the database name or t~\\ +\cellcolor{gray} & & \verb~75~ & & \verb~ public AuditDbContext(string nameOrConnectionString)~\\ +\cellcolor{green} & 1 & \verb~76~ & & \verb~ : base(nameOrConnectionString)~\\ +\cellcolor{green} & 1 & \verb~77~ & & \verb~ {~\\ +\cellcolor{green} & 1 & \verb~78~ & & \verb~ }~\\ +\cellcolor{gray} & & \verb~79~ & & \verb~~\\ +\cellcolor{gray} & & \verb~80~ & & \verb~ /// ~\\ +\cellcolor{gray} & & \verb~81~ & & \verb~ /// Initializes a new instance of the AuditDbContext class~\\ +\cellcolor{gray} & & \verb~82~ & & \verb~ /// using a given DBConnection~\\ +\cellcolor{gray} & & \verb~83~ & & \verb~ /// for the database which a connection will be made.~\\ +\cellcolor{gray} & & \verb~84~ & & \verb~ /// ~\\ +\cellcolor{gray} & & \verb~85~ & & \verb~ /// DBConnection object that the context will~\\ +\cellcolor{gray} & & \verb~86~ & & \verb~ public AuditDbContext(DbConnection connection)~\\ +\cellcolor{red} & 0 & \verb~87~ & & \verb~ : base(connection, true)~\\ +\cellcolor{red} & 0 & \verb~88~ & & \verb~ {~\\ +\cellcolor{gray} & & \verb~89~ & & \verb~~\\ +\cellcolor{red} & 0 & \verb~90~ & & \verb~ }~\\ +\cellcolor{gray} & & \verb~91~ & & \verb~~\\ +\cellcolor{gray} & & \verb~92~ & & \verb~ /// ~\\ +\cellcolor{gray} & & \verb~93~ & & \verb~ ///~\\ +\cellcolor{gray} & & \verb~94~ & & \verb~ /// ~\\ +\cellcolor{gray} & & \verb~95~ & & \verb~ /// ~\\ +\cellcolor{gray} & & \verb~96~ & & \verb~ /// ~\\ +\cellcolor{gray} & & \verb~97~ & & \verb~ public AuditDbContext(DbConnection connection, bool contextOwnsConnect~\\ +\cellcolor{green} & 1 & \verb~98~ & & \verb~ : base(connection, contextOwnsConnection)~\\ +\cellcolor{green} & 1 & \verb~99~ & & \verb~ {~\\ +\cellcolor{gray} & & \verb~100~ & & \verb~~\\ +\cellcolor{green} & 1 & \verb~101~ & & \verb~ }~\\ +\cellcolor{gray} & & \verb~102~ & & \verb~~\\ +\cellcolor{gray} & & \verb~103~ & & \verb~ #endregion~\\ +\cellcolor{gray} & & \verb~104~ & & \verb~~\\ +\cellcolor{gray} & & \verb~105~ & & \verb~ /// ~\\ +\cellcolor{gray} & & \verb~106~ & & \verb~ /// Gets a value indicating whether auditing is enabled on this contex~\\ +\cellcolor{gray} & & \verb~107~ & & \verb~ /// ~\\ +\cellcolor{green} & 1 & \verb~108~ & & \verb~ public static bool AuditEnabled { get; private set; }~\\ +\cellcolor{gray} & & \verb~109~ & & \verb~~\\ +\cellcolor{gray} & & \verb~110~ & & \verb~ /// ~\\ +\cellcolor{gray} & & \verb~111~ & & \verb~ /// Gets a value indicating whether this context is using proxies.~\\ +\cellcolor{gray} & & \verb~112~ & & \verb~ /// ~\\ +\cellcolor{gray} & & \verb~113~ & & \verb~ public bool Proxies~\\ +\cellcolor{gray} & & \verb~114~ & & \verb~ {~\\ +\cellcolor{gray} & & \verb~115~ & & \verb~ get~\\ +\cellcolor{green} & 1 & \verb~116~ & & \verb~ {~\\ +\cellcolor{green} & 1 & \verb~117~ & & \verb~ if (auditTypes.Count > 0)~\\ +\cellcolor{green} & 1 & \verb~118~ & & \verb~ {~\\ +\cellcolor{green} & 1 & \verb~119~ & & \verb~ var f = auditTypes.First();~\\ +\cellcolor{green} & 1 & \verb~120~ & & \verb~ var e = this.Set(f.Value.EntityType).Create();~\\ +\cellcolor{green} & 1 & \verb~121~ & & \verb~ return e.GetType().Namespace != f.Value.EntityType.Namespa~\\ +\cellcolor{gray} & & \verb~122~ & & \verb~ }~\\ +\cellcolor{gray} & & \verb~123~ & & \verb~~\\ +\cellcolor{red} & 0 & \verb~124~ & & \verb~ return false;~\\ +\cellcolor{green} & 1 & \verb~125~ & & \verb~ }~\\ +\cellcolor{gray} & & \verb~126~ & & \verb~ }~\\ +\cellcolor{gray} & & \verb~127~ & & \verb~~\\ +\cellcolor{gray} & & \verb~128~ & & \verb~ /// ~\\ +\cellcolor{gray} & & \verb~129~ & & \verb~ /// Registers and type for auditing.~\\ +\cellcolor{gray} & & \verb~130~ & & \verb~ /// ~\\ +\cellcolor{gray} & & \verb~131~ & & \verb~ /// Type to audit, must implement IA~\\ +\cellcolor{gray} & & \verb~132~ & & \verb~ /// Type of audit entity, must implement~\\ +\cellcolor{gray} & & \verb~133~ & & \verb~ public static void RegisterAuditType(Type auditableEntityType, Type au~\\ +\cellcolor{green} & 1 & \verb~134~ & & \verb~ {~\\ +\cellcolor{gray} & & \verb~135~ & & \verb~ // Basic parameter validation.~\\ +\cellcolor{green} & 1 & \verb~136~ & & \verb~ if (auditableEntityType == null)~\\ +\cellcolor{red} & 0 & \verb~137~ & & \verb~ {~\\ +\cellcolor{red} & 0 & \verb~138~ & & \verb~ throw new ArgumentNullException("auditableEntityType");~\\ +\cellcolor{gray} & & \verb~139~ & & \verb~ }~\\ +\cellcolor{gray} & & \verb~140~ & & \verb~~\\ +\cellcolor{green} & 1 & \verb~141~ & & \verb~ if (auditTypes.ContainsKey(auditableEntityType))~\\ +\cellcolor{green} & 1 & \verb~142~ & & \verb~ {~\\ +\cellcolor{green} & 1 & \verb~143~ & & \verb~ throw new ArgumentException("Type already registered for audit~\\ +\cellcolor{gray} & & \verb~144~ & & \verb~ }~\\ +\cellcolor{gray} & & \verb~145~ & & \verb~~\\ +\cellcolor{gray} & & \verb~146~ & & \verb~ // Validate the entity.~\\ +\cellcolor{green} & 1 & \verb~147~ & & \verb~ var iface = auditableEntityType.GetInterface("IAuditableEntity");~\\ +\cellcolor{green} & 1 & \verb~148~ & & \verb~ if (iface == null)~\\ +\cellcolor{green} & 1 & \verb~149~ & & \verb~ {~\\ +\cellcolor{green} & 1 & \verb~150~ & & \verb~ throw new ArgumentException("Entity does implement IAuditableE~\\ +\cellcolor{gray} & & \verb~151~ & & \verb~ }~\\ +\cellcolor{gray} & & \verb~152~ & & \verb~~\\ +\cellcolor{green} & 1 & \verb~153~ & & \verb~ AuditTypeInfo info = new AuditTypeInfo { EntityType = auditableEnt~\\ +\cellcolor{gray} & & \verb~154~ & & \verb~~\\ +\cellcolor{gray} & & \verb~155~ & & \verb~ // Validate the auditEntity~\\ +\cellcolor{green} & 1 & \verb~156~ & & \verb~ if (auditEntityType != null)~\\ +\cellcolor{green} & 1 & \verb~157~ & & \verb~ {~\\ +\cellcolor{green} & 1 & \verb~158~ & & \verb~ iface = auditEntityType.GetInterface("IAuditEntity");~\\ +\cellcolor{green} & 1 & \verb~159~ & & \verb~ if (iface == null)~\\ +\cellcolor{red} & 0 & \verb~160~ & & \verb~ {~\\ +\cellcolor{red} & 0 & \verb~161~ & & \verb~ throw new ArgumentException("Entity does implement IAuditE~\\ +\cellcolor{gray} & & \verb~162~ & & \verb~ }~\\ +\cellcolor{gray} & & \verb~163~ & & \verb~~\\ +\cellcolor{gray} & & \verb~164~ & & \verb~ // Extract the list of properties to audit.~\\ +\cellcolor{green} & 1 & \verb~165~ & & \verb~ var properties = auditEntityType.GetProperties();~\\ +\cellcolor{green} & 1 & \verb~166~ & & \verb~ var entityProperties = auditableEntityType.GetProperties().ToD~\\ +\cellcolor{green} & 1 & \verb~167~ & & \verb~ foreach (var property in properties)~\\ +\cellcolor{green} & 1 & \verb~168~ & & \verb~ {~\\ +\cellcolor{green} & 1 & \verb~169~ & & \verb~ if (entityProperties.ContainsKey(property.Name))~\\ +\cellcolor{green} & 1 & \verb~170~ & & \verb~ {~\\ +\cellcolor{green} & 1 & \verb~171~ & & \verb~ if (property.PropertyType == entityProperties[property~\\ +\cellcolor{green} & 1 & \verb~172~ & & \verb~ {~\\ +\cellcolor{green} & 1 & \verb~173~ & & \verb~ info.AuditProperties.Add(property.Name);~\\ +\cellcolor{green} & 1 & \verb~174~ & & \verb~ }~\\ +\cellcolor{green} & 1 & \verb~175~ & & \verb~ }~\\ +\cellcolor{green} & 1 & \verb~176~ & & \verb~ }~\\ +\cellcolor{green} & 1 & \verb~177~ & & \verb~ }~\\ +\cellcolor{gray} & & \verb~178~ & & \verb~~\\ +\cellcolor{gray} & & \verb~179~ & & \verb~ // Valid so register.~\\ +\cellcolor{green} & 1 & \verb~180~ & & \verb~ auditTypes.Add(auditableEntityType, info);~\\ +\cellcolor{green} & 1 & \verb~181~ & & \verb~ }~\\ +\cellcolor{gray} & & \verb~182~ & & \verb~~\\ +\cellcolor{gray} & & \verb~183~ & & \verb~ /// ~\\ +\cellcolor{gray} & & \verb~184~ & & \verb~ /// Reloads the entity from the database overwriting any property valu~\\ +\cellcolor{gray} & & \verb~185~ & & \verb~ /// The entity will be in the Unchanged state after calling this metho~\\ +\cellcolor{gray} & & \verb~186~ & & \verb~ /// ~\\ +\cellcolor{gray} & & \verb~187~ & & \verb~ /// The entity object to reload.~\\ +\cellcolor{gray} & & \verb~188~ & & \verb~ public void Reload(object entity)~\\ +\cellcolor{green} & 1 & \verb~189~ & & \verb~ {~\\ +\cellcolor{green} & 1 & \verb~190~ & & \verb~ this.Entry(entity).Reload();~\\ +\cellcolor{green} & 1 & \verb~191~ & & \verb~ }~\\ +\cellcolor{gray} & & \verb~192~ & & \verb~~\\ +\cellcolor{gray} & & \verb~193~ & & \verb~ /// ~\\ +\cellcolor{gray} & & \verb~194~ & & \verb~ /// Detaches the entity from the context.~\\ +\cellcolor{gray} & & \verb~195~ & & \verb~ /// ~\\ +\cellcolor{gray} & & \verb~196~ & & \verb~ /// ~\\ +\cellcolor{gray} & & \verb~197~ & & \verb~ public void Detach(object entity)~\\ +\cellcolor{red} & 0 & \verb~198~ & & \verb~ {~\\ +\cellcolor{red} & 0 & \verb~199~ & & \verb~ this.Detach(entity);~\\ +\cellcolor{red} & 0 & \verb~200~ & & \verb~ }~\\ +\cellcolor{gray} & & \verb~201~ & & \verb~~\\ +\cellcolor{gray} & & \verb~202~ & & \verb~ /// ~\\ +\cellcolor{gray} & & \verb~203~ & & \verb~ /// Saves all changes made in this context to the underlying database~\\ +\cellcolor{gray} & & \verb~204~ & & \verb~ /// using the current windows user for auditing.~\\ +\cellcolor{gray} & & \verb~205~ & & \verb~ /// ~\\ +\cellcolor{gray} & & \verb~206~ & & \verb~ /// The number of objects written to the underlying database.~\\ +\cellcolor{gray} & & \verb~207~ & & \verb~ public override int SaveChanges()~\\ +\cellcolor{green} & 1 & \verb~208~ & & \verb~ {~\\ +\cellcolor{green} & 1 & \verb~209~ & & \verb~ return this.SaveChanges(WindowsIdentity.GetCurrent().Name);~\\ +\cellcolor{green} & 1 & \verb~210~ & & \verb~ }~\\ +\cellcolor{gray} & & \verb~211~ & & \verb~~\\ +\cellcolor{gray} & & \verb~212~ & & \verb~ /// ~\\ +\cellcolor{gray} & & \verb~213~ & & \verb~ /// Saves all changes made in this context to the underlying database~\\ +\cellcolor{gray} & & \verb~214~ & & \verb~ /// using the current windows user for auditing.~\\ +\cellcolor{gray} & & \verb~215~ & & \verb~ /// ~\\ +\cellcolor{gray} & & \verb~216~ & & \verb~ /// The number of objects written to the underlying database.~\\ +\cellcolor{gray} & & \verb~217~ & & \verb~ public override async Task SaveChangesAsync()~\\ +\cellcolor{green} & 1 & \verb~218~ & & \verb~ {~\\ +\cellcolor{green} & 1 & \verb~219~ & & \verb~ return await this.SaveChangesAsync(WindowsIdentity.GetCurrent().Na~\\ +\cellcolor{green} & 1 & \verb~220~ & & \verb~ }~\\ +\cellcolor{gray} & & \verb~221~ & & \verb~~\\ +\cellcolor{gray} & & \verb~222~ & & \verb~ /// ~\\ +\cellcolor{gray} & & \verb~223~ & & \verb~ /// Saves all changes made in this context to the underlying database~\\ +\cellcolor{gray} & & \verb~224~ & & \verb~ /// using the user parameter passed for auditing.~\\ +\cellcolor{gray} & & \verb~225~ & & \verb~ /// ~\\ +\cellcolor{gray} & & \verb~226~ & & \verb~ /// User name for auditing.~\\ +\cellcolor{gray} & & \verb~227~ & & \verb~ /// The number of objects written to the underlying database.~\\ +\cellcolor{gray} & & \verb~228~ & & \verb~ public virtual int SaveChanges(string user)~\\ +\cellcolor{green} & 1 & \verb~229~ & & \verb~ {~\\ +\cellcolor{green} & 1 & \verb~230~ & & \verb~ if (AuditEnabled)~\\ +\cellcolor{green} & 1 & \verb~231~ & & \verb~ {~\\ +\cellcolor{green} & 1 & \verb~232~ & & \verb~ var audits = CreateAuditRecords(user);~\\ +\cellcolor{gray} & & \verb~233~ & & \verb~~\\ +\cellcolor{gray} & & \verb~234~ & & \verb~ // Perform the updates.~\\ +\cellcolor{gray} & & \verb~235~ & & \verb~ try~\\ +\cellcolor{green} & 1 & \verb~236~ & & \verb~ {~\\ +\cellcolor{green} & 1 & \verb~237~ & & \verb~ return base.SaveChanges();~\\ +\cellcolor{gray} & & \verb~238~ & & \verb~ }~\\ +\cellcolor{green} & 1 & \verb~239~ & & \verb~ catch (Exception)~\\ +\cellcolor{green} & 1 & \verb~240~ & & \verb~ {~\\ +\cellcolor{gray} & & \verb~241~ & & \verb~ // Updated failed so remove the audit entities.~\\ +\cellcolor{green} & 1 & \verb~242~ & & \verb~ foreach (var item in audits)~\\ +\cellcolor{green} & 1 & \verb~243~ & & \verb~ {~\\ +\cellcolor{green} & 1 & \verb~244~ & & \verb~ this.Set(item.GetType()).Remove(item);~\\ +\cellcolor{green} & 1 & \verb~245~ & & \verb~ }~\\ +\cellcolor{gray} & & \verb~246~ & & \verb~~\\ +\cellcolor{gray} & & \verb~247~ & & \verb~~\\ +\cellcolor{green} & 1 & \verb~248~ & & \verb~ throw;~\\ +\cellcolor{gray} & & \verb~249~ & & \verb~ }~\\ +\cellcolor{gray} & & \verb~250~ & & \verb~ }~\\ +\cellcolor{gray} & & \verb~251~ & & \verb~ else~\\ +\cellcolor{red} & 0 & \verb~252~ & & \verb~ {~\\ +\cellcolor{red} & 0 & \verb~253~ & & \verb~ return base.SaveChanges();~\\ +\cellcolor{gray} & & \verb~254~ & & \verb~ }~\\ +\cellcolor{green} & 1 & \verb~255~ & & \verb~ }~\\ +\cellcolor{gray} & & \verb~256~ & & \verb~~\\ +\cellcolor{gray} & & \verb~257~ & & \verb~ public virtual async Task SaveChangesAsync(string user)~\\ +\cellcolor{green} & 1 & \verb~258~ & & \verb~ {~\\ +\cellcolor{green} & 1 & \verb~259~ & & \verb~ if (AuditEnabled)~\\ +\cellcolor{green} & 1 & \verb~260~ & & \verb~ {~\\ +\cellcolor{green} & 1 & \verb~261~ & & \verb~ var audits = CreateAuditRecords(user);~\\ +\cellcolor{gray} & & \verb~262~ & & \verb~~\\ +\cellcolor{gray} & & \verb~263~ & & \verb~ // Perform the updates.~\\ +\cellcolor{gray} & & \verb~264~ & & \verb~ try~\\ +\cellcolor{green} & 1 & \verb~265~ & & \verb~ {~\\ +\cellcolor{green} & 1 & \verb~266~ & & \verb~ return await base.SaveChangesAsync();~\\ +\cellcolor{gray} & & \verb~267~ & & \verb~ }~\\ +\cellcolor{red} & 0 & \verb~268~ & & \verb~ catch (Exception)~\\ +\cellcolor{red} & 0 & \verb~269~ & & \verb~ {~\\ +\cellcolor{gray} & & \verb~270~ & & \verb~ // Updated failed so remove the audit entities.~\\ +\cellcolor{red} & 0 & \verb~271~ & & \verb~ foreach (var item in audits)~\\ +\cellcolor{red} & 0 & \verb~272~ & & \verb~ {~\\ +\cellcolor{red} & 0 & \verb~273~ & & \verb~ this.Set(item.GetType()).Remove(item);~\\ +\cellcolor{red} & 0 & \verb~274~ & & \verb~ }~\\ +\cellcolor{gray} & & \verb~275~ & & \verb~~\\ +\cellcolor{gray} & & \verb~276~ & & \verb~~\\ +\cellcolor{red} & 0 & \verb~277~ & & \verb~ throw;~\\ +\cellcolor{gray} & & \verb~278~ & & \verb~ }~\\ +\cellcolor{gray} & & \verb~279~ & & \verb~ }~\\ +\cellcolor{gray} & & \verb~280~ & & \verb~ else~\\ +\cellcolor{red} & 0 & \verb~281~ & & \verb~ {~\\ +\cellcolor{red} & 0 & \verb~282~ & & \verb~ return await base.SaveChangesAsync();~\\ +\cellcolor{gray} & & \verb~283~ & & \verb~ }~\\ +\cellcolor{green} & 1 & \verb~284~ & & \verb~ }~\\ +\cellcolor{gray} & & \verb~285~ & & \verb~~\\ +\cellcolor{gray} & & \verb~286~ & & \verb~ private List CreateAuditRecords(string user)~\\ +\cellcolor{green} & 1 & \verb~287~ & & \verb~ {~\\ +\cellcolor{gray} & & \verb~288~ & & \verb~ // Track all audit entities created in this transaction, will be r~\\ +\cellcolor{green} & 1 & \verb~289~ & & \verb~ List audits = new List();~\\ +\cellcolor{gray} & & \verb~290~ & & \verb~~\\ +\cellcolor{gray} & & \verb~291~ & & \verb~ // Use the same datetime for all updates in this transaction, retr~\\ +\cellcolor{green} & 1 & \verb~292~ & & \verb~ DateTimeOffset? updateDateTime = null;~\\ +\cellcolor{gray} & & \verb~293~ & & \verb~~\\ +\cellcolor{gray} & & \verb~294~ & & \verb~ // Process any auditable objects.~\\ +\cellcolor{green} & 1 & \verb~295~ & & \verb~ foreach (DbEntityEntry auditable in this.ChangeT~\\ +\cellcolor{green} & 1 & \verb~296~ & & \verb~ {~\\ +\cellcolor{green} & 1 & \verb~297~ & & \verb~ if (auditable.State == EntityState.Added~\\ +\cellcolor{green} & 1 & \verb~298~ & & \verb~ || auditable.State == EntityState.Modified~\\ +\cellcolor{green} & 1 & \verb~299~ & & \verb~ || auditable.State == EntityState.Deleted)~\\ +\cellcolor{green} & 1 & \verb~300~ & & \verb~ {~\\ +\cellcolor{gray} & & \verb~301~ & & \verb~ // Need datetime for the audits.~\\ +\cellcolor{green} & 1 & \verb~302~ & & \verb~ if (updateDateTime.HasValue == false)~\\ +\cellcolor{green} & 1 & \verb~303~ & & \verb~ {~\\ +\cellcolor{gray} & & \verb~304~ & & \verb~ try~\\ +\cellcolor{green} & 1 & \verb~305~ & & \verb~ {~\\ +\cellcolor{green} & 1 & \verb~306~ & & \verb~ updateDateTime = this.Database.SqlQuery~\\ +\cellcolor{gray} & & \verb~380~ & & \verb~ /// Checks the destination object for complex types. Returns a list of~\\ +\cellcolor{gray} & & \verb~381~ & & \verb~ /// ~\\ +\cellcolor{gray} & & \verb~382~ & & \verb~ /// ~\\ +\cellcolor{gray} & & \verb~383~ & & \verb~ /// ~\\ +\cellcolor{gray} & & \verb~384~ & & \verb~ /// ~\\ +\cellcolor{gray} & & \verb~385~ & & \verb~ private ICollection GetComplexTypes(AuditTypeInfo auditTypeInf~\\ +\cellcolor{green} & 1 & \verb~386~ & & \verb~ {~\\ +\cellcolor{green} & 1 & \verb~387~ & & \verb~ var returnValue = new List();~\\ +\cellcolor{gray} & & \verb~388~ & & \verb~~\\ +\cellcolor{green} & 1 & \verb~389~ & & \verb~ foreach (string propertyName in auditTypeInfo.AuditProperties)~\\ +\cellcolor{green} & 1 & \verb~390~ & & \verb~ {~\\ +\cellcolor{green} & 1 & \verb~391~ & & \verb~ if (entityEntry.Property(propertyName).GetType().Name.Contains~\\ +\cellcolor{red} & 0 & \verb~392~ & & \verb~ {~\\ +\cellcolor{red} & 0 & \verb~393~ & & \verb~ returnValue.Add(propertyName);~\\ +\cellcolor{red} & 0 & \verb~394~ & & \verb~ }~\\ +\cellcolor{green} & 1 & \verb~395~ & & \verb~ }~\\ +\cellcolor{gray} & & \verb~396~ & & \verb~~\\ +\cellcolor{green} & 1 & \verb~397~ & & \verb~ return returnValue;~\\ +\cellcolor{green} & 1 & \verb~398~ & & \verb~ }~\\ +\cellcolor{gray} & & \verb~399~ & & \verb~ }~\\ +\cellcolor{gray} & & \verb~400~ & & \verb~}~\\ +\end{longtable} +\newpage +\section{EntityFramework.Auditing.AuditEntity} +\subsection{Summary} +\begin{longtable}[l]{ll} +\textbf{Class:} & EntityFramework.Auditing.AuditEntity\\ +\textbf{Assembly:} & entityframework.auditing.dll\\ +\textbf{File(s):} & \begin{minipage}[t]{12cm}{C:\textbackslash Development\textbackslash EntityFrameworkRepository6\textbackslash AuditDbContextLocal\textbackslash AuditEntity.cs}\end{minipage} \\ +\textbf{Covered lines:} & 6\\ +\textbf{Uncovered lines:} & 0\\ +\textbf{Coverable lines:} & 6\\ +\textbf{Total lines:} & 55\\ +\textbf{Line coverage:} & 100\%\\ +\end{longtable} +\subsection{File(s)} +\subsubsection{C:\textbackslash Development\textbackslash EntityFrameworkRepository6\textbackslash AuditDbContextLocal\textbackslash AuditEntity.cs} +\begin{longtable}[l]{lrrll} +\textbf{} & \textbf{\#} & \textbf{Line} & \textbf{} & \textbf{Line coverage}\\ +\cellcolor{gray} & & \verb~1~ & & \verb~//-----------------------------------------------------------------------~\\ +\cellcolor{gray} & & \verb~2~ & & \verb~// ~\\ +\cellcolor{gray} & & \verb~3~ & & \verb~// Copyright (c) Russell Wilkins 2012. All Rights Reserved.~\\ +\cellcolor{gray} & & \verb~4~ & & \verb~// ~\\ +\cellcolor{gray} & & \verb~5~ & & \verb~// Russell Wilkins~\\ +\cellcolor{gray} & & \verb~6~ & & \verb~// ~\\ +\cellcolor{gray} & & \verb~7~ & & \verb~// The use of this software is governed by the Microsoft Public License~\\ +\cellcolor{gray} & & \verb~8~ & & \verb~// which is included with this distribution.~\\ +\cellcolor{gray} & & \verb~9~ & & \verb~// ~\\ +\cellcolor{gray} & & \verb~10~ & & \verb~//-----------------------------------------------------------------------~\\ +\cellcolor{gray} & & \verb~11~ & & \verb~namespace EntityFramework.Auditing~\\ +\cellcolor{gray} & & \verb~12~ & & \verb~{~\\ +\cellcolor{gray} & & \verb~13~ & & \verb~ using System;~\\ +\cellcolor{gray} & & \verb~14~ & & \verb~ using System.Collections.Generic;~\\ +\cellcolor{gray} & & \verb~15~ & & \verb~ using System.Linq;~\\ +\cellcolor{gray} & & \verb~16~ & & \verb~ using System.Text;~\\ +\cellcolor{gray} & & \verb~17~ & & \verb~~\\ +\cellcolor{gray} & & \verb~18~ & & \verb~ /// ~\\ +\cellcolor{gray} & & \verb~19~ & & \verb~ /// Base class for audit entities.~\\ +\cellcolor{gray} & & \verb~20~ & & \verb~ /// ~\\ +\cellcolor{gray} & & \verb~21~ & & \verb~ public abstract class AuditEntity : IAuditEntity~\\ +\cellcolor{gray} & & \verb~22~ & & \verb~ {~\\ +\cellcolor{gray} & & \verb~23~ & & \verb~ /// ~\\ +\cellcolor{gray} & & \verb~24~ & & \verb~ /// Gets or sets the DateTime the entity was last updated.~\\ +\cellcolor{gray} & & \verb~25~ & & \verb~ /// Will be automatically set by AuditDbContext on SaveChanges.~\\ +\cellcolor{gray} & & \verb~26~ & & \verb~ /// ~\\ +\cellcolor{green} & 1 & \verb~27~ & & \verb~ public virtual DateTimeOffset Updated { get; set; }~\\ +\cellcolor{gray} & & \verb~28~ & & \verb~~\\ +\cellcolor{gray} & & \verb~29~ & & \verb~ /// ~\\ +\cellcolor{gray} & & \verb~30~ & & \verb~ /// Gets or sets the User who last updated the entity on the database.~\\ +\cellcolor{gray} & & \verb~31~ & & \verb~ /// Will be automatically set by AuditDbContext on SaveChanges.~\\ +\cellcolor{gray} & & \verb~32~ & & \verb~ /// ~\\ +\cellcolor{green} & 1 & \verb~33~ & & \verb~ public virtual string UpdateUser { get; set; }~\\ +\cellcolor{gray} & & \verb~34~ & & \verb~~\\ +\cellcolor{gray} & & \verb~35~ & & \verb~ /// ~\\ +\cellcolor{gray} & & \verb~36~ & & \verb~ /// Gets or sets the DateTime this audit entity was created.~\\ +\cellcolor{gray} & & \verb~37~ & & \verb~ /// Will be automatically set by AuditDbContext on SaveChanges.~\\ +\cellcolor{gray} & & \verb~38~ & & \verb~ /// ~\\ +\cellcolor{green} & 1 & \verb~39~ & & \verb~ public virtual DateTimeOffset Audited { get; set; }~\\ +\cellcolor{gray} & & \verb~40~ & & \verb~~\\ +\cellcolor{gray} & & \verb~41~ & & \verb~ /// ~\\ +\cellcolor{gray} & & \verb~42~ & & \verb~ /// Gets or sets the user who updated the entity~\\ +\cellcolor{gray} & & \verb~43~ & & \verb~ /// Will be automatically set by AuditDbContext on SaveChanges.~\\ +\cellcolor{gray} & & \verb~44~ & & \verb~ /// ~\\ +\cellcolor{green} & 1 & \verb~45~ & & \verb~ public virtual string AuditUser { get; set; }~\\ +\cellcolor{gray} & & \verb~46~ & & \verb~~\\ +\cellcolor{gray} & & \verb~47~ & & \verb~ /// ~\\ +\cellcolor{gray} & & \verb~48~ & & \verb~ /// Gets or sets the type of audit. update or delete.~\\ +\cellcolor{gray} & & \verb~49~ & & \verb~ /// Will be automatically set by AuditDbContext on SaveChanges.~\\ +\cellcolor{gray} & & \verb~50~ & & \verb~ /// ~\\ +\cellcolor{green} & 1 & \verb~51~ & & \verb~ public virtual string AuditType { get; set; }~\\ +\cellcolor{gray} & & \verb~52~ & & \verb~~\\ +\cellcolor{green} & 1 & \verb~53~ & & \verb~ public virtual int AuditSourceId { get; set; }~\\ +\cellcolor{gray} & & \verb~54~ & & \verb~ }~\\ +\cellcolor{gray} & & \verb~55~ & & \verb~}~\\ +\end{longtable} +\newpage +\section{EntityFramework.Auditing.AuditTypeInfo} +\subsection{Summary} +\begin{longtable}[l]{ll} +\textbf{Class:} & EntityFramework.Auditing.AuditTypeInfo\\ +\textbf{Assembly:} & entityframework.auditing.dll\\ +\textbf{File(s):} & \begin{minipage}[t]{12cm}{C:\textbackslash Development\textbackslash EntityFrameworkRepository6\textbackslash AuditDbContextLocal\textbackslash AuditTypeInfo.cs}\end{minipage} \\ +\textbf{Covered lines:} & 7\\ +\textbf{Uncovered lines:} & 0\\ +\textbf{Coverable lines:} & 7\\ +\textbf{Total lines:} & 33\\ +\textbf{Line coverage:} & 100\%\\ +\end{longtable} +\subsection{Metrics} +\begin{longtable}[l]{|l|l|l|} +\hline +\textbf{Method} & \textbf{Blocks covered} & \textbf{Blocks not covered}\\ +\hline +\textbf{AuditTypeInfo()} & 4 & 0\\ +\hline +\end{longtable} +\subsection{File(s)} +\subsubsection{C:\textbackslash Development\textbackslash EntityFrameworkRepository6\textbackslash AuditDbContextLocal\textbackslash AuditTypeInfo.cs} +\begin{longtable}[l]{lrrll} +\textbf{} & \textbf{\#} & \textbf{Line} & \textbf{} & \textbf{Line coverage}\\ +\cellcolor{gray} & & \verb~1~ & & \verb~//-----------------------------------------------------------------------~\\ +\cellcolor{gray} & & \verb~2~ & & \verb~// ~\\ +\cellcolor{gray} & & \verb~3~ & & \verb~// Copyright (c) Russell Wilkins 2012. All Rights Reserved.~\\ +\cellcolor{gray} & & \verb~4~ & & \verb~// ~\\ +\cellcolor{gray} & & \verb~5~ & & \verb~// Russell Wilkins~\\ +\cellcolor{gray} & & \verb~6~ & & \verb~// ~\\ +\cellcolor{gray} & & \verb~7~ & & \verb~// The use of this software is governed by the Microsoft Public License~\\ +\cellcolor{gray} & & \verb~8~ & & \verb~// which is included with this distribution.~\\ +\cellcolor{gray} & & \verb~9~ & & \verb~// ~\\ +\cellcolor{gray} & & \verb~10~ & & \verb~//-----------------------------------------------------------------------~\\ +\cellcolor{gray} & & \verb~11~ & & \verb~namespace EntityFramework.Auditing~\\ +\cellcolor{gray} & & \verb~12~ & & \verb~{~\\ +\cellcolor{gray} & & \verb~13~ & & \verb~ using System;~\\ +\cellcolor{gray} & & \verb~14~ & & \verb~ using System.Collections.Generic;~\\ +\cellcolor{gray} & & \verb~15~ & & \verb~ using System.Collections.ObjectModel;~\\ +\cellcolor{gray} & & \verb~16~ & & \verb~~\\ +\cellcolor{gray} & & \verb~17~ & & \verb~ internal class AuditTypeInfo~\\ +\cellcolor{gray} & & \verb~18~ & & \verb~ {~\\ +\cellcolor{gray} & & \verb~19~ & & \verb~ /// ~\\ +\cellcolor{gray} & & \verb~20~ & & \verb~ /// Initializes a new instance of the AuditTypeInfo class.~\\ +\cellcolor{gray} & & \verb~21~ & & \verb~ /// ~\\ +\cellcolor{green} & 1 & \verb~22~ & & \verb~ internal AuditTypeInfo()~\\ +\cellcolor{green} & 1 & \verb~23~ & & \verb~ {~\\ +\cellcolor{green} & 1 & \verb~24~ & & \verb~ this.AuditProperties = new Collection();~\\ +\cellcolor{green} & 1 & \verb~25~ & & \verb~ }~\\ +\cellcolor{gray} & & \verb~26~ & & \verb~~\\ +\cellcolor{green} & 1 & \verb~27~ & & \verb~ internal Type EntityType { get; set; }~\\ +\cellcolor{gray} & & \verb~28~ & & \verb~~\\ +\cellcolor{green} & 1 & \verb~29~ & & \verb~ internal Type AuditEntityType { get; set; }~\\ +\cellcolor{gray} & & \verb~30~ & & \verb~~\\ +\cellcolor{green} & 1 & \verb~31~ & & \verb~ internal Collection AuditProperties { get; set; }~\\ +\cellcolor{gray} & & \verb~32~ & & \verb~ }~\\ +\cellcolor{gray} & & \verb~33~ & & \verb~}~\\ +\end{longtable} +\newpage +\section{EntityFramework.Auditing.EntityElement} +\subsection{Summary} +\begin{longtable}[l]{ll} +\textbf{Class:} & EntityFramework.Auditing.EntityElement\\ +\textbf{Assembly:} & entityframework.auditing.dll\\ +\textbf{File(s):} & \begin{minipage}[t]{12cm}{\textbackslash EntityFrameworkRepository6\textbackslash AuditDbContextLocal\textbackslash Configuration\textbackslash EntityElement.cs}\end{minipage} \\ +\textbf{Covered lines:} & 6\\ +\textbf{Uncovered lines:} & 6\\ +\textbf{Coverable lines:} & 12\\ +\textbf{Total lines:} & 45\\ +\textbf{Line coverage:} & 50\%\\ +\end{longtable} +\subsection{File(s)} +\subsubsection{\textbackslash EntityFrameworkRepository6\textbackslash AuditDbContextLocal\textbackslash Configuration\textbackslash EntityElement.cs} +\begin{longtable}[l]{lrrll} +\textbf{} & \textbf{\#} & \textbf{Line} & \textbf{} & \textbf{Line coverage}\\ +\cellcolor{gray} & & \verb~1~ & & \verb~//-----------------------------------------------------------------------~\\ +\cellcolor{gray} & & \verb~2~ & & \verb~// ~\\ +\cellcolor{gray} & & \verb~3~ & & \verb~// Copyright (c) Russell Wilkins 2012. All Rights Reserved.~\\ +\cellcolor{gray} & & \verb~4~ & & \verb~// ~\\ +\cellcolor{gray} & & \verb~5~ & & \verb~// Russell Wilkins~\\ +\cellcolor{gray} & & \verb~6~ & & \verb~// ~\\ +\cellcolor{gray} & & \verb~7~ & & \verb~// The use of this software is governed by the Microsoft Public License~\\ +\cellcolor{gray} & & \verb~8~ & & \verb~// which is included with this distribution.~\\ +\cellcolor{gray} & & \verb~9~ & & \verb~// ~\\ +\cellcolor{gray} & & \verb~10~ & & \verb~//-----------------------------------------------------------------------~\\ +\cellcolor{gray} & & \verb~11~ & & \verb~namespace EntityFramework.Auditing~\\ +\cellcolor{gray} & & \verb~12~ & & \verb~{~\\ +\cellcolor{gray} & & \verb~13~ & & \verb~ using System.Configuration;~\\ +\cellcolor{gray} & & \verb~14~ & & \verb~~\\ +\cellcolor{gray} & & \verb~15~ & & \verb~ internal class EntityElement : ConfigurationElement~\\ +\cellcolor{gray} & & \verb~16~ & & \verb~ {~\\ +\cellcolor{gray} & & \verb~17~ & & \verb~ [ConfigurationProperty("name", IsRequired = false)]~\\ +\cellcolor{gray} & & \verb~18~ & & \verb~ internal string Name~\\ +\cellcolor{gray} & & \verb~19~ & & \verb~ {~\\ +\cellcolor{gray} & & \verb~20~ & & \verb~ get~\\ +\cellcolor{green} & 1 & \verb~21~ & & \verb~ {~\\ +\cellcolor{green} & 1 & \verb~22~ & & \verb~ return (string)this["name"];~\\ +\cellcolor{green} & 1 & \verb~23~ & & \verb~ }~\\ +\cellcolor{gray} & & \verb~24~ & & \verb~~\\ +\cellcolor{gray} & & \verb~25~ & & \verb~ set~\\ +\cellcolor{red} & 0 & \verb~26~ & & \verb~ {~\\ +\cellcolor{red} & 0 & \verb~27~ & & \verb~ this["name"] = value;~\\ +\cellcolor{red} & 0 & \verb~28~ & & \verb~ }~\\ +\cellcolor{gray} & & \verb~29~ & & \verb~ }~\\ +\cellcolor{gray} & & \verb~30~ & & \verb~~\\ +\cellcolor{gray} & & \verb~31~ & & \verb~ [ConfigurationProperty("audit", IsRequired = false)]~\\ +\cellcolor{gray} & & \verb~32~ & & \verb~ internal string Audit~\\ +\cellcolor{gray} & & \verb~33~ & & \verb~ {~\\ +\cellcolor{gray} & & \verb~34~ & & \verb~ get~\\ +\cellcolor{green} & 1 & \verb~35~ & & \verb~ {~\\ +\cellcolor{green} & 1 & \verb~36~ & & \verb~ return (string)this["audit"];~\\ +\cellcolor{green} & 1 & \verb~37~ & & \verb~ }~\\ +\cellcolor{gray} & & \verb~38~ & & \verb~~\\ +\cellcolor{gray} & & \verb~39~ & & \verb~ set~\\ +\cellcolor{red} & 0 & \verb~40~ & & \verb~ {~\\ +\cellcolor{red} & 0 & \verb~41~ & & \verb~ this["audit"] = value;~\\ +\cellcolor{red} & 0 & \verb~42~ & & \verb~ }~\\ +\cellcolor{gray} & & \verb~43~ & & \verb~ }~\\ +\cellcolor{gray} & & \verb~44~ & & \verb~ }~\\ +\cellcolor{gray} & & \verb~45~ & & \verb~}~\\ +\end{longtable} +\newpage +\section{EntityFramework.Auditing.EntityElementCollection} +\subsection{Summary} +\begin{longtable}[l]{ll} +\textbf{Class:} & EntityFramework.Auditing.EntityElementCollection\\ +\textbf{Assembly:} & entityframework.auditing.dll\\ +\textbf{File(s):} & \begin{minipage}[t]{12cm}{meworkRepository6\textbackslash AuditDbContextLocal\textbackslash Configuration\textbackslash EntityElementCollection.cs}\end{minipage} \\ +\textbf{Covered lines:} & 6\\ +\textbf{Uncovered lines:} & 10\\ +\textbf{Coverable lines:} & 16\\ +\textbf{Total lines:} & 45\\ +\textbf{Line coverage:} & 37.5\%\\ +\end{longtable} +\subsection{Metrics} +\begin{longtable}[l]{|l|l|l|} +\hline +\textbf{Method} & \textbf{Blocks covered} & \textbf{Blocks not covered}\\ +\hline +\textbf{CreateNewElement()} & 3 & 0\\ +\hline +\textbf{GetElementKey(System} & 3 & 0\\ +\hline +\end{longtable} +\subsection{File(s)} +\subsubsection{meworkRepository6\textbackslash AuditDbContextLocal\textbackslash Configuration\textbackslash EntityElementCollection.cs} +\begin{longtable}[l]{lrrll} +\textbf{} & \textbf{\#} & \textbf{Line} & \textbf{} & \textbf{Line coverage}\\ +\cellcolor{gray} & & \verb~1~ & & \verb~//-----------------------------------------------------------------------~\\ +\cellcolor{gray} & & \verb~2~ & & \verb~// ~\\ +\cellcolor{gray} & & \verb~3~ & & \verb~// Copyright (c) Russell Wilkins 2012. All Rights Reserved.~\\ +\cellcolor{gray} & & \verb~4~ & & \verb~// ~\\ +\cellcolor{gray} & & \verb~5~ & & \verb~// Russell Wilkins~\\ +\cellcolor{gray} & & \verb~6~ & & \verb~// ~\\ +\cellcolor{gray} & & \verb~7~ & & \verb~// The use of this software is governed by the Microsoft Public License~\\ +\cellcolor{gray} & & \verb~8~ & & \verb~// which is included with this distribution.~\\ +\cellcolor{gray} & & \verb~9~ & & \verb~// ~\\ +\cellcolor{gray} & & \verb~10~ & & \verb~//-----------------------------------------------------------------------~\\ +\cellcolor{gray} & & \verb~11~ & & \verb~namespace EntityFramework.Auditing~\\ +\cellcolor{gray} & & \verb~12~ & & \verb~{~\\ +\cellcolor{gray} & & \verb~13~ & & \verb~ using System.Configuration;~\\ +\cellcolor{gray} & & \verb~14~ & & \verb~~\\ +\cellcolor{gray} & & \verb~15~ & & \verb~ internal class EntityElementCollection : ConfigurationElementCollection~\\ +\cellcolor{gray} & & \verb~16~ & & \verb~ {~\\ +\cellcolor{gray} & & \verb~17~ & & \verb~ internal EntityElement this[int index]~\\ +\cellcolor{gray} & & \verb~18~ & & \verb~ {~\\ +\cellcolor{gray} & & \verb~19~ & & \verb~ get~\\ +\cellcolor{red} & 0 & \verb~20~ & & \verb~ {~\\ +\cellcolor{red} & 0 & \verb~21~ & & \verb~ return (EntityElement)BaseGet(index);~\\ +\cellcolor{red} & 0 & \verb~22~ & & \verb~ }~\\ +\cellcolor{gray} & & \verb~23~ & & \verb~~\\ +\cellcolor{gray} & & \verb~24~ & & \verb~ set~\\ +\cellcolor{red} & 0 & \verb~25~ & & \verb~ {~\\ +\cellcolor{red} & 0 & \verb~26~ & & \verb~ if (BaseGet(index) != null)~\\ +\cellcolor{red} & 0 & \verb~27~ & & \verb~ {~\\ +\cellcolor{red} & 0 & \verb~28~ & & \verb~ BaseRemoveAt(index);~\\ +\cellcolor{red} & 0 & \verb~29~ & & \verb~ }~\\ +\cellcolor{gray} & & \verb~30~ & & \verb~~\\ +\cellcolor{red} & 0 & \verb~31~ & & \verb~ BaseAdd(index, value);~\\ +\cellcolor{red} & 0 & \verb~32~ & & \verb~ }~\\ +\cellcolor{gray} & & \verb~33~ & & \verb~ }~\\ +\cellcolor{gray} & & \verb~34~ & & \verb~~\\ +\cellcolor{gray} & & \verb~35~ & & \verb~ protected override ConfigurationElement CreateNewElement()~\\ +\cellcolor{green} & 1 & \verb~36~ & & \verb~ {~\\ +\cellcolor{green} & 1 & \verb~37~ & & \verb~ return new EntityElement();~\\ +\cellcolor{green} & 1 & \verb~38~ & & \verb~ }~\\ +\cellcolor{gray} & & \verb~39~ & & \verb~~\\ +\cellcolor{gray} & & \verb~40~ & & \verb~ protected override object GetElementKey(ConfigurationElement element)~\\ +\cellcolor{green} & 1 & \verb~41~ & & \verb~ {~\\ +\cellcolor{green} & 1 & \verb~42~ & & \verb~ return ((EntityElement)element).Name;~\\ +\cellcolor{green} & 1 & \verb~43~ & & \verb~ }~\\ +\cellcolor{gray} & & \verb~44~ & & \verb~ }~\\ +\cellcolor{gray} & & \verb~45~ & & \verb~}~\\ +\end{longtable} +\newpage +\section{EntityFramework.Auditing.Test.AuditDbTest} +\subsection{Summary} +\begin{longtable}[l]{ll} +\textbf{Class:} & EntityFramework.Auditing.Test.AuditDbTest\\ +\textbf{Assembly:} & entityframework.auditing.test.dll\\ +\textbf{File(s):} & \begin{minipage}[t]{12cm}{C:\textbackslash Development\textbackslash EntityFrameworkRepository6\textbackslash AuditDbContextTests\textbackslash AuditDbTest.cs}\end{minipage} \\ +\textbf{Covered lines:} & 246\\ +\textbf{Uncovered lines:} & 35\\ +\textbf{Coverable lines:} & 281\\ +\textbf{Total lines:} & 483\\ +\textbf{Line coverage:} & 87.5\%\\ +\end{longtable} +\subsection{Metrics} +\begin{longtable}[l]{|l|l|l|} +\hline +\textbf{Method} & \textbf{Blocks covered} & \textbf{Blocks not covered}\\ +\hline +\textbf{AuditDbTest()} & 5 & 0\\ +\hline +\textbf{MyClassInitialize(Mi} & 3 & 0\\ +\hline +\textbf{MyClassCleanup()} & 1 & 0\\ +\hline +\textbf{MyTestInitialize()} & 1 & 0\\ +\hline +\textbf{MyTestCleanup()} & 2 & 0\\ +\hline +\textbf{CreateContext(bool)} & 7 & 0\\ +\hline +\textbf{ClearDatabase()} & 19 & 3\\ +\hline +\textbf{CreateTestNoProxy()} & 5 & 0\\ +\hline +\textbf{CreateTestProxy()} & 5 & 0\\ +\hline +\textbf{CreateTest(EntityFra} & 36 & 1\\ +\hline +\textbf{ProxiesFalseTest()} & 4 & 0\\ +\hline +\textbf{ProxiesTrueTest()} & 4 & 0\\ +\hline +\textbf{ConcurrencyTest()} & 27 & 1\\ +\hline +\textbf{UpdateTestNoProxy()} & 3 & 0\\ +\hline +\textbf{UpdateTestProxy()} & 3 & 0\\ +\hline +\textbf{UpdateTest(EntityFra} & 47 & 0\\ +\hline +\textbf{DeleteTestNoProxy()} & 3 & 0\\ +\hline +\textbf{DeleteTestProxy()} & 3 & 0\\ +\hline +\textbf{GetConnection()} & 9 & 0\\ +\hline +\textbf{DeleteTest(EntityFra} & 48 & 1\\ +\hline +\textbf{RegisterAuditTypeTes} & 5 & 0\\ +\hline +\textbf{RegisterAuditTypeTwi} & 7 & 1\\ +\hline +\textbf{RegisterAuditTypeEnt} & 4 & 1\\ +\hline +\textbf{RegisterAuditTypeEnt} & 4 & 1\\ +\hline +\end{longtable} +\subsection{File(s)} +\subsubsection{C:\textbackslash Development\textbackslash EntityFrameworkRepository6\textbackslash AuditDbContextTests\textbackslash AuditDbTest.cs} +\begin{longtable}[l]{lrrll} +\textbf{} & \textbf{\#} & \textbf{Line} & \textbf{} & \textbf{Line coverage}\\ +\cellcolor{gray} & & \verb~1~ & & \verb~using System;~\\ +\cellcolor{gray} & & \verb~2~ & & \verb~using System.Configuration;~\\ +\cellcolor{gray} & & \verb~3~ & & \verb~using System.Data;~\\ +\cellcolor{gray} & & \verb~4~ & & \verb~using System.Text;~\\ +\cellcolor{gray} & & \verb~5~ & & \verb~using System.Collections.Generic;~\\ +\cellcolor{gray} & & \verb~6~ & & \verb~using System.Linq;~\\ +\cellcolor{gray} & & \verb~7~ & & \verb~using Microsoft.VisualStudio.TestTools.UnitTesting;~\\ +\cellcolor{gray} & & \verb~8~ & & \verb~using System.Data.Entity;~\\ +\cellcolor{gray} & & \verb~9~ & & \verb~using System.Data.SqlClient;~\\ +\cellcolor{gray} & & \verb~10~ & & \verb~using System.Data.Entity.Infrastructure;~\\ +\cellcolor{gray} & & \verb~11~ & & \verb~using System.Data.SqlServerCe;~\\ +\cellcolor{gray} & & \verb~12~ & & \verb~using System.IO;~\\ +\cellcolor{gray} & & \verb~13~ & & \verb~using System.Data.Common;~\\ +\cellcolor{gray} & & \verb~14~ & & \verb~using System.ComponentModel.DataAnnotations.Schema;~\\ +\cellcolor{gray} & & \verb~15~ & & \verb~~\\ +\cellcolor{gray} & & \verb~16~ & & \verb~namespace EntityFramework.Auditing.Test~\\ +\cellcolor{gray} & & \verb~17~ & & \verb~{~\\ +\cellcolor{gray} & & \verb~18~ & & \verb~ /// ~\\ +\cellcolor{gray} & & \verb~19~ & & \verb~ /// Summary description for CodeFirstTest~\\ +\cellcolor{gray} & & \verb~20~ & & \verb~ /// ~\\ +\cellcolor{gray} & & \verb~21~ & & \verb~ [TestClass]~\\ +\cellcolor{gray} & & \verb~22~ & & \verb~ public class AuditDbTest~\\ +\cellcolor{gray} & & \verb~23~ & & \verb~ {~\\ +\cellcolor{green} & 1 & \verb~24~ & & \verb~ public AuditDbTest()~\\ +\cellcolor{green} & 1 & \verb~25~ & & \verb~ {~\\ +\cellcolor{gray} & & \verb~26~ & & \verb~ //~\\ +\cellcolor{gray} & & \verb~27~ & & \verb~ // TODO: Add constructor logic here~\\ +\cellcolor{gray} & & \verb~28~ & & \verb~ //~\\ +\cellcolor{green} & 1 & \verb~29~ & & \verb~ }~\\ +\cellcolor{gray} & & \verb~30~ & & \verb~~\\ +\cellcolor{gray} & & \verb~31~ & & \verb~ private TestContext testContextInstance;~\\ +\cellcolor{gray} & & \verb~32~ & & \verb~~\\ +\cellcolor{gray} & & \verb~33~ & & \verb~ /// ~\\ +\cellcolor{gray} & & \verb~34~ & & \verb~ ///Gets or sets the test context which provides~\\ +\cellcolor{gray} & & \verb~35~ & & \verb~ ///information about and functionality for the current test run.~\\ +\cellcolor{gray} & & \verb~36~ & & \verb~ ///~\\ +\cellcolor{gray} & & \verb~37~ & & \verb~ public TestContext TestContext~\\ +\cellcolor{gray} & & \verb~38~ & & \verb~ {~\\ +\cellcolor{gray} & & \verb~39~ & & \verb~ get~\\ +\cellcolor{red} & 0 & \verb~40~ & & \verb~ {~\\ +\cellcolor{red} & 0 & \verb~41~ & & \verb~ return testContextInstance;~\\ +\cellcolor{red} & 0 & \verb~42~ & & \verb~ }~\\ +\cellcolor{gray} & & \verb~43~ & & \verb~ set~\\ +\cellcolor{green} & 1 & \verb~44~ & & \verb~ {~\\ +\cellcolor{green} & 1 & \verb~45~ & & \verb~ testContextInstance = value;~\\ +\cellcolor{green} & 1 & \verb~46~ & & \verb~ }~\\ +\cellcolor{gray} & & \verb~47~ & & \verb~ }~\\ +\cellcolor{gray} & & \verb~48~ & & \verb~~\\ +\cellcolor{gray} & & \verb~49~ & & \verb~ #region Additional test attributes~\\ +\cellcolor{gray} & & \verb~50~ & & \verb~ //~\\ +\cellcolor{gray} & & \verb~51~ & & \verb~ // You can use the following additional attributes as you write your t~\\ +\cellcolor{gray} & & \verb~52~ & & \verb~ //~\\ +\cellcolor{gray} & & \verb~53~ & & \verb~ // Use ClassInitialize to run code before running the first test in th~\\ +\cellcolor{gray} & & \verb~54~ & & \verb~ [ClassInitialize()]~\\ +\cellcolor{gray} & & \verb~55~ & & \verb~ public static void MyClassInitialize(TestContext testContext)~\\ +\cellcolor{green} & 1 & \verb~56~ & & \verb~ {~\\ +\cellcolor{gray} & & \verb~57~ & & \verb~ //File.Delete(Path.GetDirectoryName(System.Reflection.Assembly.Get~\\ +\cellcolor{green} & 1 & \verb~58~ & & \verb~ var initializer = new DropCreateDatabaseAlways();~\\ +\cellcolor{green} & 1 & \verb~59~ & & \verb~ Database.SetInitializer(initializer);~\\ +\cellcolor{gray} & & \verb~60~ & & \verb~ //Database.DefaultConnectionFactory = new SqlCeConnectionFactory("~\\ +\cellcolor{green} & 1 & \verb~61~ & & \verb~ }~\\ +\cellcolor{gray} & & \verb~62~ & & \verb~~\\ +\cellcolor{gray} & & \verb~63~ & & \verb~ //~\\ +\cellcolor{gray} & & \verb~64~ & & \verb~ // Use ClassCleanup to run code after all tests in a class have run~\\ +\cellcolor{gray} & & \verb~65~ & & \verb~ [ClassCleanup()]~\\ +\cellcolor{gray} & & \verb~66~ & & \verb~ public static void MyClassCleanup()~\\ +\cellcolor{green} & 1 & \verb~67~ & & \verb~ {~\\ +\cellcolor{gray} & & \verb~68~ & & \verb~ //File.Delete(Path.GetDirectoryName(System.Reflection.Assembly.Get~\\ +\cellcolor{green} & 1 & \verb~69~ & & \verb~ }~\\ +\cellcolor{gray} & & \verb~70~ & & \verb~~\\ +\cellcolor{gray} & & \verb~71~ & & \verb~ //~\\ +\cellcolor{gray} & & \verb~72~ & & \verb~ // Use TestInitialize to run code before running each test~\\ +\cellcolor{gray} & & \verb~73~ & & \verb~ [TestInitialize()]~\\ +\cellcolor{gray} & & \verb~74~ & & \verb~ public void MyTestInitialize()~\\ +\cellcolor{green} & 1 & \verb~75~ & & \verb~ {~\\ +\cellcolor{green} & 1 & \verb~76~ & & \verb~ }~\\ +\cellcolor{gray} & & \verb~77~ & & \verb~~\\ +\cellcolor{gray} & & \verb~78~ & & \verb~ //~\\ +\cellcolor{gray} & & \verb~79~ & & \verb~ // Use TestCleanup to run code after each test has run~\\ +\cellcolor{gray} & & \verb~80~ & & \verb~ [TestCleanup()]~\\ +\cellcolor{gray} & & \verb~81~ & & \verb~ public void MyTestCleanup()~\\ +\cellcolor{green} & 1 & \verb~82~ & & \verb~ {~\\ +\cellcolor{green} & 1 & \verb~83~ & & \verb~ this.ClearDatabase();~\\ +\cellcolor{green} & 1 & \verb~84~ & & \verb~ }~\\ +\cellcolor{gray} & & \verb~85~ & & \verb~~\\ +\cellcolor{gray} & & \verb~86~ & & \verb~ #endregion~\\ +\cellcolor{gray} & & \verb~87~ & & \verb~~\\ +\cellcolor{gray} & & \verb~88~ & & \verb~ private Context CreateContext(bool withProxies)~\\ +\cellcolor{green} & 1 & \verb~89~ & & \verb~ {~\\ +\cellcolor{green} & 1 & \verb~90~ & & \verb~ this.ClearDatabase();~\\ +\cellcolor{green} & 1 & \verb~91~ & & \verb~ Context context = new Context(withProxies, contextConnectionString~\\ +\cellcolor{green} & 1 & \verb~92~ & & \verb~ context.SaveChanges();~\\ +\cellcolor{green} & 1 & \verb~93~ & & \verb~ Assert.AreEqual(withProxies, context.Proxies);~\\ +\cellcolor{green} & 1 & \verb~94~ & & \verb~ return context;~\\ +\cellcolor{green} & 1 & \verb~95~ & & \verb~ }~\\ +\cellcolor{gray} & & \verb~96~ & & \verb~~\\ +\cellcolor{gray} & & \verb~97~ & & \verb~ //string contextConnectionString = "AuditDbContextUnitTest";~\\ +\cellcolor{gray} & & \verb~98~ & & \verb~ //string sqlConnectionString = @"Data Source=|DataDirectory|\AuditDbCo~\\ +\cellcolor{green} & 1 & \verb~99~ & & \verb~ string user = "UnitTest";~\\ +\cellcolor{gray} & & \verb~100~ & & \verb~~\\ +\cellcolor{green} & 1 & \verb~101~ & & \verb~ private string contextConnectionString = ConfigurationManager.Connecti~\\ +\cellcolor{gray} & & \verb~102~ & & \verb~~\\ +\cellcolor{gray} & & \verb~103~ & & \verb~ private void ClearDatabase()~\\ +\cellcolor{green} & 1 & \verb~104~ & & \verb~ {~\\ +\cellcolor{gray} & & \verb~105~ & & \verb~ try~\\ +\cellcolor{green} & 1 & \verb~106~ & & \verb~ {~\\ +\cellcolor{green} & 1 & \verb~107~ & & \verb~ using (DbConnection sqlConn = this.GetConnection())~\\ +\cellcolor{green} & 1 & \verb~108~ & & \verb~ {~\\ +\cellcolor{green} & 1 & \verb~109~ & & \verb~ if (sqlConn.State == ConnectionState.Closed)~\\ +\cellcolor{red} & 0 & \verb~110~ & & \verb~ {~\\ +\cellcolor{red} & 0 & \verb~111~ & & \verb~ sqlConn.Open();~\\ +\cellcolor{red} & 0 & \verb~112~ & & \verb~ }~\\ +\cellcolor{green} & 1 & \verb~113~ & & \verb~ using (DbCommand cmd = sqlConn.CreateCommand())~\\ +\cellcolor{green} & 1 & \verb~114~ & & \verb~ {~\\ +\cellcolor{green} & 1 & \verb~115~ & & \verb~ cmd.CommandText = "truncate table customers";~\\ +\cellcolor{green} & 1 & \verb~116~ & & \verb~ cmd.ExecuteNonQuery();~\\ +\cellcolor{green} & 1 & \verb~117~ & & \verb~ }~\\ +\cellcolor{green} & 1 & \verb~118~ & & \verb~ using (DbCommand cmd = sqlConn.CreateCommand())~\\ +\cellcolor{green} & 1 & \verb~119~ & & \verb~ {~\\ +\cellcolor{green} & 1 & \verb~120~ & & \verb~ cmd.CommandText = "truncate table customeraudits";~\\ +\cellcolor{green} & 1 & \verb~121~ & & \verb~ cmd.ExecuteNonQuery();~\\ +\cellcolor{green} & 1 & \verb~122~ & & \verb~ }~\\ +\cellcolor{green} & 1 & \verb~123~ & & \verb~ sqlConn.Close();~\\ +\cellcolor{green} & 1 & \verb~124~ & & \verb~ }~\\ +\cellcolor{green} & 1 & \verb~125~ & & \verb~ }~\\ +\cellcolor{red} & 0 & \verb~126~ & & \verb~ catch { }~\\ +\cellcolor{green} & 1 & \verb~127~ & & \verb~ }~\\ +\cellcolor{gray} & & \verb~128~ & & \verb~~\\ +\cellcolor{gray} & & \verb~129~ & & \verb~ [TestCategory("AuditDbContext")]~\\ +\cellcolor{gray} & & \verb~130~ & & \verb~ [TestMethod]~\\ +\cellcolor{gray} & & \verb~131~ & & \verb~ public void CreateTestNoProxy()~\\ +\cellcolor{green} & 1 & \verb~132~ & & \verb~ {~\\ +\cellcolor{green} & 1 & \verb~133~ & & \verb~ using (Context context = this.CreateContext(false))~\\ +\cellcolor{green} & 1 & \verb~134~ & & \verb~ {~\\ +\cellcolor{green} & 1 & \verb~135~ & & \verb~ this.CreateTest(context);~\\ +\cellcolor{green} & 1 & \verb~136~ & & \verb~ }~\\ +\cellcolor{green} & 1 & \verb~137~ & & \verb~ }~\\ +\cellcolor{gray} & & \verb~138~ & & \verb~~\\ +\cellcolor{gray} & & \verb~139~ & & \verb~ [TestCategory("AuditDbContext")]~\\ +\cellcolor{gray} & & \verb~140~ & & \verb~ [TestMethod]~\\ +\cellcolor{gray} & & \verb~141~ & & \verb~ public void CreateTestProxy()~\\ +\cellcolor{green} & 1 & \verb~142~ & & \verb~ {~\\ +\cellcolor{green} & 1 & \verb~143~ & & \verb~ using (Context context = this.CreateContext(true))~\\ +\cellcolor{green} & 1 & \verb~144~ & & \verb~ {~\\ +\cellcolor{green} & 1 & \verb~145~ & & \verb~ this.CreateTest(context);~\\ +\cellcolor{green} & 1 & \verb~146~ & & \verb~ }~\\ +\cellcolor{green} & 1 & \verb~147~ & & \verb~ }~\\ +\cellcolor{gray} & & \verb~148~ & & \verb~~\\ +\cellcolor{gray} & & \verb~149~ & & \verb~ private void CreateTest(Context context)~\\ +\cellcolor{green} & 1 & \verb~150~ & & \verb~ {~\\ +\cellcolor{gray} & & \verb~151~ & & \verb~ // Add the customer~\\ +\cellcolor{green} & 1 & \verb~152~ & & \verb~ Customer customer = context.Customers.Create();~\\ +\cellcolor{green} & 1 & \verb~153~ & & \verb~ customer.CustomerName = "Customer 1";~\\ +\cellcolor{green} & 1 & \verb~154~ & & \verb~ context.Customers.Add(customer);~\\ +\cellcolor{green} & 1 & \verb~155~ & & \verb~ context.SaveChanges(user);~\\ +\cellcolor{gray} & & \verb~156~ & & \verb~~\\ +\cellcolor{green} & 1 & \verb~157~ & & \verb~ using (DbConnection conn = this.GetConnection())~\\ +\cellcolor{green} & 1 & \verb~158~ & & \verb~ {~\\ +\cellcolor{green} & 1 & \verb~159~ & & \verb~ using (DbCommand cmd = conn.CreateCommand())~\\ +\cellcolor{green} & 1 & \verb~160~ & & \verb~ {~\\ +\cellcolor{green} & 1 & \verb~161~ & & \verb~ cmd.CommandText = "select * from customers";~\\ +\cellcolor{green} & 1 & \verb~162~ & & \verb~ using (var r = cmd.ExecuteReader())~\\ +\cellcolor{green} & 1 & \verb~163~ & & \verb~ {~\\ +\cellcolor{green} & 1 & \verb~164~ & & \verb~ int records = 0;~\\ +\cellcolor{green} & 1 & \verb~165~ & & \verb~ while (r.Read())~\\ +\cellcolor{green} & 1 & \verb~166~ & & \verb~ {~\\ +\cellcolor{green} & 1 & \verb~167~ & & \verb~ records++;~\\ +\cellcolor{green} & 1 & \verb~168~ & & \verb~ }~\\ +\cellcolor{green} & 1 & \verb~169~ & & \verb~ r.Close();~\\ +\cellcolor{green} & 1 & \verb~170~ & & \verb~ Assert.AreEqual(1, records);~\\ +\cellcolor{green} & 1 & \verb~171~ & & \verb~ }~\\ +\cellcolor{green} & 1 & \verb~172~ & & \verb~ }~\\ +\cellcolor{gray} & & \verb~173~ & & \verb~~\\ +\cellcolor{green} & 1 & \verb~174~ & & \verb~ using (DbCommand cmd = conn.CreateCommand())~\\ +\cellcolor{green} & 1 & \verb~175~ & & \verb~ {~\\ +\cellcolor{green} & 1 & \verb~176~ & & \verb~ cmd.CommandText = "select * from customeraudits";~\\ +\cellcolor{green} & 1 & \verb~177~ & & \verb~ using (var r = cmd.ExecuteReader())~\\ +\cellcolor{green} & 1 & \verb~178~ & & \verb~ {~\\ +\cellcolor{green} & 1 & \verb~179~ & & \verb~ int records = 0;~\\ +\cellcolor{green} & 1 & \verb~180~ & & \verb~ while (r.Read())~\\ +\cellcolor{red} & 0 & \verb~181~ & & \verb~ {~\\ +\cellcolor{red} & 0 & \verb~182~ & & \verb~ records++;~\\ +\cellcolor{red} & 0 & \verb~183~ & & \verb~ }~\\ +\cellcolor{green} & 1 & \verb~184~ & & \verb~ r.Close();~\\ +\cellcolor{green} & 1 & \verb~185~ & & \verb~ Assert.AreEqual(0, records);~\\ +\cellcolor{green} & 1 & \verb~186~ & & \verb~ }~\\ +\cellcolor{green} & 1 & \verb~187~ & & \verb~ }~\\ +\cellcolor{green} & 1 & \verb~188~ & & \verb~ conn.Close();~\\ +\cellcolor{green} & 1 & \verb~189~ & & \verb~ }~\\ +\cellcolor{green} & 1 & \verb~190~ & & \verb~ }~\\ +\cellcolor{gray} & & \verb~191~ & & \verb~~\\ +\cellcolor{gray} & & \verb~192~ & & \verb~ [TestCategory("AuditDbContext")]~\\ +\cellcolor{gray} & & \verb~193~ & & \verb~ [TestMethod]~\\ +\cellcolor{gray} & & \verb~194~ & & \verb~ public void ProxiesFalseTest()~\\ +\cellcolor{green} & 1 & \verb~195~ & & \verb~ {~\\ +\cellcolor{green} & 1 & \verb~196~ & & \verb~ Context context = new Context(false, contextConnectionString);~\\ +\cellcolor{green} & 1 & \verb~197~ & & \verb~ Assert.IsFalse(context.Proxies);~\\ +\cellcolor{green} & 1 & \verb~198~ & & \verb~ }~\\ +\cellcolor{gray} & & \verb~199~ & & \verb~~\\ +\cellcolor{gray} & & \verb~200~ & & \verb~ [TestCategory("AuditDbContext")]~\\ +\cellcolor{gray} & & \verb~201~ & & \verb~ [TestMethod]~\\ +\cellcolor{gray} & & \verb~202~ & & \verb~ public void ProxiesTrueTest()~\\ +\cellcolor{green} & 1 & \verb~203~ & & \verb~ {~\\ +\cellcolor{green} & 1 & \verb~204~ & & \verb~ Context context = new Context(true, contextConnectionString);~\\ +\cellcolor{green} & 1 & \verb~205~ & & \verb~ Assert.IsTrue(context.Proxies);~\\ +\cellcolor{green} & 1 & \verb~206~ & & \verb~ }~\\ +\cellcolor{gray} & & \verb~207~ & & \verb~~\\ +\cellcolor{gray} & & \verb~208~ & & \verb~ [TestCategory("AuditDbContext")]~\\ +\cellcolor{gray} & & \verb~209~ & & \verb~ [TestMethod]~\\ +\cellcolor{gray} & & \verb~210~ & & \verb~ public void ConcurrencyTest()~\\ +\cellcolor{green} & 1 & \verb~211~ & & \verb~ {~\\ +\cellcolor{green} & 1 & \verb~212~ & & \verb~ Context context1 = new Context(true, contextConnectionString);~\\ +\cellcolor{green} & 1 & \verb~213~ & & \verb~ Context context2 = new Context(true, contextConnectionString);~\\ +\cellcolor{gray} & & \verb~214~ & & \verb~~\\ +\cellcolor{green} & 1 & \verb~215~ & & \verb~ Customer customer1 = context1.Customers.Create();~\\ +\cellcolor{green} & 1 & \verb~216~ & & \verb~ customer1.CustomerName = "Customer 1";~\\ +\cellcolor{green} & 1 & \verb~217~ & & \verb~ Customer customer3 = context1.Customers.Create();~\\ +\cellcolor{green} & 1 & \verb~218~ & & \verb~ customer3.CustomerName = "Customer 3";~\\ +\cellcolor{green} & 1 & \verb~219~ & & \verb~ context1.Customers.Add(customer3);~\\ +\cellcolor{green} & 1 & \verb~220~ & & \verb~ context1.Customers.Add(customer1);~\\ +\cellcolor{green} & 1 & \verb~221~ & & \verb~ context1.SaveChanges(user);~\\ +\cellcolor{gray} & & \verb~222~ & & \verb~~\\ +\cellcolor{green} & 1 & \verb~223~ & & \verb~ Customer customer2 = context2.Customers.Find(customer1.Id);~\\ +\cellcolor{green} & 1 & \verb~224~ & & \verb~ customer2.CustomerName = "Changed 2";~\\ +\cellcolor{green} & 1 & \verb~225~ & & \verb~ context2.SaveChanges(user);~\\ +\cellcolor{gray} & & \verb~226~ & & \verb~~\\ +\cellcolor{green} & 1 & \verb~227~ & & \verb~ customer3.CustomerName = "arsd";~\\ +\cellcolor{green} & 1 & \verb~228~ & & \verb~ customer1.CustomerName = "Concurrency";~\\ +\cellcolor{gray} & & \verb~229~ & & \verb~~\\ +\cellcolor{gray} & & \verb~230~ & & \verb~ try~\\ +\cellcolor{green} & 1 & \verb~231~ & & \verb~ {~\\ +\cellcolor{green} & 1 & \verb~232~ & & \verb~ context1.SaveChanges(user);~\\ +\cellcolor{red} & 0 & \verb~233~ & & \verb~ }~\\ +\cellcolor{green} & 1 & \verb~234~ & & \verb~ catch~\\ +\cellcolor{green} & 1 & \verb~235~ & & \verb~ { }~\\ +\cellcolor{gray} & & \verb~236~ & & \verb~~\\ +\cellcolor{green} & 1 & \verb~237~ & & \verb~ context1.Reload(customer1);~\\ +\cellcolor{green} & 1 & \verb~238~ & & \verb~ customer1.CustomerName = "Changed after concurrency failure";~\\ +\cellcolor{green} & 1 & \verb~239~ & & \verb~ context1.SaveChanges(user);~\\ +\cellcolor{green} & 1 & \verb~240~ & & \verb~ }~\\ +\cellcolor{gray} & & \verb~241~ & & \verb~~\\ +\cellcolor{gray} & & \verb~242~ & & \verb~ [TestCategory("AuditDbContext")]~\\ +\cellcolor{gray} & & \verb~243~ & & \verb~ [TestMethod]~\\ +\cellcolor{gray} & & \verb~244~ & & \verb~ public void UpdateTestNoProxy()~\\ +\cellcolor{green} & 1 & \verb~245~ & & \verb~ {~\\ +\cellcolor{green} & 1 & \verb~246~ & & \verb~ Context context = this.CreateContext(false);~\\ +\cellcolor{green} & 1 & \verb~247~ & & \verb~ this.UpdateTest(context);~\\ +\cellcolor{green} & 1 & \verb~248~ & & \verb~ }~\\ +\cellcolor{gray} & & \verb~249~ & & \verb~~\\ +\cellcolor{gray} & & \verb~250~ & & \verb~ [TestCategory("AuditDbContext")]~\\ +\cellcolor{gray} & & \verb~251~ & & \verb~ [TestMethod]~\\ +\cellcolor{gray} & & \verb~252~ & & \verb~ public void UpdateTestProxy()~\\ +\cellcolor{green} & 1 & \verb~253~ & & \verb~ {~\\ +\cellcolor{green} & 1 & \verb~254~ & & \verb~ Context context = this.CreateContext(true);~\\ +\cellcolor{green} & 1 & \verb~255~ & & \verb~ this.UpdateTest(context);~\\ +\cellcolor{green} & 1 & \verb~256~ & & \verb~ }~\\ +\cellcolor{gray} & & \verb~257~ & & \verb~~\\ +\cellcolor{gray} & & \verb~258~ & & \verb~ private void UpdateTest(Context context)~\\ +\cellcolor{green} & 1 & \verb~259~ & & \verb~ {~\\ +\cellcolor{green} & 1 & \verb~260~ & & \verb~ string customerName = "Updated";~\\ +\cellcolor{green} & 1 & \verb~261~ & & \verb~ DateTimeOffset updated = DateTimeOffset.Now;~\\ +\cellcolor{gray} & & \verb~262~ & & \verb~~\\ +\cellcolor{green} & 1 & \verb~263~ & & \verb~ DbConnection conn = this.GetConnection();~\\ +\cellcolor{gray} & & \verb~264~ & & \verb~~\\ +\cellcolor{green} & 1 & \verb~265~ & & \verb~ var newCustomer = new Customer { CustomerName = "Unit Test", Updat~\\ +\cellcolor{green} & 1 & \verb~266~ & & \verb~ context.Customers.Add(newCustomer);~\\ +\cellcolor{green} & 1 & \verb~267~ & & \verb~ context.SaveChanges(user);~\\ +\cellcolor{gray} & & \verb~268~ & & \verb~~\\ +\cellcolor{green} & 1 & \verb~269~ & & \verb~ Customer customer = context.Customers.Find(1);~\\ +\cellcolor{green} & 1 & \verb~270~ & & \verb~ customer.CustomerName = customerName;~\\ +\cellcolor{green} & 1 & \verb~271~ & & \verb~ context.SaveChanges(user);~\\ +\cellcolor{gray} & & \verb~272~ & & \verb~~\\ +\cellcolor{gray} & & \verb~273~ & & \verb~ // Chech the audit records has been created.~\\ +\cellcolor{green} & 1 & \verb~274~ & & \verb~ using (DbCommand cmd = conn.CreateCommand())~\\ +\cellcolor{green} & 1 & \verb~275~ & & \verb~ {~\\ +\cellcolor{green} & 1 & \verb~276~ & & \verb~ cmd.CommandText = "select * from customeraudits";~\\ +\cellcolor{green} & 1 & \verb~277~ & & \verb~ using (var r = cmd.ExecuteReader())~\\ +\cellcolor{green} & 1 & \verb~278~ & & \verb~ {~\\ +\cellcolor{green} & 1 & \verb~279~ & & \verb~ int records = 0;~\\ +\cellcolor{green} & 1 & \verb~280~ & & \verb~ while (r.Read())~\\ +\cellcolor{green} & 1 & \verb~281~ & & \verb~ {~\\ +\cellcolor{green} & 1 & \verb~282~ & & \verb~ records++;~\\ +\cellcolor{green} & 1 & \verb~283~ & & \verb~ }~\\ +\cellcolor{green} & 1 & \verb~284~ & & \verb~ Assert.AreEqual(1, records);~\\ +\cellcolor{green} & 1 & \verb~285~ & & \verb~ }~\\ +\cellcolor{green} & 1 & \verb~286~ & & \verb~ }~\\ +\cellcolor{gray} & & \verb~287~ & & \verb~~\\ +\cellcolor{gray} & & \verb~288~ & & \verb~ // Check the audit fields.~\\ +\cellcolor{green} & 1 & \verb~289~ & & \verb~ using (DbCommand cmd = conn.CreateCommand())~\\ +\cellcolor{green} & 1 & \verb~290~ & & \verb~ {~\\ +\cellcolor{green} & 1 & \verb~291~ & & \verb~ cmd.CommandText = "select * from customeraudits";~\\ +\cellcolor{green} & 1 & \verb~292~ & & \verb~ using (var r = cmd.ExecuteReader())~\\ +\cellcolor{green} & 1 & \verb~293~ & & \verb~ {~\\ +\cellcolor{green} & 1 & \verb~294~ & & \verb~ r.Read();~\\ +\cellcolor{green} & 1 & \verb~295~ & & \verb~ Assert.AreEqual(1, r["Id"]);~\\ +\cellcolor{green} & 1 & \verb~296~ & & \verb~ Assert.AreEqual(1, r["AuditSourceId"]);~\\ +\cellcolor{green} & 1 & \verb~297~ & & \verb~ Assert.AreEqual(user, r["UpdateUser"]);~\\ +\cellcolor{gray} & & \verb~298~ & & \verb~ //Assert.AreEqual(updated, r["Updated"]);~\\ +\cellcolor{green} & 1 & \verb~299~ & & \verb~ Assert.AreEqual("Unit Test", r["CustomerName"]);~\\ +\cellcolor{green} & 1 & \verb~300~ & & \verb~ Assert.AreEqual(user, r["AuditUser"]);~\\ +\cellcolor{green} & 1 & \verb~301~ & & \verb~ Assert.AreEqual("update", r["AuditType"]);~\\ +\cellcolor{green} & 1 & \verb~302~ & & \verb~ }~\\ +\cellcolor{green} & 1 & \verb~303~ & & \verb~ }~\\ +\cellcolor{green} & 1 & \verb~304~ & & \verb~ }~\\ +\cellcolor{gray} & & \verb~305~ & & \verb~~\\ +\cellcolor{gray} & & \verb~306~ & & \verb~ [TestCategory("AuditDbContext")]~\\ +\cellcolor{gray} & & \verb~307~ & & \verb~ [TestMethod]~\\ +\cellcolor{gray} & & \verb~308~ & & \verb~ public void DeleteTestNoProxy()~\\ +\cellcolor{green} & 1 & \verb~309~ & & \verb~ {~\\ +\cellcolor{green} & 1 & \verb~310~ & & \verb~ Context context = this.CreateContext(false);~\\ +\cellcolor{green} & 1 & \verb~311~ & & \verb~ this.DeleteTest(context);~\\ +\cellcolor{green} & 1 & \verb~312~ & & \verb~ }~\\ +\cellcolor{gray} & & \verb~313~ & & \verb~~\\ +\cellcolor{gray} & & \verb~314~ & & \verb~ [TestCategory("AuditDbContext")]~\\ +\cellcolor{gray} & & \verb~315~ & & \verb~ [TestMethod]~\\ +\cellcolor{gray} & & \verb~316~ & & \verb~ public void DeleteTestProxy()~\\ +\cellcolor{green} & 1 & \verb~317~ & & \verb~ {~\\ +\cellcolor{green} & 1 & \verb~318~ & & \verb~ Context context = this.CreateContext(true);~\\ +\cellcolor{green} & 1 & \verb~319~ & & \verb~ this.DeleteTest(context);~\\ +\cellcolor{green} & 1 & \verb~320~ & & \verb~ }~\\ +\cellcolor{gray} & & \verb~321~ & & \verb~~\\ +\cellcolor{gray} & & \verb~322~ & & \verb~ private DbConnection GetConnection()~\\ +\cellcolor{green} & 1 & \verb~323~ & & \verb~ {~\\ +\cellcolor{gray} & & \verb~324~ & & \verb~ //SqlCeConnection conn = new SqlCeConnection(sqlConnectionString);~\\ +\cellcolor{green} & 1 & \verb~325~ & & \verb~ SqlConnection conn = new SqlConnection(contextConnectionString);~\\ +\cellcolor{green} & 1 & \verb~326~ & & \verb~ conn.Open();~\\ +\cellcolor{gray} & & \verb~327~ & & \verb~~\\ +\cellcolor{green} & 1 & \verb~328~ & & \verb~ using (DbCommand cmd = conn.CreateCommand())~\\ +\cellcolor{green} & 1 & \verb~329~ & & \verb~ {~\\ +\cellcolor{green} & 1 & \verb~330~ & & \verb~ cmd.CommandText = @"set identity_insert customers on";~\\ +\cellcolor{green} & 1 & \verb~331~ & & \verb~ cmd.ExecuteNonQuery();~\\ +\cellcolor{green} & 1 & \verb~332~ & & \verb~ }~\\ +\cellcolor{gray} & & \verb~333~ & & \verb~~\\ +\cellcolor{green} & 1 & \verb~334~ & & \verb~ return conn;~\\ +\cellcolor{green} & 1 & \verb~335~ & & \verb~ }~\\ +\cellcolor{gray} & & \verb~336~ & & \verb~~\\ +\cellcolor{gray} & & \verb~337~ & & \verb~ private void DeleteTest(Context context)~\\ +\cellcolor{green} & 1 & \verb~338~ & & \verb~ {~\\ +\cellcolor{green} & 1 & \verb~339~ & & \verb~ DbConnection conn = this.GetConnection();~\\ +\cellcolor{gray} & & \verb~340~ & & \verb~~\\ +\cellcolor{green} & 1 & \verb~341~ & & \verb~ using (DbCommand cmd = conn.CreateCommand())~\\ +\cellcolor{green} & 1 & \verb~342~ & & \verb~ {~\\ +\cellcolor{green} & 1 & \verb~343~ & & \verb~ cmd.CommandText = @"INSERT INTO Customers(Id, CustomerName,Upd~\\ +\cellcolor{green} & 1 & \verb~344~ & & \verb~ int r = cmd.ExecuteNonQuery();~\\ +\cellcolor{green} & 1 & \verb~345~ & & \verb~ Assert.AreEqual(1, r);~\\ +\cellcolor{green} & 1 & \verb~346~ & & \verb~ }~\\ +\cellcolor{gray} & & \verb~347~ & & \verb~~\\ +\cellcolor{green} & 1 & \verb~348~ & & \verb~ Customer customer = context.Customers.Find(1);~\\ +\cellcolor{green} & 1 & \verb~349~ & & \verb~ context.Customers.Remove(customer);~\\ +\cellcolor{green} & 1 & \verb~350~ & & \verb~ context.SaveChanges(user);~\\ +\cellcolor{gray} & & \verb~351~ & & \verb~~\\ +\cellcolor{green} & 1 & \verb~352~ & & \verb~ using (DbCommand cmd = conn.CreateCommand())~\\ +\cellcolor{green} & 1 & \verb~353~ & & \verb~ {~\\ +\cellcolor{green} & 1 & \verb~354~ & & \verb~ cmd.CommandText = "select * from customers";~\\ +\cellcolor{green} & 1 & \verb~355~ & & \verb~ using (var r = cmd.ExecuteReader())~\\ +\cellcolor{green} & 1 & \verb~356~ & & \verb~ {~\\ +\cellcolor{green} & 1 & \verb~357~ & & \verb~ int records = 0;~\\ +\cellcolor{green} & 1 & \verb~358~ & & \verb~ while (r.Read())~\\ +\cellcolor{red} & 0 & \verb~359~ & & \verb~ {~\\ +\cellcolor{red} & 0 & \verb~360~ & & \verb~ records++;~\\ +\cellcolor{red} & 0 & \verb~361~ & & \verb~ }~\\ +\cellcolor{green} & 1 & \verb~362~ & & \verb~ Assert.AreEqual(0, records);~\\ +\cellcolor{green} & 1 & \verb~363~ & & \verb~ }~\\ +\cellcolor{green} & 1 & \verb~364~ & & \verb~ }~\\ +\cellcolor{gray} & & \verb~365~ & & \verb~~\\ +\cellcolor{green} & 1 & \verb~366~ & & \verb~ using (DbCommand cmd = conn.CreateCommand())~\\ +\cellcolor{green} & 1 & \verb~367~ & & \verb~ {~\\ +\cellcolor{green} & 1 & \verb~368~ & & \verb~ cmd.CommandText = "select * from customeraudits";~\\ +\cellcolor{green} & 1 & \verb~369~ & & \verb~ using (var r = cmd.ExecuteReader())~\\ +\cellcolor{green} & 1 & \verb~370~ & & \verb~ {~\\ +\cellcolor{green} & 1 & \verb~371~ & & \verb~ int records = 0;~\\ +\cellcolor{green} & 1 & \verb~372~ & & \verb~ while (r.Read())~\\ +\cellcolor{green} & 1 & \verb~373~ & & \verb~ {~\\ +\cellcolor{green} & 1 & \verb~374~ & & \verb~ records++;~\\ +\cellcolor{green} & 1 & \verb~375~ & & \verb~ }~\\ +\cellcolor{green} & 1 & \verb~376~ & & \verb~ Assert.AreEqual(1, records);~\\ +\cellcolor{gray} & & \verb~377~ & & \verb~~\\ +\cellcolor{green} & 1 & \verb~378~ & & \verb~ }~\\ +\cellcolor{green} & 1 & \verb~379~ & & \verb~ }~\\ +\cellcolor{gray} & & \verb~380~ & & \verb~~\\ +\cellcolor{green} & 1 & \verb~381~ & & \verb~ using (DbCommand cmd = conn.CreateCommand())~\\ +\cellcolor{green} & 1 & \verb~382~ & & \verb~ {~\\ +\cellcolor{green} & 1 & \verb~383~ & & \verb~ cmd.CommandText = "select * from customeraudits";~\\ +\cellcolor{green} & 1 & \verb~384~ & & \verb~ using (var r = cmd.ExecuteReader())~\\ +\cellcolor{green} & 1 & \verb~385~ & & \verb~ {~\\ +\cellcolor{green} & 1 & \verb~386~ & & \verb~ r.Read();~\\ +\cellcolor{green} & 1 & \verb~387~ & & \verb~ Assert.AreEqual(user, r["AuditUser"]);~\\ +\cellcolor{green} & 1 & \verb~388~ & & \verb~ Assert.AreEqual("delete", r["AuditType"]);~\\ +\cellcolor{green} & 1 & \verb~389~ & & \verb~ }~\\ +\cellcolor{green} & 1 & \verb~390~ & & \verb~ }~\\ +\cellcolor{green} & 1 & \verb~391~ & & \verb~ }~\\ +\cellcolor{gray} & & \verb~392~ & & \verb~~\\ +\cellcolor{gray} & & \verb~393~ & & \verb~ [TestCategory("AuditDbContext")]~\\ +\cellcolor{gray} & & \verb~394~ & & \verb~ [TestMethod()]~\\ +\cellcolor{gray} & & \verb~395~ & & \verb~ public void RegisterAuditTypeTest()~\\ +\cellcolor{green} & 1 & \verb~396~ & & \verb~ {~\\ +\cellcolor{green} & 1 & \verb~397~ & & \verb~ AuditDbContext context = new AuditDbContext("test");~\\ +\cellcolor{green} & 1 & \verb~398~ & & \verb~ AuditDbContext.RegisterAuditType(typeof(TestEntityWithComplexType)~\\ +\cellcolor{green} & 1 & \verb~399~ & & \verb~ }~\\ +\cellcolor{gray} & & \verb~400~ & & \verb~~\\ +\cellcolor{gray} & & \verb~401~ & & \verb~ [TestCategory("AuditDbContext")]~\\ +\cellcolor{gray} & & \verb~402~ & & \verb~ [TestMethod()]~\\ +\cellcolor{gray} & & \verb~403~ & & \verb~ [ExpectedException(typeof(ArgumentException), "Entity")]~\\ +\cellcolor{gray} & & \verb~404~ & & \verb~ public void RegisterAuditTypeTwiceExceptionTest()~\\ +\cellcolor{green} & 1 & \verb~405~ & & \verb~ {~\\ +\cellcolor{green} & 1 & \verb~406~ & & \verb~ AuditDbContext context = new AuditDbContext("test");~\\ +\cellcolor{green} & 1 & \verb~407~ & & \verb~ AuditDbContext.RegisterAuditType(typeof(TestEntity), typeof(TestEn~\\ +\cellcolor{green} & 1 & \verb~408~ & & \verb~ AuditDbContext.RegisterAuditType(typeof(TestEntity), typeof(TestEn~\\ +\cellcolor{red} & 0 & \verb~409~ & & \verb~ }~\\ +\cellcolor{gray} & & \verb~410~ & & \verb~~\\ +\cellcolor{gray} & & \verb~411~ & & \verb~ [TestCategory("AuditDbContext")]~\\ +\cellcolor{gray} & & \verb~412~ & & \verb~ [TestMethod()]~\\ +\cellcolor{gray} & & \verb~413~ & & \verb~ [ExpectedException(typeof(ArgumentException), "Entity")]~\\ +\cellcolor{gray} & & \verb~414~ & & \verb~ public void RegisterAuditTypeEntityExceptionTest1()~\\ +\cellcolor{green} & 1 & \verb~415~ & & \verb~ {~\\ +\cellcolor{green} & 1 & \verb~416~ & & \verb~ AuditDbContext context = new AuditDbContext("test");~\\ +\cellcolor{green} & 1 & \verb~417~ & & \verb~ AuditDbContext.RegisterAuditType(typeof(TestInvalidEntity), typeof~\\ +\cellcolor{red} & 0 & \verb~418~ & & \verb~ }~\\ +\cellcolor{gray} & & \verb~419~ & & \verb~~\\ +\cellcolor{gray} & & \verb~420~ & & \verb~ [TestCategory("AuditDbContext")]~\\ +\cellcolor{gray} & & \verb~421~ & & \verb~ [TestMethod()]~\\ +\cellcolor{gray} & & \verb~422~ & & \verb~ [ExpectedException(typeof(ArgumentException), "Entity")]~\\ +\cellcolor{gray} & & \verb~423~ & & \verb~ public void RegisterAuditTypeEntityExceptionTest2()~\\ +\cellcolor{green} & 1 & \verb~424~ & & \verb~ {~\\ +\cellcolor{green} & 1 & \verb~425~ & & \verb~ AuditDbContext context = new AuditDbContext("test");~\\ +\cellcolor{green} & 1 & \verb~426~ & & \verb~ AuditDbContext.RegisterAuditType(typeof(TestEntity), typeof(TestIn~\\ +\cellcolor{red} & 0 & \verb~427~ & & \verb~ }~\\ +\cellcolor{gray} & & \verb~428~ & & \verb~~\\ +\cellcolor{gray} & & \verb~429~ & & \verb~ #region Unit test classes~\\ +\cellcolor{gray} & & \verb~430~ & & \verb~ class TestInvalidEntity~\\ +\cellcolor{gray} & & \verb~431~ & & \verb~ {~\\ +\cellcolor{gray} & & \verb~432~ & & \verb~~\\ +\cellcolor{gray} & & \verb~433~ & & \verb~ }~\\ +\cellcolor{gray} & & \verb~434~ & & \verb~~\\ +\cellcolor{gray} & & \verb~435~ & & \verb~ class TestInvalidAuditEntity~\\ +\cellcolor{gray} & & \verb~436~ & & \verb~ {~\\ +\cellcolor{gray} & & \verb~437~ & & \verb~~\\ +\cellcolor{gray} & & \verb~438~ & & \verb~ }~\\ +\cellcolor{gray} & & \verb~439~ & & \verb~~\\ +\cellcolor{gray} & & \verb~440~ & & \verb~ class TestEntity : IAuditableEntity~\\ +\cellcolor{gray} & & \verb~441~ & & \verb~ {~\\ +\cellcolor{red} & 0 & \verb~442~ & & \verb~ public DateTimeOffset? Updated { get; set; }~\\ +\cellcolor{red} & 0 & \verb~443~ & & \verb~ public string UpdateUser { get; set; }~\\ +\cellcolor{gray} & & \verb~444~ & & \verb~ }~\\ +\cellcolor{gray} & & \verb~445~ & & \verb~~\\ +\cellcolor{gray} & & \verb~446~ & & \verb~ class TestEntityWithComplexType : IAuditableEntity~\\ +\cellcolor{gray} & & \verb~447~ & & \verb~ {~\\ +\cellcolor{red} & 0 & \verb~448~ & & \verb~ public TestComplexType Address { get; set; }~\\ +\cellcolor{red} & 0 & \verb~449~ & & \verb~ public DateTimeOffset? Updated { get; set; }~\\ +\cellcolor{red} & 0 & \verb~450~ & & \verb~ public string UpdateUser { get; set; }~\\ +\cellcolor{gray} & & \verb~451~ & & \verb~ }~\\ +\cellcolor{gray} & & \verb~452~ & & \verb~~\\ +\cellcolor{gray} & & \verb~453~ & & \verb~ [ComplexType]~\\ +\cellcolor{gray} & & \verb~454~ & & \verb~ class TestComplexType~\\ +\cellcolor{gray} & & \verb~455~ & & \verb~ {~\\ +\cellcolor{red} & 0 & \verb~456~ & & \verb~ public string AddressLine1 { get; set; }~\\ +\cellcolor{gray} & & \verb~457~ & & \verb~ }~\\ +\cellcolor{gray} & & \verb~458~ & & \verb~~\\ +\cellcolor{gray} & & \verb~459~ & & \verb~ class TestEntityAudit : IAuditEntity~\\ +\cellcolor{gray} & & \verb~460~ & & \verb~ {~\\ +\cellcolor{red} & 0 & \verb~461~ & & \verb~ public DateTimeOffset Updated { get; set; }~\\ +\cellcolor{red} & 0 & \verb~462~ & & \verb~ public string UpdateUser { get; set; }~\\ +\cellcolor{red} & 0 & \verb~463~ & & \verb~ public DateTimeOffset Audited { get; set; }~\\ +\cellcolor{red} & 0 & \verb~464~ & & \verb~ public string AuditUser { get; set; }~\\ +\cellcolor{red} & 0 & \verb~465~ & & \verb~ public string AuditType { get; set; }~\\ +\cellcolor{red} & 0 & \verb~466~ & & \verb~ public int AuditSourceId { get; set; }~\\ +\cellcolor{gray} & & \verb~467~ & & \verb~ }~\\ +\cellcolor{gray} & & \verb~468~ & & \verb~~\\ +\cellcolor{gray} & & \verb~469~ & & \verb~ class TestEntityWithComplexTypeAudit : IAuditEntity~\\ +\cellcolor{gray} & & \verb~470~ & & \verb~ {~\\ +\cellcolor{red} & 0 & \verb~471~ & & \verb~ public DateTimeOffset Updated { get; set; }~\\ +\cellcolor{red} & 0 & \verb~472~ & & \verb~ public string UpdateUser { get; set; }~\\ +\cellcolor{red} & 0 & \verb~473~ & & \verb~ public DateTimeOffset Audited { get; set; }~\\ +\cellcolor{red} & 0 & \verb~474~ & & \verb~ public string AuditUser { get; set; }~\\ +\cellcolor{red} & 0 & \verb~475~ & & \verb~ public string AuditType { get; set; }~\\ +\cellcolor{red} & 0 & \verb~476~ & & \verb~ public int AuditSourceId { get; set; }~\\ +\cellcolor{gray} & & \verb~477~ & & \verb~ }~\\ +\cellcolor{gray} & & \verb~478~ & & \verb~ #endregion~\\ +\cellcolor{gray} & & \verb~479~ & & \verb~~\\ +\cellcolor{gray} & & \verb~480~ & & \verb~~\\ +\cellcolor{gray} & & \verb~481~ & & \verb~~\\ +\cellcolor{gray} & & \verb~482~ & & \verb~ }~\\ +\cellcolor{gray} & & \verb~483~ & & \verb~}~\\ +\end{longtable} +\newpage +\section{EntityFramework.Auditing.Test.Context} +\subsection{Summary} +\begin{longtable}[l]{ll} +\textbf{Class:} & EntityFramework.Auditing.Test.Context\\ +\textbf{Assembly:} & entityframework.auditing.test.dll\\ +\textbf{File(s):} & \begin{minipage}[t]{12cm}{C:\textbackslash Development\textbackslash EntityFrameworkRepository6\textbackslash AuditDbContextTests\textbackslash Context.cs}\end{minipage} \\ +\textbf{Covered lines:} & 6\\ +\textbf{Uncovered lines:} & 0\\ +\textbf{Coverable lines:} & 6\\ +\textbf{Total lines:} & 33\\ +\textbf{Line coverage:} & 100\%\\ +\end{longtable} +\subsection{Metrics} +\begin{longtable}[l]{|l|l|l|} +\hline +\textbf{Method} & \textbf{Blocks covered} & \textbf{Blocks not covered}\\ +\hline +\textbf{Context(bool, string} & 4 & 0\\ +\hline +\end{longtable} +\subsection{File(s)} +\subsubsection{C:\textbackslash Development\textbackslash EntityFrameworkRepository6\textbackslash AuditDbContextTests\textbackslash Context.cs} +\begin{longtable}[l]{lrrll} +\textbf{} & \textbf{\#} & \textbf{Line} & \textbf{} & \textbf{Line coverage}\\ +\cellcolor{gray} & & \verb~1~ & & \verb~//-----------------------------------------------------------------------~\\ +\cellcolor{gray} & & \verb~2~ & & \verb~// ~\\ +\cellcolor{gray} & & \verb~3~ & & \verb~// Copyright (c) Russell Wilkins. All rights reserved.~\\ +\cellcolor{gray} & & \verb~4~ & & \verb~// ~\\ +\cellcolor{gray} & & \verb~5~ & & \verb~//-----------------------------------------------------------------------~\\ +\cellcolor{gray} & & \verb~6~ & & \verb~namespace EntityFramework.Auditing.Test~\\ +\cellcolor{gray} & & \verb~7~ & & \verb~{~\\ +\cellcolor{gray} & & \verb~8~ & & \verb~ using System;~\\ +\cellcolor{gray} & & \verb~9~ & & \verb~ using System.Collections.Generic;~\\ +\cellcolor{gray} & & \verb~10~ & & \verb~ using System.Linq;~\\ +\cellcolor{gray} & & \verb~11~ & & \verb~ using System.Text;~\\ +\cellcolor{gray} & & \verb~12~ & & \verb~ using System.Data.Entity;~\\ +\cellcolor{gray} & & \verb~13~ & & \verb~~\\ +\cellcolor{gray} & & \verb~14~ & & \verb~ /// ~\\ +\cellcolor{gray} & & \verb~15~ & & \verb~ /// TODO: Describe the class~\\ +\cellcolor{gray} & & \verb~16~ & & \verb~ /// ~\\ +\cellcolor{gray} & & \verb~17~ & & \verb~ public class Context : AuditDbContext~\\ +\cellcolor{gray} & & \verb~18~ & & \verb~ {~\\ +\cellcolor{green} & 1 & \verb~19~ & & \verb~ public IDbSet Customers { get; set; }~\\ +\cellcolor{green} & 1 & \verb~20~ & & \verb~ public IDbSet CustomerAudits { get; set; }~\\ +\cellcolor{gray} & & \verb~21~ & & \verb~~\\ +\cellcolor{gray} & & \verb~22~ & & \verb~ #region Constructors~\\ +\cellcolor{gray} & & \verb~23~ & & \verb~ /// ~\\ +\cellcolor{gray} & & \verb~24~ & & \verb~ /// Initializes a new instance of the CodeFirstDbContext class.~\\ +\cellcolor{gray} & & \verb~25~ & & \verb~ /// ~\\ +\cellcolor{gray} & & \verb~26~ & & \verb~ public Context(bool proxies, string conn)~\\ +\cellcolor{green} & 1 & \verb~27~ & & \verb~ : base(conn)~\\ +\cellcolor{green} & 1 & \verb~28~ & & \verb~ {~\\ +\cellcolor{green} & 1 & \verb~29~ & & \verb~ this.Configuration.ProxyCreationEnabled = proxies;~\\ +\cellcolor{green} & 1 & \verb~30~ & & \verb~ }~\\ +\cellcolor{gray} & & \verb~31~ & & \verb~ #endregion~\\ +\cellcolor{gray} & & \verb~32~ & & \verb~ }~\\ +\cellcolor{gray} & & \verb~33~ & & \verb~}~\\ +\end{longtable} +\newpage +\section{EntityFramework.Auditing.Test.Customer} +\subsection{Summary} +\begin{longtable}[l]{ll} +\textbf{Class:} & EntityFramework.Auditing.Test.Customer\\ +\textbf{Assembly:} & entityframework.auditing.test.dll\\ +\textbf{File(s):} & \begin{minipage}[t]{12cm}{C:\textbackslash Development\textbackslash EntityFrameworkRepository6\textbackslash AuditDbContextTests\textbackslash Customer.cs}\end{minipage} \\ +\textbf{Covered lines:} & 3\\ +\textbf{Uncovered lines:} & 0\\ +\textbf{Coverable lines:} & 3\\ +\textbf{Total lines:} & 27\\ +\textbf{Line coverage:} & 100\%\\ +\end{longtable} +\subsection{File(s)} +\subsubsection{C:\textbackslash Development\textbackslash EntityFrameworkRepository6\textbackslash AuditDbContextTests\textbackslash Customer.cs} +\begin{longtable}[l]{lrrll} +\textbf{} & \textbf{\#} & \textbf{Line} & \textbf{} & \textbf{Line coverage}\\ +\cellcolor{gray} & & \verb~1~ & & \verb~//-----------------------------------------------------------------------~\\ +\cellcolor{gray} & & \verb~2~ & & \verb~// ~\\ +\cellcolor{gray} & & \verb~3~ & & \verb~// Copyright (c) Russell Wilkins. All rights reserved.~\\ +\cellcolor{gray} & & \verb~4~ & & \verb~// ~\\ +\cellcolor{gray} & & \verb~5~ & & \verb~//-----------------------------------------------------------------------~\\ +\cellcolor{gray} & & \verb~6~ & & \verb~namespace EntityFramework.Auditing.Test~\\ +\cellcolor{gray} & & \verb~7~ & & \verb~{~\\ +\cellcolor{gray} & & \verb~8~ & & \verb~ using System;~\\ +\cellcolor{gray} & & \verb~9~ & & \verb~ using System.Collections.Generic;~\\ +\cellcolor{gray} & & \verb~10~ & & \verb~ using System.Linq;~\\ +\cellcolor{gray} & & \verb~11~ & & \verb~ using System.Text;~\\ +\cellcolor{gray} & & \verb~12~ & & \verb~ using System.ComponentModel.DataAnnotations;~\\ +\cellcolor{gray} & & \verb~13~ & & \verb~~\\ +\cellcolor{gray} & & \verb~14~ & & \verb~ /// ~\\ +\cellcolor{gray} & & \verb~15~ & & \verb~ /// TODO: Describe the class~\\ +\cellcolor{gray} & & \verb~16~ & & \verb~ /// ~\\ +\cellcolor{gray} & & \verb~17~ & & \verb~ public class Customer : AuditableEntity~\\ +\cellcolor{gray} & & \verb~18~ & & \verb~ {~\\ +\cellcolor{gray} & & \verb~19~ & & \verb~ //public virtual int CustomerId { get; protected set; }~\\ +\cellcolor{gray} & & \verb~20~ & & \verb~~\\ +\cellcolor{green} & 1 & \verb~21~ & & \verb~ public virtual int Id { get; set; }~\\ +\cellcolor{green} & 1 & \verb~22~ & & \verb~ public virtual string CustomerName { get; set; }~\\ +\cellcolor{gray} & & \verb~23~ & & \verb~~\\ +\cellcolor{gray} & & \verb~24~ & & \verb~ [Timestamp]~\\ +\cellcolor{green} & 1 & \verb~25~ & & \verb~ public virtual byte[] RowVersion { get; set; }~\\ +\cellcolor{gray} & & \verb~26~ & & \verb~ }~\\ +\cellcolor{gray} & & \verb~27~ & & \verb~}~\\ +\end{longtable} +\newpage +\section{EntityFramework.Auditing.Test.CustomerAudit} +\subsection{Summary} +\begin{longtable}[l]{ll} +\textbf{Class:} & EntityFramework.Auditing.Test.CustomerAudit\\ +\textbf{Assembly:} & entityframework.auditing.test.dll\\ +\textbf{File(s):} & \begin{minipage}[t]{12cm}{C:\textbackslash Development\textbackslash EntityFrameworkRepository6\textbackslash AuditDbContextTests\textbackslash CustomerAudit.cs}\end{minipage} \\ +\textbf{Covered lines:} & 2\\ +\textbf{Uncovered lines:} & 0\\ +\textbf{Coverable lines:} & 2\\ +\textbf{Total lines:} & 25\\ +\textbf{Line coverage:} & 100\%\\ +\end{longtable} +\subsection{File(s)} +\subsubsection{C:\textbackslash Development\textbackslash EntityFrameworkRepository6\textbackslash AuditDbContextTests\textbackslash CustomerAudit.cs} +\begin{longtable}[l]{lrrll} +\textbf{} & \textbf{\#} & \textbf{Line} & \textbf{} & \textbf{Line coverage}\\ +\cellcolor{gray} & & \verb~1~ & & \verb~//-----------------------------------------------------------------------~\\ +\cellcolor{gray} & & \verb~2~ & & \verb~// ~\\ +\cellcolor{gray} & & \verb~3~ & & \verb~// Copyright (c) Russell Wilkins. All rights reserved.~\\ +\cellcolor{gray} & & \verb~4~ & & \verb~// ~\\ +\cellcolor{gray} & & \verb~5~ & & \verb~//-----------------------------------------------------------------------~\\ +\cellcolor{gray} & & \verb~6~ & & \verb~namespace EntityFramework.Auditing.Test~\\ +\cellcolor{gray} & & \verb~7~ & & \verb~{~\\ +\cellcolor{gray} & & \verb~8~ & & \verb~ using System;~\\ +\cellcolor{gray} & & \verb~9~ & & \verb~ using System.Collections.Generic;~\\ +\cellcolor{gray} & & \verb~10~ & & \verb~ using System.Linq;~\\ +\cellcolor{gray} & & \verb~11~ & & \verb~ using System.Text;~\\ +\cellcolor{gray} & & \verb~12~ & & \verb~~\\ +\cellcolor{gray} & & \verb~13~ & & \verb~ /// ~\\ +\cellcolor{gray} & & \verb~14~ & & \verb~ /// TODO: Describe the class~\\ +\cellcolor{gray} & & \verb~15~ & & \verb~ /// ~\\ +\cellcolor{gray} & & \verb~16~ & & \verb~ public class CustomerAudit : AuditEntity~\\ +\cellcolor{gray} & & \verb~17~ & & \verb~ {~\\ +\cellcolor{gray} & & \verb~18~ & & \verb~~\\ +\cellcolor{green} & 1 & \verb~19~ & & \verb~ public virtual int Id { get; set; }~\\ +\cellcolor{gray} & & \verb~20~ & & \verb~ //public virtual int CustomerAuditId { get; protected set; }~\\ +\cellcolor{gray} & & \verb~21~ & & \verb~~\\ +\cellcolor{gray} & & \verb~22~ & & \verb~ //public virtual int CustomerId { get; private set; }~\\ +\cellcolor{green} & 1 & \verb~23~ & & \verb~ public virtual string CustomerName { get; set; }~\\ +\cellcolor{gray} & & \verb~24~ & & \verb~ }~\\ +\cellcolor{gray} & & \verb~25~ & & \verb~}~\\ +\end{longtable} +\newpage +\section{EntityFramework.Repository6.BaseContext} +\subsection{Summary} +\begin{longtable}[l]{ll} +\textbf{Class:} & EntityFramework.Repository6.BaseContext\\ +\textbf{Assembly:} & entityframework.repository6.dll\\ +\textbf{File(s):} & \begin{minipage}[t]{12cm}{velopment\textbackslash EntityFrameworkRepository6\textbackslash EntityFrameworkRepository6\textbackslash BaseContext.cs}\end{minipage} \\ +\textbf{Covered lines:} & 2\\ +\textbf{Uncovered lines:} & 5\\ +\textbf{Coverable lines:} & 7\\ +\textbf{Total lines:} & 23\\ +\textbf{Line coverage:} & 28.5\%\\ +\end{longtable} +\subsection{Metrics} +\begin{longtable}[l]{|l|l|l|} +\hline +\textbf{Method} & \textbf{Blocks covered} & \textbf{Blocks not covered}\\ +\hline +\textbf{BaseContext()} & 1 & 0\\ +\hline +\textbf{BaseContext(System.D} & 3 & 0\\ +\hline +\textbf{BaseContext(System.D} & 0 & 3\\ +\hline +\textbf{BaseContext(string)} & 0 & 3\\ +\hline +\textbf{BaseContext(string, } & 0 & 3\\ +\hline +\textbf{BaseContext(System.D} & 0 & 3\\ +\hline +\textbf{BaseContext(System.D} & 0 & 3\\ +\hline +\end{longtable} +\subsection{File(s)} +\subsubsection{velopment\textbackslash EntityFrameworkRepository6\textbackslash EntityFrameworkRepository6\textbackslash BaseContext.cs} +\begin{longtable}[l]{lrrll} +\textbf{} & \textbf{\#} & \textbf{Line} & \textbf{} & \textbf{Line coverage}\\ +\cellcolor{gray} & & \verb~1~ & & \verb~using System.Data.Common;~\\ +\cellcolor{gray} & & \verb~2~ & & \verb~using System.Data.Entity;~\\ +\cellcolor{gray} & & \verb~3~ & & \verb~~\\ +\cellcolor{gray} & & \verb~4~ & & \verb~namespace EntityFramework.Repository6~\\ +\cellcolor{gray} & & \verb~5~ & & \verb~{~\\ +\cellcolor{gray} & & \verb~6~ & & \verb~ public class BaseContext : DbContext~\\ +\cellcolor{gray} & & \verb~7~ & & \verb~ where TContext : DbContext~\\ +\cellcolor{gray} & & \verb~8~ & & \verb~ {~\\ +\cellcolor{green} & 1 & \verb~9~ & & \verb~ static BaseContext() { }~\\ +\cellcolor{gray} & & \verb~10~ & & \verb~~\\ +\cellcolor{green} & 1 & \verb~11~ & & \verb~ protected BaseContext(DbConnection dbConnection) : base(dbConnection, ~\\ +\cellcolor{gray} & & \verb~12~ & & \verb~~\\ +\cellcolor{red} & 0 & \verb~13~ & & \verb~ protected BaseContext(DbConnection dbConnection, bool contextOwnsConne~\\ +\cellcolor{gray} & & \verb~14~ & & \verb~~\\ +\cellcolor{red} & 0 & \verb~15~ & & \verb~ protected BaseContext(string connectionString) : base(connectionString~\\ +\cellcolor{gray} & & \verb~16~ & & \verb~~\\ +\cellcolor{red} & 0 & \verb~17~ & & \verb~ protected BaseContext(string connectionString, IDatabaseInitializer :~\\ +\cellcolor{gray} & & \verb~12~ & & \verb~ IBaseRepository~\\ +\cellcolor{gray} & & \verb~13~ & & \verb~ , IDisposable~\\ +\cellcolor{gray} & & \verb~14~ & & \verb~ where T : class~\\ +\cellcolor{gray} & & \verb~15~ & & \verb~ where C : DbContext~\\ +\cellcolor{gray} & & \verb~16~ & & \verb~ {~\\ +\cellcolor{gray} & & \verb~17~ & & \verb~ protected C Context { get; set; }~\\ +\cellcolor{gray} & & \verb~18~ & & \verb~ protected Lazy> IgnoreFieldsOnUpdate = new Lazy>>> IgnoreFieldsOnUpdate2 ~\\ +\cellcolor{gray} & & \verb~20~ & & \verb~~\\ +\cellcolor{gray} & & \verb~21~ & & \verb~ protected BaseRepository(C context)~\\ +\cellcolor{gray} & & \verb~22~ & & \verb~ {~\\ +\cellcolor{gray} & & \verb~23~ & & \verb~ Context = context;~\\ +\cellcolor{gray} & & \verb~24~ & & \verb~ }~\\ +\cellcolor{gray} & & \verb~25~ & & \verb~~\\ +\cellcolor{gray} & & \verb~26~ & & \verb~ public virtual void AddUpdateIgnoreField(string fieldName)~\\ +\cellcolor{gray} & & \verb~27~ & & \verb~ {~\\ +\cellcolor{gray} & & \verb~28~ & & \verb~ IgnoreFieldsOnUpdate.Value.Add(fieldName);~\\ +\cellcolor{gray} & & \verb~29~ & & \verb~ }~\\ +\cellcolor{gray} & & \verb~30~ & & \verb~~\\ +\cellcolor{gray} & & \verb~31~ & & \verb~ public virtual void AddUpdateIgnoreField(Expression> fie~\\ +\cellcolor{gray} & & \verb~32~ & & \verb~ {~\\ +\cellcolor{gray} & & \verb~33~ & & \verb~ IgnoreFieldsOnUpdate2.Value.Add(fieldName);~\\ +\cellcolor{gray} & & \verb~34~ & & \verb~ }~\\ +\cellcolor{gray} & & \verb~35~ & & \verb~~\\ +\cellcolor{gray} & & \verb~36~ & & \verb~ public virtual T Find(int id)~\\ +\cellcolor{gray} & & \verb~37~ & & \verb~ {~\\ +\cellcolor{gray} & & \verb~38~ & & \verb~ T entity = Context.Set().Find(id);~\\ +\cellcolor{gray} & & \verb~39~ & & \verb~~\\ +\cellcolor{gray} & & \verb~40~ & & \verb~ return entity;~\\ +\cellcolor{gray} & & \verb~41~ & & \verb~ }~\\ +\cellcolor{gray} & & \verb~42~ & & \verb~~\\ +\cellcolor{gray} & & \verb~43~ & & \verb~ public virtual T Find(params object[] ids)~\\ +\cellcolor{gray} & & \verb~44~ & & \verb~ {~\\ +\cellcolor{gray} & & \verb~45~ & & \verb~ T entity = Context.Set().Find(ids);~\\ +\cellcolor{gray} & & \verb~46~ & & \verb~~\\ +\cellcolor{gray} & & \verb~47~ & & \verb~ return entity;~\\ +\cellcolor{gray} & & \verb~48~ & & \verb~ }~\\ +\cellcolor{gray} & & \verb~49~ & & \verb~~\\ +\cellcolor{gray} & & \verb~50~ & & \verb~ public virtual async Task FindAsync(int id)~\\ +\cellcolor{green} & 1 & \verb~51~ & & \verb~ {~\\ +\cellcolor{green} & 1 & \verb~52~ & & \verb~ var query = Context.Set().FindAsync(id);~\\ +\cellcolor{green} & 1 & \verb~53~ & & \verb~ return await query;~\\ +\cellcolor{green} & 1 & \verb~54~ & & \verb~ }~\\ +\cellcolor{gray} & & \verb~55~ & & \verb~~\\ +\cellcolor{gray} & & \verb~56~ & & \verb~ public virtual async Task FindAsync(params object[] ids)~\\ +\cellcolor{green} & 1 & \verb~57~ & & \verb~ {~\\ +\cellcolor{green} & 1 & \verb~58~ & & \verb~ var query = Context.Set().FindAsync(ids);~\\ +\cellcolor{green} & 1 & \verb~59~ & & \verb~ return await query;~\\ +\cellcolor{green} & 1 & \verb~60~ & & \verb~ }~\\ +\cellcolor{gray} & & \verb~61~ & & \verb~~\\ +\cellcolor{gray} & & \verb~62~ & & \verb~ public virtual IQueryable FindBy(Expression> predicat~\\ +\cellcolor{gray} & & \verb~63~ & & \verb~ {~\\ +\cellcolor{gray} & & \verb~64~ & & \verb~ IQueryable query = Context.Set().Where(predicate);~\\ +\cellcolor{gray} & & \verb~65~ & & \verb~ return query;~\\ +\cellcolor{gray} & & \verb~66~ & & \verb~ }~\\ +\cellcolor{gray} & & \verb~67~ & & \verb~~\\ +\cellcolor{gray} & & \verb~68~ & & \verb~ public virtual bool Exists(Expression> predicate)~\\ +\cellcolor{gray} & & \verb~69~ & & \verb~ {~\\ +\cellcolor{gray} & & \verb~70~ & & \verb~ return Context.Set().AsNoTracking().Any(predicate);~\\ +\cellcolor{gray} & & \verb~71~ & & \verb~ }~\\ +\cellcolor{gray} & & \verb~72~ & & \verb~~\\ +\cellcolor{gray} & & \verb~73~ & & \verb~ public virtual void Delete(T entity)~\\ +\cellcolor{gray} & & \verb~74~ & & \verb~ {~\\ +\cellcolor{gray} & & \verb~75~ & & \verb~ Context.Set().Remove(entity);~\\ +\cellcolor{gray} & & \verb~76~ & & \verb~ }~\\ +\cellcolor{gray} & & \verb~77~ & & \verb~~\\ +\cellcolor{gray} & & \verb~78~ & & \verb~ public virtual void Delete(IEnumerable entities)~\\ +\cellcolor{gray} & & \verb~79~ & & \verb~ {~\\ +\cellcolor{gray} & & \verb~80~ & & \verb~ foreach (T entity in entities)~\\ +\cellcolor{gray} & & \verb~81~ & & \verb~ {~\\ +\cellcolor{gray} & & \verb~82~ & & \verb~ Delete(entity);~\\ +\cellcolor{gray} & & \verb~83~ & & \verb~ }~\\ +\cellcolor{gray} & & \verb~84~ & & \verb~ }~\\ +\cellcolor{gray} & & \verb~85~ & & \verb~~\\ +\cellcolor{gray} & & \verb~86~ & & \verb~ public virtual void Reload(T entity)~\\ +\cellcolor{gray} & & \verb~87~ & & \verb~ {~\\ +\cellcolor{gray} & & \verb~88~ & & \verb~ Context.Entry(entity).Reload();~\\ +\cellcolor{gray} & & \verb~89~ & & \verb~ }~\\ +\cellcolor{gray} & & \verb~90~ & & \verb~~\\ +\cellcolor{gray} & & \verb~91~ & & \verb~ public async virtual Task ReloadAsync(T entity)~\\ +\cellcolor{green} & 1 & \verb~92~ & & \verb~ {~\\ +\cellcolor{green} & 1 & \verb~93~ & & \verb~ await Context.Entry(entity).ReloadAsync();~\\ +\cellcolor{green} & 1 & \verb~94~ & & \verb~ }~\\ +\cellcolor{gray} & & \verb~95~ & & \verb~~\\ +\cellcolor{gray} & & \verb~96~ & & \verb~ public virtual IQueryable FindByReadOnly(Expression> ~\\ +\cellcolor{gray} & & \verb~97~ & & \verb~ {~\\ +\cellcolor{gray} & & \verb~98~ & & \verb~ IQueryable query = Context.Set().AsNoTracking().Where(predic~\\ +\cellcolor{gray} & & \verb~99~ & & \verb~ return query;~\\ +\cellcolor{gray} & & \verb~100~ & & \verb~ }~\\ +\cellcolor{gray} & & \verb~101~ & & \verb~~\\ +\cellcolor{gray} & & \verb~102~ & & \verb~ public virtual IQueryable GetAll()~\\ +\cellcolor{gray} & & \verb~103~ & & \verb~ {~\\ +\cellcolor{gray} & & \verb~104~ & & \verb~ IQueryable query = Context.Set().AsNoTracking();~\\ +\cellcolor{gray} & & \verb~105~ & & \verb~~\\ +\cellcolor{gray} & & \verb~106~ & & \verb~ return query;~\\ +\cellcolor{gray} & & \verb~107~ & & \verb~ }~\\ +\cellcolor{gray} & & \verb~108~ & & \verb~~\\ +\cellcolor{gray} & & \verb~109~ & & \verb~ public virtual T Add(T entity)~\\ +\cellcolor{gray} & & \verb~110~ & & \verb~ {~\\ +\cellcolor{gray} & & \verb~111~ & & \verb~ Context.Set().Add(entity);~\\ +\cellcolor{gray} & & \verb~112~ & & \verb~~\\ +\cellcolor{gray} & & \verb~113~ & & \verb~ return entity;~\\ +\cellcolor{gray} & & \verb~114~ & & \verb~ }~\\ +\cellcolor{gray} & & \verb~115~ & & \verb~~\\ +\cellcolor{gray} & & \verb~116~ & & \verb~ public virtual IEnumerable Add(IEnumerable entities)~\\ +\cellcolor{gray} & & \verb~117~ & & \verb~ {~\\ +\cellcolor{gray} & & \verb~118~ & & \verb~ Context.Set().AddRange(entities);~\\ +\cellcolor{gray} & & \verb~119~ & & \verb~~\\ +\cellcolor{gray} & & \verb~120~ & & \verb~ return entities;~\\ +\cellcolor{gray} & & \verb~121~ & & \verb~ }~\\ +\cellcolor{gray} & & \verb~122~ & & \verb~~\\ +\cellcolor{gray} & & \verb~123~ & & \verb~ public virtual void Update(T entity, int id)~\\ +\cellcolor{gray} & & \verb~124~ & & \verb~ {~\\ +\cellcolor{gray} & & \verb~125~ & & \verb~ var entityToUpdate = Context.Set().Find(id);~\\ +\cellcolor{gray} & & \verb~126~ & & \verb~~\\ +\cellcolor{gray} & & \verb~127~ & & \verb~ if (entityToUpdate == null) throw CreateEntityNotFoundException> predica~\\ +\cellcolor{gray} & & \verb~135~ & & \verb~ {~\\ +\cellcolor{gray} & & \verb~136~ & & \verb~ var entityToUpdate = Context.Set().Where(predicate).SingleOrDef~\\ +\cellcolor{gray} & & \verb~137~ & & \verb~~\\ +\cellcolor{gray} & & \verb~138~ & & \verb~ if (entityToUpdate == null) throw CreateEntityNotFoundException delta, params object[] ids)~\\ +\cellcolor{gray} & & \verb~146~ & & \verb~ {~\\ +\cellcolor{gray} & & \verb~147~ & & \verb~ var entityToUpdate = Context.Set().Find(ids);~\\ +\cellcolor{gray} & & \verb~148~ & & \verb~~\\ +\cellcolor{gray} & & \verb~149~ & & \verb~ if (entityToUpdate == null) throw CreateEntityNotFoundException delta, Expression> predicate~\\ +\cellcolor{gray} & & \verb~163~ & & \verb~ {~\\ +\cellcolor{gray} & & \verb~164~ & & \verb~ var entityToUpdate = Context.Set().Where(predicate).SingleOrDef~\\ +\cellcolor{gray} & & \verb~165~ & & \verb~~\\ +\cellcolor{gray} & & \verb~166~ & & \verb~ if (entityToUpdate == null) throw CreateEntityNotFoundException(string entityId, ~\\ +\cellcolor{gray} & & \verb~180~ & & \verb~ {~\\ +\cellcolor{gray} & & \verb~181~ & & \verb~ return (E)Activator.CreateInstance(typeof(E), string.Format("{0} i~\\ +\cellcolor{gray} & & \verb~182~ & & \verb~ }~\\ +\cellcolor{gray} & & \verb~183~ & & \verb~~\\ +\cellcolor{gray} & & \verb~184~ & & \verb~ protected virtual void MarkIgnoreFields(T entityToUpdate)~\\ +\cellcolor{gray} & & \verb~185~ & & \verb~ {~\\ +\cellcolor{gray} & & \verb~186~ & & \verb~ if(IgnoreFieldsOnUpdate.IsValueCreated)~\\ +\cellcolor{green} & 1 & \verb~187~ & & \verb~ { IgnoreFieldsOnUpdate.Value.ForEach(ignoreField => Context.Entry(~\\ +\cellcolor{gray} & & \verb~188~ & & \verb~~\\ +\cellcolor{gray} & & \verb~189~ & & \verb~~\\ +\cellcolor{gray} & & \verb~190~ & & \verb~ if(IgnoreFieldsOnUpdate2.IsValueCreated)~\\ +\cellcolor{red} & 0 & \verb~191~ & & \verb~ { IgnoreFieldsOnUpdate2.Value.ForEach(ignoreField => Context.Entry~\\ +\cellcolor{gray} & & \verb~192~ & & \verb~ }~\\ +\cellcolor{gray} & & \verb~193~ & & \verb~~\\ +\cellcolor{gray} & & \verb~194~ & & \verb~ public async virtual Task SaveAsync()~\\ +\cellcolor{red} & 0 & \verb~195~ & & \verb~ {~\\ +\cellcolor{red} & 0 & \verb~196~ & & \verb~ return await Context.SaveChangesAsync();~\\ +\cellcolor{red} & 0 & \verb~197~ & & \verb~ }~\\ +\cellcolor{gray} & & \verb~198~ & & \verb~~\\ +\cellcolor{gray} & & \verb~199~ & & \verb~ public virtual int Save()~\\ +\cellcolor{gray} & & \verb~200~ & & \verb~ {~\\ +\cellcolor{gray} & & \verb~201~ & & \verb~ return Context.SaveChanges();~\\ +\cellcolor{gray} & & \verb~202~ & & \verb~ }~\\ +\cellcolor{gray} & & \verb~203~ & & \verb~~\\ +\cellcolor{gray} & & \verb~204~ & & \verb~ public virtual int Count()~\\ +\cellcolor{gray} & & \verb~205~ & & \verb~ {~\\ +\cellcolor{gray} & & \verb~206~ & & \verb~ return Context.Set().Count();~\\ +\cellcolor{gray} & & \verb~207~ & & \verb~ }~\\ +\cellcolor{gray} & & \verb~208~ & & \verb~~\\ +\cellcolor{gray} & & \verb~209~ & & \verb~ public async virtual Task CountAsync()~\\ +\cellcolor{red} & 0 & \verb~210~ & & \verb~ {~\\ +\cellcolor{red} & 0 & \verb~211~ & & \verb~ return await Context.Set().CountAsync();~\\ +\cellcolor{red} & 0 & \verb~212~ & & \verb~ }~\\ +\cellcolor{gray} & & \verb~213~ & & \verb~~\\ +\cellcolor{gray} & & \verb~214~ & & \verb~ #region IDisposable Support~\\ +\cellcolor{gray} & & \verb~215~ & & \verb~ private bool disposedValue = false; // To detect redundant calls~\\ +\cellcolor{gray} & & \verb~216~ & & \verb~~\\ +\cellcolor{gray} & & \verb~217~ & & \verb~ protected virtual void Dispose(bool disposing)~\\ +\cellcolor{gray} & & \verb~218~ & & \verb~ {~\\ +\cellcolor{gray} & & \verb~219~ & & \verb~ if (!disposedValue)~\\ +\cellcolor{gray} & & \verb~220~ & & \verb~ {~\\ +\cellcolor{gray} & & \verb~221~ & & \verb~ if (disposing)~\\ +\cellcolor{gray} & & \verb~222~ & & \verb~ {~\\ +\cellcolor{gray} & & \verb~223~ & & \verb~ if (Context != null)~\\ +\cellcolor{gray} & & \verb~224~ & & \verb~ {~\\ +\cellcolor{gray} & & \verb~225~ & & \verb~ Context.Dispose();~\\ +\cellcolor{gray} & & \verb~226~ & & \verb~ Context = null;~\\ +\cellcolor{gray} & & \verb~227~ & & \verb~ }~\\ +\cellcolor{gray} & & \verb~228~ & & \verb~ }~\\ +\cellcolor{gray} & & \verb~229~ & & \verb~~\\ +\cellcolor{gray} & & \verb~230~ & & \verb~ disposedValue = true;~\\ +\cellcolor{gray} & & \verb~231~ & & \verb~ }~\\ +\cellcolor{gray} & & \verb~232~ & & \verb~ }~\\ +\cellcolor{gray} & & \verb~233~ & & \verb~~\\ +\cellcolor{gray} & & \verb~234~ & & \verb~ public void Dispose()~\\ +\cellcolor{gray} & & \verb~235~ & & \verb~ {~\\ +\cellcolor{gray} & & \verb~236~ & & \verb~ Dispose(true);~\\ +\cellcolor{gray} & & \verb~237~ & & \verb~ }~\\ +\cellcolor{gray} & & \verb~238~ & & \verb~ #endregion~\\ +\cellcolor{gray} & & \verb~239~ & & \verb~~\\ +\cellcolor{gray} & & \verb~240~ & & \verb~ }~\\ +\cellcolor{gray} & & \verb~241~ & & \verb~}~\\ +\end{longtable} +\newpage +\section{EntityFramework.Repository6.BaseRepository} +\subsection{Summary} +\begin{longtable}[l]{ll} +\textbf{Class:} & EntityFramework.Repository6.BaseRepository\\ +\textbf{Assembly:} & entityframework.repository6.dll\\ +\textbf{File(s):} & \begin{minipage}[t]{12cm}{opment\textbackslash EntityFrameworkRepository6\textbackslash EntityFrameworkRepository6\textbackslash BaseRepository.cs}\end{minipage} \\ +\textbf{Covered lines:} & 119\\ +\textbf{Uncovered lines:} & 4\\ +\textbf{Coverable lines:} & 123\\ +\textbf{Total lines:} & 241\\ +\textbf{Line coverage:} & 96.7\%\\ +\end{longtable} +\subsection{Metrics} +\begin{longtable}[l]{|l|l|l|} +\hline +\textbf{Method} & \textbf{Blocks covered} & \textbf{Blocks not covered}\\ +\hline +\textbf{BaseRepository(C)} & 5 & 0\\ +\hline +\textbf{AddUpdateIgnoreField} & 3 & 0\\ +\hline +\textbf{AddUpdateIgnoreField} & 0 & 3\\ +\hline +\textbf{Find(int)} & 5 & 0\\ +\hline +\textbf{Find(object[])} & 5 & 0\\ +\hline +\textbf{FindBy(System.Linq.E} & 5 & 0\\ +\hline +\textbf{Exists(System.Linq.E} & 6 & 0\\ +\hline +\textbf{Delete(T)} & 4 & 0\\ +\hline +\textbf{Delete(System.Collec} & 9 & 0\\ +\hline +\textbf{Reload(T)} & 4 & 0\\ +\hline +\textbf{FindByReadOnly(Syste} & 6 & 0\\ +\hline +\textbf{GetAll()} & 5 & 0\\ +\hline +\textbf{Add(T)} & 5 & 0\\ +\hline +\textbf{Add(System.Collectio} & 5 & 0\\ +\hline +\textbf{Update(T, int)} & 10 & 5\\ +\hline +\textbf{Update(T, System.Lin} & 16 & 0\\ +\hline +\textbf{Update(EntityFramewo} & 22 & 5\\ +\hline +\textbf{Update(EntityFramewo} & 23 & 5\\ +\hline +\textbf{CreateEntityNotFound} & 5 & 0\\ +\hline +\textbf{MarkIgnoreFields(T)} & 9 & 4\\ +\hline +\textbf{Save()} & 4 & 0\\ +\hline +\textbf{Count()} & 5 & 0\\ +\hline +\textbf{Dispose(bool)} & 11 & 0\\ +\hline +\textbf{Dispose()} & 2 & 0\\ +\hline +\end{longtable} +\subsection{File(s)} +\subsubsection{opment\textbackslash EntityFrameworkRepository6\textbackslash EntityFrameworkRepository6\textbackslash BaseRepository.cs} +\begin{longtable}[l]{lrrll} +\textbf{} & \textbf{\#} & \textbf{Line} & \textbf{} & \textbf{Line coverage}\\ +\cellcolor{gray} & & \verb~1~ & & \verb~using EntityFramework.Repository6.Interfaces;~\\ +\cellcolor{gray} & & \verb~2~ & & \verb~using System;~\\ +\cellcolor{gray} & & \verb~3~ & & \verb~using System.Collections.Generic;~\\ +\cellcolor{gray} & & \verb~4~ & & \verb~using System.Data.Entity;~\\ +\cellcolor{gray} & & \verb~5~ & & \verb~using System.Linq;~\\ +\cellcolor{gray} & & \verb~6~ & & \verb~using System.Linq.Expressions;~\\ +\cellcolor{gray} & & \verb~7~ & & \verb~using System.Threading.Tasks;~\\ +\cellcolor{gray} & & \verb~8~ & & \verb~~\\ +\cellcolor{gray} & & \verb~9~ & & \verb~namespace EntityFramework.Repository6~\\ +\cellcolor{gray} & & \verb~10~ & & \verb~{~\\ +\cellcolor{gray} & & \verb~11~ & & \verb~ public abstract class BaseRepository :~\\ +\cellcolor{gray} & & \verb~12~ & & \verb~ IBaseRepository~\\ +\cellcolor{gray} & & \verb~13~ & & \verb~ , IDisposable~\\ +\cellcolor{gray} & & \verb~14~ & & \verb~ where T : class~\\ +\cellcolor{gray} & & \verb~15~ & & \verb~ where C : DbContext~\\ +\cellcolor{gray} & & \verb~16~ & & \verb~ {~\\ +\cellcolor{green} & 1 & \verb~17~ & & \verb~ protected C Context { get; set; }~\\ +\cellcolor{green} & 1 & \verb~18~ & & \verb~ protected Lazy> IgnoreFieldsOnUpdate = new Lazy>>> IgnoreFieldsOnUpdate2 ~\\ +\cellcolor{gray} & & \verb~20~ & & \verb~~\\ +\cellcolor{green} & 1 & \verb~21~ & & \verb~ protected BaseRepository(C context)~\\ +\cellcolor{green} & 1 & \verb~22~ & & \verb~ {~\\ +\cellcolor{green} & 1 & \verb~23~ & & \verb~ Context = context;~\\ +\cellcolor{green} & 1 & \verb~24~ & & \verb~ }~\\ +\cellcolor{gray} & & \verb~25~ & & \verb~~\\ +\cellcolor{gray} & & \verb~26~ & & \verb~ public virtual void AddUpdateIgnoreField(string fieldName)~\\ +\cellcolor{green} & 1 & \verb~27~ & & \verb~ {~\\ +\cellcolor{green} & 1 & \verb~28~ & & \verb~ IgnoreFieldsOnUpdate.Value.Add(fieldName);~\\ +\cellcolor{green} & 1 & \verb~29~ & & \verb~ }~\\ +\cellcolor{gray} & & \verb~30~ & & \verb~~\\ +\cellcolor{gray} & & \verb~31~ & & \verb~ public virtual void AddUpdateIgnoreField(Expression> fie~\\ +\cellcolor{red} & 0 & \verb~32~ & & \verb~ {~\\ +\cellcolor{red} & 0 & \verb~33~ & & \verb~ IgnoreFieldsOnUpdate2.Value.Add(fieldName);~\\ +\cellcolor{red} & 0 & \verb~34~ & & \verb~ }~\\ +\cellcolor{gray} & & \verb~35~ & & \verb~~\\ +\cellcolor{gray} & & \verb~36~ & & \verb~ public virtual T Find(int id)~\\ +\cellcolor{green} & 1 & \verb~37~ & & \verb~ {~\\ +\cellcolor{green} & 1 & \verb~38~ & & \verb~ T entity = Context.Set().Find(id);~\\ +\cellcolor{gray} & & \verb~39~ & & \verb~~\\ +\cellcolor{green} & 1 & \verb~40~ & & \verb~ return entity;~\\ +\cellcolor{green} & 1 & \verb~41~ & & \verb~ }~\\ +\cellcolor{gray} & & \verb~42~ & & \verb~~\\ +\cellcolor{gray} & & \verb~43~ & & \verb~ public virtual T Find(params object[] ids)~\\ +\cellcolor{green} & 1 & \verb~44~ & & \verb~ {~\\ +\cellcolor{green} & 1 & \verb~45~ & & \verb~ T entity = Context.Set().Find(ids);~\\ +\cellcolor{gray} & & \verb~46~ & & \verb~~\\ +\cellcolor{green} & 1 & \verb~47~ & & \verb~ return entity;~\\ +\cellcolor{green} & 1 & \verb~48~ & & \verb~ }~\\ +\cellcolor{gray} & & \verb~49~ & & \verb~~\\ +\cellcolor{gray} & & \verb~50~ & & \verb~ public virtual async Task FindAsync(int id)~\\ +\cellcolor{gray} & & \verb~51~ & & \verb~ {~\\ +\cellcolor{gray} & & \verb~52~ & & \verb~ var query = Context.Set().FindAsync(id);~\\ +\cellcolor{gray} & & \verb~53~ & & \verb~ return await query;~\\ +\cellcolor{gray} & & \verb~54~ & & \verb~ }~\\ +\cellcolor{gray} & & \verb~55~ & & \verb~~\\ +\cellcolor{gray} & & \verb~56~ & & \verb~ public virtual async Task FindAsync(params object[] ids)~\\ +\cellcolor{gray} & & \verb~57~ & & \verb~ {~\\ +\cellcolor{gray} & & \verb~58~ & & \verb~ var query = Context.Set().FindAsync(ids);~\\ +\cellcolor{gray} & & \verb~59~ & & \verb~ return await query;~\\ +\cellcolor{gray} & & \verb~60~ & & \verb~ }~\\ +\cellcolor{gray} & & \verb~61~ & & \verb~~\\ +\cellcolor{gray} & & \verb~62~ & & \verb~ public virtual IQueryable FindBy(Expression> predicat~\\ +\cellcolor{green} & 1 & \verb~63~ & & \verb~ {~\\ +\cellcolor{green} & 1 & \verb~64~ & & \verb~ IQueryable query = Context.Set().Where(predicate);~\\ +\cellcolor{green} & 1 & \verb~65~ & & \verb~ return query;~\\ +\cellcolor{green} & 1 & \verb~66~ & & \verb~ }~\\ +\cellcolor{gray} & & \verb~67~ & & \verb~~\\ +\cellcolor{gray} & & \verb~68~ & & \verb~ public virtual bool Exists(Expression> predicate)~\\ +\cellcolor{green} & 1 & \verb~69~ & & \verb~ {~\\ +\cellcolor{green} & 1 & \verb~70~ & & \verb~ return Context.Set().AsNoTracking().Any(predicate);~\\ +\cellcolor{green} & 1 & \verb~71~ & & \verb~ }~\\ +\cellcolor{gray} & & \verb~72~ & & \verb~~\\ +\cellcolor{gray} & & \verb~73~ & & \verb~ public virtual void Delete(T entity)~\\ +\cellcolor{green} & 1 & \verb~74~ & & \verb~ {~\\ +\cellcolor{green} & 1 & \verb~75~ & & \verb~ Context.Set().Remove(entity);~\\ +\cellcolor{green} & 1 & \verb~76~ & & \verb~ }~\\ +\cellcolor{gray} & & \verb~77~ & & \verb~~\\ +\cellcolor{gray} & & \verb~78~ & & \verb~ public virtual void Delete(IEnumerable entities)~\\ +\cellcolor{green} & 1 & \verb~79~ & & \verb~ {~\\ +\cellcolor{green} & 1 & \verb~80~ & & \verb~ foreach (T entity in entities)~\\ +\cellcolor{green} & 1 & \verb~81~ & & \verb~ {~\\ +\cellcolor{green} & 1 & \verb~82~ & & \verb~ Delete(entity);~\\ +\cellcolor{green} & 1 & \verb~83~ & & \verb~ }~\\ +\cellcolor{green} & 1 & \verb~84~ & & \verb~ }~\\ +\cellcolor{gray} & & \verb~85~ & & \verb~~\\ +\cellcolor{gray} & & \verb~86~ & & \verb~ public virtual void Reload(T entity)~\\ +\cellcolor{green} & 1 & \verb~87~ & & \verb~ {~\\ +\cellcolor{green} & 1 & \verb~88~ & & \verb~ Context.Entry(entity).Reload();~\\ +\cellcolor{green} & 1 & \verb~89~ & & \verb~ }~\\ +\cellcolor{gray} & & \verb~90~ & & \verb~~\\ +\cellcolor{gray} & & \verb~91~ & & \verb~ public async virtual Task ReloadAsync(T entity)~\\ +\cellcolor{gray} & & \verb~92~ & & \verb~ {~\\ +\cellcolor{gray} & & \verb~93~ & & \verb~ await Context.Entry(entity).ReloadAsync();~\\ +\cellcolor{gray} & & \verb~94~ & & \verb~ }~\\ +\cellcolor{gray} & & \verb~95~ & & \verb~~\\ +\cellcolor{gray} & & \verb~96~ & & \verb~ public virtual IQueryable FindByReadOnly(Expression> ~\\ +\cellcolor{green} & 1 & \verb~97~ & & \verb~ {~\\ +\cellcolor{green} & 1 & \verb~98~ & & \verb~ IQueryable query = Context.Set().AsNoTracking().Where(predic~\\ +\cellcolor{green} & 1 & \verb~99~ & & \verb~ return query;~\\ +\cellcolor{green} & 1 & \verb~100~ & & \verb~ }~\\ +\cellcolor{gray} & & \verb~101~ & & \verb~~\\ +\cellcolor{gray} & & \verb~102~ & & \verb~ public virtual IQueryable GetAll()~\\ +\cellcolor{green} & 1 & \verb~103~ & & \verb~ {~\\ +\cellcolor{green} & 1 & \verb~104~ & & \verb~ IQueryable query = Context.Set().AsNoTracking();~\\ +\cellcolor{gray} & & \verb~105~ & & \verb~~\\ +\cellcolor{green} & 1 & \verb~106~ & & \verb~ return query;~\\ +\cellcolor{green} & 1 & \verb~107~ & & \verb~ }~\\ +\cellcolor{gray} & & \verb~108~ & & \verb~~\\ +\cellcolor{gray} & & \verb~109~ & & \verb~ public virtual T Add(T entity)~\\ +\cellcolor{green} & 1 & \verb~110~ & & \verb~ {~\\ +\cellcolor{green} & 1 & \verb~111~ & & \verb~ Context.Set().Add(entity);~\\ +\cellcolor{gray} & & \verb~112~ & & \verb~~\\ +\cellcolor{green} & 1 & \verb~113~ & & \verb~ return entity;~\\ +\cellcolor{green} & 1 & \verb~114~ & & \verb~ }~\\ +\cellcolor{gray} & & \verb~115~ & & \verb~~\\ +\cellcolor{gray} & & \verb~116~ & & \verb~ public virtual IEnumerable Add(IEnumerable entities)~\\ +\cellcolor{green} & 1 & \verb~117~ & & \verb~ {~\\ +\cellcolor{green} & 1 & \verb~118~ & & \verb~ Context.Set().AddRange(entities);~\\ +\cellcolor{gray} & & \verb~119~ & & \verb~~\\ +\cellcolor{green} & 1 & \verb~120~ & & \verb~ return entities;~\\ +\cellcolor{green} & 1 & \verb~121~ & & \verb~ }~\\ +\cellcolor{gray} & & \verb~122~ & & \verb~~\\ +\cellcolor{gray} & & \verb~123~ & & \verb~ public virtual void Update(T entity, int id)~\\ +\cellcolor{green} & 1 & \verb~124~ & & \verb~ {~\\ +\cellcolor{green} & 1 & \verb~125~ & & \verb~ var entityToUpdate = Context.Set().Find(id);~\\ +\cellcolor{gray} & & \verb~126~ & & \verb~~\\ +\cellcolor{green} & 1 & \verb~127~ & & \verb~ if (entityToUpdate == null) throw CreateEntityNotFoundException> predica~\\ +\cellcolor{green} & 1 & \verb~135~ & & \verb~ {~\\ +\cellcolor{green} & 1 & \verb~136~ & & \verb~ var entityToUpdate = Context.Set().Where(predicate).SingleOrDef~\\ +\cellcolor{gray} & & \verb~137~ & & \verb~~\\ +\cellcolor{green} & 1 & \verb~138~ & & \verb~ if (entityToUpdate == null) throw CreateEntityNotFoundException delta, params object[] ids)~\\ +\cellcolor{green} & 1 & \verb~146~ & & \verb~ {~\\ +\cellcolor{green} & 1 & \verb~147~ & & \verb~ var entityToUpdate = Context.Set().Find(ids);~\\ +\cellcolor{gray} & & \verb~148~ & & \verb~~\\ +\cellcolor{green} & 1 & \verb~149~ & & \verb~ if (entityToUpdate == null) throw CreateEntityNotFoundException delta, Expression> predicate~\\ +\cellcolor{green} & 1 & \verb~163~ & & \verb~ {~\\ +\cellcolor{green} & 1 & \verb~164~ & & \verb~ var entityToUpdate = Context.Set().Where(predicate).SingleOrDef~\\ +\cellcolor{gray} & & \verb~165~ & & \verb~~\\ +\cellcolor{green} & 1 & \verb~166~ & & \verb~ if (entityToUpdate == null) throw CreateEntityNotFoundException(string entityId, ~\\ +\cellcolor{green} & 1 & \verb~180~ & & \verb~ {~\\ +\cellcolor{green} & 1 & \verb~181~ & & \verb~ return (E)Activator.CreateInstance(typeof(E), string.Format("{0} i~\\ +\cellcolor{green} & 1 & \verb~182~ & & \verb~ }~\\ +\cellcolor{gray} & & \verb~183~ & & \verb~~\\ +\cellcolor{gray} & & \verb~184~ & & \verb~ protected virtual void MarkIgnoreFields(T entityToUpdate)~\\ +\cellcolor{green} & 1 & \verb~185~ & & \verb~ {~\\ +\cellcolor{green} & 1 & \verb~186~ & & \verb~ if(IgnoreFieldsOnUpdate.IsValueCreated)~\\ +\cellcolor{green} & 1 & \verb~187~ & & \verb~ { IgnoreFieldsOnUpdate.Value.ForEach(ignoreField => Context.Entry(~\\ +\cellcolor{gray} & & \verb~188~ & & \verb~~\\ +\cellcolor{gray} & & \verb~189~ & & \verb~~\\ +\cellcolor{green} & 1 & \verb~190~ & & \verb~ if(IgnoreFieldsOnUpdate2.IsValueCreated)~\\ +\cellcolor{red} & 0 & \verb~191~ & & \verb~ { IgnoreFieldsOnUpdate2.Value.ForEach(ignoreField => Context.Entry~\\ +\cellcolor{green} & 1 & \verb~192~ & & \verb~ }~\\ +\cellcolor{gray} & & \verb~193~ & & \verb~~\\ +\cellcolor{gray} & & \verb~194~ & & \verb~ public async virtual Task SaveAsync()~\\ +\cellcolor{gray} & & \verb~195~ & & \verb~ {~\\ +\cellcolor{gray} & & \verb~196~ & & \verb~ return await Context.SaveChangesAsync();~\\ +\cellcolor{gray} & & \verb~197~ & & \verb~ }~\\ +\cellcolor{gray} & & \verb~198~ & & \verb~~\\ +\cellcolor{gray} & & \verb~199~ & & \verb~ public virtual int Save()~\\ +\cellcolor{green} & 1 & \verb~200~ & & \verb~ {~\\ +\cellcolor{green} & 1 & \verb~201~ & & \verb~ return Context.SaveChanges();~\\ +\cellcolor{green} & 1 & \verb~202~ & & \verb~ }~\\ +\cellcolor{gray} & & \verb~203~ & & \verb~~\\ +\cellcolor{gray} & & \verb~204~ & & \verb~ public virtual int Count()~\\ +\cellcolor{green} & 1 & \verb~205~ & & \verb~ {~\\ +\cellcolor{green} & 1 & \verb~206~ & & \verb~ return Context.Set().Count();~\\ +\cellcolor{green} & 1 & \verb~207~ & & \verb~ }~\\ +\cellcolor{gray} & & \verb~208~ & & \verb~~\\ +\cellcolor{gray} & & \verb~209~ & & \verb~ public async virtual Task CountAsync()~\\ +\cellcolor{gray} & & \verb~210~ & & \verb~ {~\\ +\cellcolor{gray} & & \verb~211~ & & \verb~ return await Context.Set().CountAsync();~\\ +\cellcolor{gray} & & \verb~212~ & & \verb~ }~\\ +\cellcolor{gray} & & \verb~213~ & & \verb~~\\ +\cellcolor{gray} & & \verb~214~ & & \verb~ #region IDisposable Support~\\ +\cellcolor{green} & 1 & \verb~215~ & & \verb~ private bool disposedValue = false; // To detect redundant calls~\\ +\cellcolor{gray} & & \verb~216~ & & \verb~~\\ +\cellcolor{gray} & & \verb~217~ & & \verb~ protected virtual void Dispose(bool disposing)~\\ +\cellcolor{green} & 1 & \verb~218~ & & \verb~ {~\\ +\cellcolor{green} & 1 & \verb~219~ & & \verb~ if (!disposedValue)~\\ +\cellcolor{green} & 1 & \verb~220~ & & \verb~ {~\\ +\cellcolor{green} & 1 & \verb~221~ & & \verb~ if (disposing)~\\ +\cellcolor{green} & 1 & \verb~222~ & & \verb~ {~\\ +\cellcolor{green} & 1 & \verb~223~ & & \verb~ if (Context != null)~\\ +\cellcolor{green} & 1 & \verb~224~ & & \verb~ {~\\ +\cellcolor{green} & 1 & \verb~225~ & & \verb~ Context.Dispose();~\\ +\cellcolor{green} & 1 & \verb~226~ & & \verb~ Context = null;~\\ +\cellcolor{green} & 1 & \verb~227~ & & \verb~ }~\\ +\cellcolor{green} & 1 & \verb~228~ & & \verb~ }~\\ +\cellcolor{gray} & & \verb~229~ & & \verb~~\\ +\cellcolor{green} & 1 & \verb~230~ & & \verb~ disposedValue = true;~\\ +\cellcolor{green} & 1 & \verb~231~ & & \verb~ }~\\ +\cellcolor{green} & 1 & \verb~232~ & & \verb~ }~\\ +\cellcolor{gray} & & \verb~233~ & & \verb~~\\ +\cellcolor{gray} & & \verb~234~ & & \verb~ public void Dispose()~\\ +\cellcolor{green} & 1 & \verb~235~ & & \verb~ {~\\ +\cellcolor{green} & 1 & \verb~236~ & & \verb~ Dispose(true);~\\ +\cellcolor{green} & 1 & \verb~237~ & & \verb~ }~\\ +\cellcolor{gray} & & \verb~238~ & & \verb~ #endregion~\\ +\cellcolor{gray} & & \verb~239~ & & \verb~~\\ +\cellcolor{gray} & & \verb~240~ & & \verb~ }~\\ +\cellcolor{gray} & & \verb~241~ & & \verb~}~\\ +\end{longtable} +\newpage +\section{EntityFramework.Repository6.DatabaseFactory} +\subsection{Summary} +\begin{longtable}[l]{ll} +\textbf{Class:} & EntityFramework.Repository6.DatabaseFactory\\ +\textbf{Assembly:} & entityframework.repository6.dll\\ +\textbf{File(s):} & \begin{minipage}[t]{12cm}{pment\textbackslash EntityFrameworkRepository6\textbackslash EntityFrameworkRepository6\textbackslash DatabaseFactory.cs}\end{minipage} \\ +\textbf{Covered lines:} & 0\\ +\textbf{Uncovered lines:} & 11\\ +\textbf{Coverable lines:} & 11\\ +\textbf{Total lines:} & 33\\ +\textbf{Line coverage:} & 0\%\\ +\end{longtable} +\subsection{Metrics} +\begin{longtable}[l]{|l|l|l|} +\hline +\textbf{Method} & \textbf{Blocks covered} & \textbf{Blocks not covered}\\ +\hline +\textbf{DatabaseFactory(stri} & 0 & 3\\ +\hline +\textbf{GetNewDbContext()} & 0 & 11\\ +\hline +\end{longtable} +\subsection{File(s)} +\subsubsection{pment\textbackslash EntityFrameworkRepository6\textbackslash EntityFrameworkRepository6\textbackslash DatabaseFactory.cs} +\begin{longtable}[l]{lrrll} +\textbf{} & \textbf{\#} & \textbf{Line} & \textbf{} & \textbf{Line coverage}\\ +\cellcolor{gray} & & \verb~1~ & & \verb~using System;~\\ +\cellcolor{gray} & & \verb~2~ & & \verb~using System.Data.Entity;~\\ +\cellcolor{gray} & & \verb~3~ & & \verb~~\\ +\cellcolor{gray} & & \verb~4~ & & \verb~namespace EntityFramework.Repository6~\\ +\cellcolor{gray} & & \verb~5~ & & \verb~{~\\ +\cellcolor{gray} & & \verb~6~ & & \verb~ public interface IDatabaseFactory~\\ +\cellcolor{gray} & & \verb~7~ & & \verb~ {~\\ +\cellcolor{gray} & & \verb~8~ & & \verb~ C GetNewDbContext();~\\ +\cellcolor{gray} & & \verb~9~ & & \verb~ Action Logging { get; set; }~\\ +\cellcolor{gray} & & \verb~10~ & & \verb~ }~\\ +\cellcolor{gray} & & \verb~11~ & & \verb~~\\ +\cellcolor{gray} & & \verb~12~ & & \verb~ public class DatabaseFactory : IDatabaseFactory~\\ +\cellcolor{gray} & & \verb~13~ & & \verb~ where C : DbContext~\\ +\cellcolor{gray} & & \verb~14~ & & \verb~ {~\\ +\cellcolor{red} & 0 & \verb~15~ & & \verb~ public Action Logging { get; set; }~\\ +\cellcolor{gray} & & \verb~16~ & & \verb~~\\ +\cellcolor{red} & 0 & \verb~17~ & & \verb~ protected string dbConnectionString { get; set; }~\\ +\cellcolor{gray} & & \verb~18~ & & \verb~~\\ +\cellcolor{red} & 0 & \verb~19~ & & \verb~ public DatabaseFactory(string connectionString)~\\ +\cellcolor{red} & 0 & \verb~20~ & & \verb~ {~\\ +\cellcolor{red} & 0 & \verb~21~ & & \verb~ dbConnectionString = connectionString;~\\ +\cellcolor{red} & 0 & \verb~22~ & & \verb~ }~\\ +\cellcolor{gray} & & \verb~23~ & & \verb~~\\ +\cellcolor{gray} & & \verb~24~ & & \verb~ public virtual C GetNewDbContext()~\\ +\cellcolor{red} & 0 & \verb~25~ & & \verb~ {~\\ +\cellcolor{red} & 0 & \verb~26~ & & \verb~ var newContext = (C)Activator.CreateInstance(typeof(C), dbConnecti~\\ +\cellcolor{gray} & & \verb~27~ & & \verb~~\\ +\cellcolor{red} & 0 & \verb~28~ & & \verb~ if (Logging != null) { newContext.Database.Log = Logging; }~\\ +\cellcolor{gray} & & \verb~29~ & & \verb~~\\ +\cellcolor{red} & 0 & \verb~30~ & & \verb~ return newContext;~\\ +\cellcolor{red} & 0 & \verb~31~ & & \verb~ }~\\ +\cellcolor{gray} & & \verb~32~ & & \verb~ }~\\ +\cellcolor{gray} & & \verb~33~ & & \verb~}~\\ +\end{longtable} +\newpage +\section{EntityFramework.Repository6.Delta} +\subsection{Summary} +\begin{longtable}[l]{ll} +\textbf{Class:} & EntityFramework.Repository6.Delta\\ +\textbf{Assembly:} & entityframework.repository6.dll\\ +\textbf{File(s):} & \begin{minipage}[t]{12cm}{velopment\textbackslash EntityFrameworkRepository6\textbackslash EntityFramework.SharedRepository\textbackslash Delta.cs}\end{minipage} \\ +\textbf{Covered lines:} & 23\\ +\textbf{Uncovered lines:} & 0\\ +\textbf{Coverable lines:} & 23\\ +\textbf{Total lines:} & 43\\ +\textbf{Line coverage:} & 100\%\\ +\end{longtable} +\subsection{Metrics} +\begin{longtable}[l]{|l|l|l|} +\hline +\textbf{Method} & \textbf{Blocks covered} & \textbf{Blocks not covered}\\ +\hline +\textbf{UpdatedFields()} & 3 & 0\\ +\hline +\textbf{Delta()} & 7 & 0\\ +\hline +\textbf{SetValue(string, obj} & 14 & 0\\ +\hline +\end{longtable} +\subsection{File(s)} +\subsubsection{velopment\textbackslash EntityFrameworkRepository6\textbackslash EntityFramework.SharedRepository\textbackslash Delta.cs} +\begin{longtable}[l]{lrrll} +\textbf{} & \textbf{\#} & \textbf{Line} & \textbf{} & \textbf{Line coverage}\\ +\cellcolor{gray} & & \verb~1~ & & \verb~using System;~\\ +\cellcolor{gray} & & \verb~2~ & & \verb~using System.Collections.Generic;~\\ +\cellcolor{gray} & & \verb~3~ & & \verb~using System.Linq;~\\ +\cellcolor{gray} & & \verb~4~ & & \verb~using System.Text;~\\ +\cellcolor{gray} & & \verb~5~ & & \verb~using System.Threading.Tasks;~\\ +\cellcolor{gray} & & \verb~6~ & & \verb~~\\ +\cellcolor{gray} & & \verb~7~ & & \verb~namespace EntityFramework.Repository6~\\ +\cellcolor{gray} & & \verb~8~ & & \verb~{~\\ +\cellcolor{gray} & & \verb~9~ & & \verb~ public class Delta where T : class~\\ +\cellcolor{gray} & & \verb~10~ & & \verb~ {~\\ +\cellcolor{green} & 1 & \verb~11~ & & \verb~ List Fields { get; set; }~\\ +\cellcolor{green} & 1 & \verb~12~ & & \verb~ public T Internal { get; set; }~\\ +\cellcolor{gray} & & \verb~13~ & & \verb~~\\ +\cellcolor{gray} & & \verb~14~ & & \verb~ public List UpdatedFields()~\\ +\cellcolor{green} & 1 & \verb~15~ & & \verb~ {~\\ +\cellcolor{green} & 1 & \verb~16~ & & \verb~ return Fields;~\\ +\cellcolor{green} & 1 & \verb~17~ & & \verb~ }~\\ +\cellcolor{gray} & & \verb~18~ & & \verb~~\\ +\cellcolor{green} & 1 & \verb~19~ & & \verb~ public Delta()~\\ +\cellcolor{green} & 1 & \verb~20~ & & \verb~ {~\\ +\cellcolor{green} & 1 & \verb~21~ & & \verb~ Internal = (T)Activator.CreateInstance(typeof(T));~\\ +\cellcolor{green} & 1 & \verb~22~ & & \verb~ Fields = new List();~\\ +\cellcolor{green} & 1 & \verb~23~ & & \verb~ }~\\ +\cellcolor{gray} & & \verb~24~ & & \verb~~\\ +\cellcolor{gray} & & \verb~25~ & & \verb~ public void SetValue(string fieldName, object data)~\\ +\cellcolor{green} & 1 & \verb~26~ & & \verb~ {~\\ +\cellcolor{green} & 1 & \verb~27~ & & \verb~ var prop1 = typeof(T).GetProperty(fieldName);~\\ +\cellcolor{green} & 1 & \verb~28~ & & \verb~ if (prop1 == null)~\\ +\cellcolor{green} & 1 & \verb~29~ & & \verb~ {~\\ +\cellcolor{green} & 1 & \verb~30~ & & \verb~ throw new ArgumentException($"{fieldName} was not a property f~\\ +\cellcolor{gray} & & \verb~31~ & & \verb~ }~\\ +\cellcolor{gray} & & \verb~32~ & & \verb~ try~\\ +\cellcolor{green} & 1 & \verb~33~ & & \verb~ {~\\ +\cellcolor{green} & 1 & \verb~34~ & & \verb~ prop1.SetValue(Internal, data);~\\ +\cellcolor{green} & 1 & \verb~35~ & & \verb~ Fields.Add(fieldName);~\\ +\cellcolor{green} & 1 & \verb~36~ & & \verb~ }~\\ +\cellcolor{green} & 1 & \verb~37~ & & \verb~ catch (ArgumentException ex)~\\ +\cellcolor{green} & 1 & \verb~38~ & & \verb~ {~\\ +\cellcolor{green} & 1 & \verb~39~ & & \verb~ throw ex;~\\ +\cellcolor{gray} & & \verb~40~ & & \verb~ }~\\ +\cellcolor{green} & 1 & \verb~41~ & & \verb~ }~\\ +\cellcolor{gray} & & \verb~42~ & & \verb~ }~\\ +\cellcolor{gray} & & \verb~43~ & & \verb~}~\\ +\end{longtable} +\newpage +\section{EntityFramework.Repository6.Tests.DeltaTests} +\subsection{Summary} +\begin{longtable}[l]{ll} +\textbf{Class:} & EntityFramework.Repository6.Tests.DeltaTests\\ +\textbf{Assembly:} & entityframework.repository6.tests.dll\\ +\textbf{File(s):} & \begin{minipage}[t]{12cm}{pment\textbackslash EntityFrameworkRepository6\textbackslash EntityFrameworkRepository6Tests\textbackslash DeltaTests.cs}\end{minipage} \\ +\textbf{Covered lines:} & 48\\ +\textbf{Uncovered lines:} & 2\\ +\textbf{Coverable lines:} & 50\\ +\textbf{Total lines:} & 111\\ +\textbf{Line coverage:} & 96\%\\ +\end{longtable} +\subsection{Metrics} +\begin{longtable}[l]{|l|l|l|} +\hline +\textbf{Method} & \textbf{Blocks covered} & \textbf{Blocks not covered}\\ +\hline +\textbf{Setup()} & 18 & 0\\ +\hline +\textbf{DeltaTest1()} & 16 & 0\\ +\hline +\textbf{DeltaTestWrongDataTy} & 8 & 1\\ +\hline +\textbf{DeltaTestInvalidFiel} & 8 & 1\\ +\hline +\textbf{DeltaTestWithPredica} & 27 & 0\\ +\hline +\end{longtable} +\subsection{File(s)} +\subsubsection{pment\textbackslash EntityFrameworkRepository6\textbackslash EntityFrameworkRepository6Tests\textbackslash DeltaTests.cs} +\begin{longtable}[l]{lrrll} +\textbf{} & \textbf{\#} & \textbf{Line} & \textbf{} & \textbf{Line coverage}\\ +\cellcolor{gray} & & \verb~1~ & & \verb~using System;~\\ +\cellcolor{gray} & & \verb~2~ & & \verb~using Microsoft.VisualStudio.TestTools.UnitTesting;~\\ +\cellcolor{gray} & & \verb~3~ & & \verb~using System.Diagnostics;~\\ +\cellcolor{gray} & & \verb~4~ & & \verb~using Microsoft.Practices.Unity;~\\ +\cellcolor{gray} & & \verb~5~ & & \verb~using PersistentLayer.Repositories;~\\ +\cellcolor{gray} & & \verb~6~ & & \verb~using System.Linq;~\\ +\cellcolor{gray} & & \verb~7~ & & \verb~using PersistentLayer.Entities;~\\ +\cellcolor{gray} & & \verb~8~ & & \verb~using System.Data.Entity.Infrastructure;~\\ +\cellcolor{gray} & & \verb~9~ & & \verb~using EntityFramework.Repository6.Interfaces;~\\ +\cellcolor{gray} & & \verb~10~ & & \verb~using EntityFramework.Repository6;~\\ +\cellcolor{gray} & & \verb~11~ & & \verb~~\\ +\cellcolor{gray} & & \verb~12~ & & \verb~namespace EntityFramework.Repository6.Tests~\\ +\cellcolor{gray} & & \verb~13~ & & \verb~{~\\ +\cellcolor{gray} & & \verb~14~ & & \verb~ [TestClass]~\\ +\cellcolor{gray} & & \verb~15~ & & \verb~ public class DeltaTests~\\ +\cellcolor{gray} & & \verb~16~ & & \verb~ {~\\ +\cellcolor{green} & 1 & \verb~17~ & & \verb~ UnityContainer LocalIoCContainer { get; set; }~\\ +\cellcolor{gray} & & \verb~18~ & & \verb~~\\ +\cellcolor{gray} & & \verb~19~ & & \verb~ [TestInitialize]~\\ +\cellcolor{gray} & & \verb~20~ & & \verb~ public void Setup()~\\ +\cellcolor{green} & 1 & \verb~21~ & & \verb~ {~\\ +\cellcolor{green} & 1 & \verb~22~ & & \verb~ Action logSetup = message => Debug.WriteLine(message);~\\ +\cellcolor{gray} & & \verb~23~ & & \verb~~\\ +\cellcolor{green} & 1 & \verb~24~ & & \verb~ LocalIoCContainer = new UnityContainer();~\\ +\cellcolor{green} & 1 & \verb~25~ & & \verb~ LocalIoCContainer.RegisterType), typeo~\\ +\cellcolor{gray} & & \verb~33~ & & \verb~ // , new HierarchicalLifetimeManager()~\\ +\cellcolor{gray} & & \verb~34~ & & \verb~ // , new InjectionConstructor(connectionString)~\\ +\cellcolor{gray} & & \verb~35~ & & \verb~ // , new InjectionProperty("Logging", logSetup));~\\ +\cellcolor{gray} & & \verb~36~ & & \verb~~\\ +\cellcolor{gray} & & \verb~37~ & & \verb~ //Use an nmemory database~\\ +\cellcolor{green} & 1 & \verb~38~ & & \verb~ LocalIoCContainer.RegisterType(typeof(IDatabaseFactory<>), typeof(~\\ +\cellcolor{green} & 1 & \verb~39~ & & \verb~ , new HierarchicalLifetimeManager()~\\ +\cellcolor{green} & 1 & \verb~40~ & & \verb~ , new InjectionProperty("Logging", logSetup));~\\ +\cellcolor{green} & 1 & \verb~41~ & & \verb~ }~\\ +\cellcolor{gray} & & \verb~42~ & & \verb~~\\ +\cellcolor{gray} & & \verb~43~ & & \verb~ [TestCategory("StandardRepository")]~\\ +\cellcolor{gray} & & \verb~44~ & & \verb~ [TestMethod]~\\ +\cellcolor{gray} & & \verb~45~ & & \verb~ public void DeltaTest1()~\\ +\cellcolor{green} & 1 & \verb~46~ & & \verb~ {~\\ +\cellcolor{green} & 1 & \verb~47~ & & \verb~ var repository = LocalIoCContainer.Resolve();~\\ +\cellcolor{green} & 1 & \verb~53~ & & \verb~ delta1.SetValue("Name", "Delta Change Test");~\\ +\cellcolor{gray} & & \verb~54~ & & \verb~~\\ +\cellcolor{green} & 1 & \verb~55~ & & \verb~ repository.Update(delta1, newItem.Id);~\\ +\cellcolor{gray} & & \verb~56~ & & \verb~~\\ +\cellcolor{green} & 1 & \verb~57~ & & \verb~ repository.Save();~\\ +\cellcolor{gray} & & \verb~58~ & & \verb~~\\ +\cellcolor{green} & 1 & \verb~59~ & & \verb~ var updatedValue = repository.Find(actual.Id);~\\ +\cellcolor{green} & 1 & \verb~60~ & & \verb~ Assert.AreEqual("Delta Change Test", updatedValue.Name);~\\ +\cellcolor{green} & 1 & \verb~61~ & & \verb~ }~\\ +\cellcolor{gray} & & \verb~62~ & & \verb~~\\ +\cellcolor{gray} & & \verb~63~ & & \verb~ [TestCategory("StandardRepository")]~\\ +\cellcolor{gray} & & \verb~64~ & & \verb~ [TestMethod]~\\ +\cellcolor{gray} & & \verb~65~ & & \verb~ [ExpectedException(typeof(ArgumentException))]~\\ +\cellcolor{gray} & & \verb~66~ & & \verb~ public void DeltaTestWrongDataType1()~\\ +\cellcolor{green} & 1 & \verb~67~ & & \verb~ {~\\ +\cellcolor{green} & 1 & \verb~68~ & & \verb~ var repository = LocalIoCContainer.Resolve();~\\ +\cellcolor{green} & 1 & \verb~74~ & & \verb~ delta1.SetValue("Name", 1);~\\ +\cellcolor{red} & 0 & \verb~75~ & & \verb~ }~\\ +\cellcolor{gray} & & \verb~76~ & & \verb~~\\ +\cellcolor{gray} & & \verb~77~ & & \verb~ [TestCategory("StandardRepository")]~\\ +\cellcolor{gray} & & \verb~78~ & & \verb~ [TestMethod]~\\ +\cellcolor{gray} & & \verb~79~ & & \verb~ [ExpectedException(typeof(ArgumentException))]~\\ +\cellcolor{gray} & & \verb~80~ & & \verb~ public void DeltaTestInvalidFieldName1()~\\ +\cellcolor{green} & 1 & \verb~81~ & & \verb~ {~\\ +\cellcolor{green} & 1 & \verb~82~ & & \verb~ var repository = LocalIoCContainer.Resolve();~\\ +\cellcolor{green} & 1 & \verb~88~ & & \verb~ delta1.SetValue("NameNotRight", "Right data type");~\\ +\cellcolor{red} & 0 & \verb~89~ & & \verb~ }~\\ +\cellcolor{gray} & & \verb~90~ & & \verb~~\\ +\cellcolor{gray} & & \verb~91~ & & \verb~ [TestCategory("StandardRepository")]~\\ +\cellcolor{gray} & & \verb~92~ & & \verb~ [TestMethod]~\\ +\cellcolor{gray} & & \verb~93~ & & \verb~ public void DeltaTestWithPredicate()~\\ +\cellcolor{green} & 1 & \verb~94~ & & \verb~ {~\\ +\cellcolor{green} & 1 & \verb~95~ & & \verb~ var repository = LocalIoCContainer.Resolve();~\\ +\cellcolor{green} & 1 & \verb~101~ & & \verb~ delta1.SetValue("Name", "Delta Change Test");~\\ +\cellcolor{gray} & & \verb~102~ & & \verb~~\\ +\cellcolor{green} & 1 & \verb~103~ & & \verb~ repository.Update(delta1, x=>x.Id == newItem.Id);~\\ +\cellcolor{gray} & & \verb~104~ & & \verb~~\\ +\cellcolor{green} & 1 & \verb~105~ & & \verb~ repository.Save();~\\ +\cellcolor{gray} & & \verb~106~ & & \verb~~\\ +\cellcolor{green} & 1 & \verb~107~ & & \verb~ var updatedValue = repository.Find(actual.Id);~\\ +\cellcolor{green} & 1 & \verb~108~ & & \verb~ Assert.AreEqual("Delta Change Test", updatedValue.Name);~\\ +\cellcolor{green} & 1 & \verb~109~ & & \verb~ }~\\ +\cellcolor{gray} & & \verb~110~ & & \verb~ }~\\ +\cellcolor{gray} & & \verb~111~ & & \verb~}~\\ +\end{longtable} +\newpage +\section{EntityFramework.Repository6.Tests.RepositoryCreateTests} +\subsection{Summary} +\begin{longtable}[l]{ll} +\textbf{Class:} & EntityFramework.Repository6.Tests.RepositoryCreateTests\\ +\textbf{Assembly:} & entityframework.repository6.tests.dll\\ +\textbf{File(s):} & \begin{minipage}[t]{12cm}{yFrameworkRepository6\textbackslash EntityFrameworkRepository6Tests\textbackslash RepositoryCreateTests.cs}\end{minipage} \\ +\textbf{Covered lines:} & 80\\ +\textbf{Uncovered lines:} & 1\\ +\textbf{Coverable lines:} & 81\\ +\textbf{Total lines:} & 165\\ +\textbf{Line coverage:} & 98.7\%\\ +\end{longtable} +\subsection{Metrics} +\begin{longtable}[l]{|l|l|l|} +\hline +\textbf{Method} & \textbf{Blocks covered} & \textbf{Blocks not covered}\\ +\hline +\textbf{Setup()} & 18 & 0\\ +\hline +\textbf{InsertTestMethod()} & 14 & 0\\ +\hline +\textbf{InsertTestMethod2()} & 14 & 0\\ +\hline +\textbf{InsertTestMethod3()} & 14 & 0\\ +\hline +\textbf{InsertMultipleTest()} & 20 & 0\\ +\hline +\textbf{InsertIntoCompositeK} & 24 & 0\\ +\hline +\textbf{InsertDuplicateIntoC} & 17 & 1\\ +\hline +\end{longtable} +\subsection{File(s)} +\subsubsection{yFrameworkRepository6\textbackslash EntityFrameworkRepository6Tests\textbackslash RepositoryCreateTests.cs} +\begin{longtable}[l]{lrrll} +\textbf{} & \textbf{\#} & \textbf{Line} & \textbf{} & \textbf{Line coverage}\\ +\cellcolor{gray} & & \verb~1~ & & \verb~using System;~\\ +\cellcolor{gray} & & \verb~2~ & & \verb~using Microsoft.VisualStudio.TestTools.UnitTesting;~\\ +\cellcolor{gray} & & \verb~3~ & & \verb~using System.Diagnostics;~\\ +\cellcolor{gray} & & \verb~4~ & & \verb~using Microsoft.Practices.Unity;~\\ +\cellcolor{gray} & & \verb~5~ & & \verb~using PersistentLayer.Repositories;~\\ +\cellcolor{gray} & & \verb~6~ & & \verb~using System.Linq;~\\ +\cellcolor{gray} & & \verb~7~ & & \verb~using PersistentLayer.Entities;~\\ +\cellcolor{gray} & & \verb~8~ & & \verb~using System.Data.Entity.Infrastructure;~\\ +\cellcolor{gray} & & \verb~9~ & & \verb~using EntityFramework.Repository6;~\\ +\cellcolor{gray} & & \verb~10~ & & \verb~using System.Collections.Generic;~\\ +\cellcolor{gray} & & \verb~11~ & & \verb~~\\ +\cellcolor{gray} & & \verb~12~ & & \verb~namespace EntityFramework.Repository6.Tests~\\ +\cellcolor{gray} & & \verb~13~ & & \verb~{~\\ +\cellcolor{gray} & & \verb~14~ & & \verb~ [TestClass]~\\ +\cellcolor{gray} & & \verb~15~ & & \verb~ public class RepositoryCreateTests~\\ +\cellcolor{gray} & & \verb~16~ & & \verb~ {~\\ +\cellcolor{green} & 1 & \verb~17~ & & \verb~ UnityContainer LocalIoCContainer { get; set; }~\\ +\cellcolor{gray} & & \verb~18~ & & \verb~~\\ +\cellcolor{gray} & & \verb~19~ & & \verb~ [TestInitialize]~\\ +\cellcolor{gray} & & \verb~20~ & & \verb~ public void Setup()~\\ +\cellcolor{green} & 1 & \verb~21~ & & \verb~ {~\\ +\cellcolor{green} & 1 & \verb~22~ & & \verb~ Action logSetup = message => Debug.WriteLine(message);~\\ +\cellcolor{gray} & & \verb~23~ & & \verb~~\\ +\cellcolor{green} & 1 & \verb~24~ & & \verb~ LocalIoCContainer = new UnityContainer();~\\ +\cellcolor{green} & 1 & \verb~25~ & & \verb~ LocalIoCContainer.RegisterType), typeo~\\ +\cellcolor{gray} & & \verb~33~ & & \verb~ // , new HierarchicalLifetimeManager()~\\ +\cellcolor{gray} & & \verb~34~ & & \verb~ // , new InjectionConstructor(connectionString)~\\ +\cellcolor{gray} & & \verb~35~ & & \verb~ // , new InjectionProperty("Logging", logSetup));~\\ +\cellcolor{gray} & & \verb~36~ & & \verb~~\\ +\cellcolor{gray} & & \verb~37~ & & \verb~ //Use an nmemory database~\\ +\cellcolor{green} & 1 & \verb~38~ & & \verb~ LocalIoCContainer.RegisterType(typeof(IDatabaseFactory<>), typeof(~\\ +\cellcolor{green} & 1 & \verb~39~ & & \verb~ , new HierarchicalLifetimeManager()~\\ +\cellcolor{green} & 1 & \verb~40~ & & \verb~ , new InjectionProperty("Logging", logSetup));~\\ +\cellcolor{green} & 1 & \verb~41~ & & \verb~ }~\\ +\cellcolor{gray} & & \verb~42~ & & \verb~~\\ +\cellcolor{gray} & & \verb~43~ & & \verb~ [TestCategory("StandardRepository")]~\\ +\cellcolor{gray} & & \verb~44~ & & \verb~ [TestMethod]~\\ +\cellcolor{gray} & & \verb~45~ & & \verb~ public void InsertTestMethod()~\\ +\cellcolor{green} & 1 & \verb~46~ & & \verb~ {~\\ +\cellcolor{green} & 1 & \verb~47~ & & \verb~ var repository = LocalIoCContainer.Resolve~\\ +\cellcolor{green} & 1 & \verb~109~ & & \verb~ {~\\ +\cellcolor{green} & 1 & \verb~110~ & & \verb~ newItem1~\\ +\cellcolor{green} & 1 & \verb~111~ & & \verb~ , newItem2~\\ +\cellcolor{green} & 1 & \verb~112~ & & \verb~ , newItem3~\\ +\cellcolor{green} & 1 & \verb~113~ & & \verb~ });~\\ +\cellcolor{green} & 1 & \verb~114~ & & \verb~ var result = repository.Save();~\\ +\cellcolor{gray} & & \verb~115~ & & \verb~~\\ +\cellcolor{green} & 1 & \verb~116~ & & \verb~ var actual2 = repository.Count();~\\ +\cellcolor{gray} & & \verb~117~ & & \verb~~\\ +\cellcolor{green} & 1 & \verb~118~ & & \verb~ Assert.AreEqual(7, actual1);~\\ +\cellcolor{green} & 1 & \verb~119~ & & \verb~ Assert.AreEqual(10, actual2);~\\ +\cellcolor{gray} & & \verb~120~ & & \verb~~\\ +\cellcolor{green} & 1 & \verb~121~ & & \verb~ repository.Dispose();~\\ +\cellcolor{green} & 1 & \verb~122~ & & \verb~ }~\\ +\cellcolor{gray} & & \verb~123~ & & \verb~~\\ +\cellcolor{gray} & & \verb~124~ & & \verb~ [TestCategory("StandardRepository")]~\\ +\cellcolor{gray} & & \verb~125~ & & \verb~ [TestMethod]~\\ +\cellcolor{gray} & & \verb~126~ & & \verb~ public void InsertIntoCompositeKeyTableMethod()~\\ +\cellcolor{green} & 1 & \verb~127~ & & \verb~ {~\\ +\cellcolor{green} & 1 & \verb~128~ & & \verb~ var repository = LocalIoCContainer.Resolve), typeo~\\ +\cellcolor{gray} & & \verb~33~ & & \verb~ // , new HierarchicalLifetimeManager()~\\ +\cellcolor{gray} & & \verb~34~ & & \verb~ // , new InjectionConstructor(connectionString)~\\ +\cellcolor{gray} & & \verb~35~ & & \verb~ // , new InjectionProperty("Logging", logSetup));~\\ +\cellcolor{gray} & & \verb~36~ & & \verb~~\\ +\cellcolor{gray} & & \verb~37~ & & \verb~ //Use an nmemory database~\\ +\cellcolor{green} & 1 & \verb~38~ & & \verb~ LocalIoCContainer.RegisterType(typeof(IDatabaseFactory<>), typeof(~\\ +\cellcolor{green} & 1 & \verb~39~ & & \verb~ , new HierarchicalLifetimeManager()~\\ +\cellcolor{green} & 1 & \verb~40~ & & \verb~ , new InjectionProperty("Logging", logSetup));~\\ +\cellcolor{green} & 1 & \verb~41~ & & \verb~ }~\\ +\cellcolor{gray} & & \verb~42~ & & \verb~~\\ +\cellcolor{gray} & & \verb~43~ & & \verb~ [TestCategory("StandardRepository")]~\\ +\cellcolor{gray} & & \verb~44~ & & \verb~ [TestMethod]~\\ +\cellcolor{gray} & & \verb~45~ & & \verb~ public void DeleteTestMethod()~\\ +\cellcolor{green} & 1 & \verb~46~ & & \verb~ {~\\ +\cellcolor{green} & 1 & \verb~47~ & & \verb~ var repository = LocalIoCContainer.Resolve x.Id == 1 || x.Id == 2)~\\ +\cellcolor{gray} & & \verb~74~ & & \verb~~\\ +\cellcolor{green} & 1 & \verb~75~ & & \verb~ repository.Delete(itemsToDelete);~\\ +\cellcolor{gray} & & \verb~76~ & & \verb~~\\ +\cellcolor{green} & 1 & \verb~77~ & & \verb~ repository.Save();~\\ +\cellcolor{gray} & & \verb~78~ & & \verb~~\\ +\cellcolor{green} & 1 & \verb~79~ & & \verb~ var actual2 = repository.Count();~\\ +\cellcolor{gray} & & \verb~80~ & & \verb~~\\ +\cellcolor{green} & 1 & \verb~81~ & & \verb~ Assert.AreEqual(7, actual1);~\\ +\cellcolor{green} & 1 & \verb~82~ & & \verb~ Assert.AreEqual(5, actual2);~\\ +\cellcolor{gray} & & \verb~83~ & & \verb~~\\ +\cellcolor{green} & 1 & \verb~84~ & & \verb~ repository.Dispose();~\\ +\cellcolor{green} & 1 & \verb~85~ & & \verb~ }~\\ +\cellcolor{gray} & & \verb~86~ & & \verb~ }~\\ +\cellcolor{gray} & & \verb~87~ & & \verb~}~\\ +\end{longtable} +\newpage +\section{EntityFramework.Repository6.Tests.RepositoryReadTests} +\subsection{Summary} +\begin{longtable}[l]{ll} +\textbf{Class:} & EntityFramework.Repository6.Tests.RepositoryReadTests\\ +\textbf{Assembly:} & entityframework.repository6.tests.dll\\ +\textbf{File(s):} & \begin{minipage}[t]{12cm}{ityFrameworkRepository6\textbackslash EntityFrameworkRepository6Tests\textbackslash RepositoryReadTests.cs}\end{minipage} \\ +\textbf{Covered lines:} & 78\\ +\textbf{Uncovered lines:} & 0\\ +\textbf{Coverable lines:} & 78\\ +\textbf{Total lines:} & 178\\ +\textbf{Line coverage:} & 100\%\\ +\end{longtable} +\subsection{Metrics} +\begin{longtable}[l]{|l|l|l|} +\hline +\textbf{Method} & \textbf{Blocks covered} & \textbf{Blocks not covered}\\ +\hline +\textbf{Setup()} & 18 & 0\\ +\hline +\textbf{GetAllFromSimpleData} & 7 & 0\\ +\hline +\textbf{CountOfSimpleDataEnt} & 6 & 0\\ +\hline +\textbf{FindTestMethod1()} & 7 & 0\\ +\hline +\textbf{SelectTestMethod()} & 16 & 0\\ +\hline +\textbf{FindAsyncTest()} & 8 & 0\\ +\hline +\textbf{FindAsyncMultiplePar} & 8 & 0\\ +\hline +\textbf{FindByReadOnlyTestAu} & 16 & 0\\ +\hline +\textbf{ExistsTestAudit()} & 14 & 0\\ +\hline +\textbf{FindAndReloadAsyncTe} & 15 & 0\\ +\hline +\textbf{FindAndReloadTestAud} & 13 & 0\\ +\hline +\end{longtable} +\subsection{File(s)} +\subsubsection{ityFrameworkRepository6\textbackslash EntityFrameworkRepository6Tests\textbackslash RepositoryReadTests.cs} +\begin{longtable}[l]{lrrll} +\textbf{} & \textbf{\#} & \textbf{Line} & \textbf{} & \textbf{Line coverage}\\ +\cellcolor{gray} & & \verb~1~ & & \verb~using System;~\\ +\cellcolor{gray} & & \verb~2~ & & \verb~using Microsoft.VisualStudio.TestTools.UnitTesting;~\\ +\cellcolor{gray} & & \verb~3~ & & \verb~using System.Diagnostics;~\\ +\cellcolor{gray} & & \verb~4~ & & \verb~using Microsoft.Practices.Unity;~\\ +\cellcolor{gray} & & \verb~5~ & & \verb~using PersistentLayer.Repositories;~\\ +\cellcolor{gray} & & \verb~6~ & & \verb~using System.Linq;~\\ +\cellcolor{gray} & & \verb~7~ & & \verb~using EntityFramework.Repository6;~\\ +\cellcolor{gray} & & \verb~8~ & & \verb~~\\ +\cellcolor{gray} & & \verb~9~ & & \verb~namespace EntityFramework.Repository6.Tests~\\ +\cellcolor{gray} & & \verb~10~ & & \verb~{~\\ +\cellcolor{gray} & & \verb~11~ & & \verb~ [TestClass]~\\ +\cellcolor{gray} & & \verb~12~ & & \verb~ public class RepositoryReadTests~\\ +\cellcolor{gray} & & \verb~13~ & & \verb~ {~\\ +\cellcolor{green} & 1 & \verb~14~ & & \verb~ UnityContainer LocalIoCContainer { get; set; }~\\ +\cellcolor{gray} & & \verb~15~ & & \verb~~\\ +\cellcolor{gray} & & \verb~16~ & & \verb~ [TestInitialize]~\\ +\cellcolor{gray} & & \verb~17~ & & \verb~ public void Setup()~\\ +\cellcolor{green} & 1 & \verb~18~ & & \verb~ {~\\ +\cellcolor{green} & 1 & \verb~19~ & & \verb~ Action logSetup = message => Debug.WriteLine(message);~\\ +\cellcolor{gray} & & \verb~20~ & & \verb~~\\ +\cellcolor{green} & 1 & \verb~21~ & & \verb~ LocalIoCContainer = new UnityContainer();~\\ +\cellcolor{green} & 1 & \verb~22~ & & \verb~ LocalIoCContainer.RegisterType), typeo~\\ +\cellcolor{gray} & & \verb~30~ & & \verb~ // , new HierarchicalLifetimeManager()~\\ +\cellcolor{gray} & & \verb~31~ & & \verb~ // , new InjectionConstructor(connectionString)~\\ +\cellcolor{gray} & & \verb~32~ & & \verb~ // , new InjectionProperty("Logging", logSetup));~\\ +\cellcolor{gray} & & \verb~33~ & & \verb~~\\ +\cellcolor{gray} & & \verb~34~ & & \verb~ //Use an nmemory database~\\ +\cellcolor{green} & 1 & \verb~35~ & & \verb~ LocalIoCContainer.RegisterType(typeof(IDatabaseFactory<>), typeof(~\\ +\cellcolor{green} & 1 & \verb~36~ & & \verb~ , new HierarchicalLifetimeManager()~\\ +\cellcolor{green} & 1 & \verb~37~ & & \verb~ , new InjectionProperty("Logging", logSetup));~\\ +\cellcolor{green} & 1 & \verb~38~ & & \verb~ }~\\ +\cellcolor{gray} & & \verb~39~ & & \verb~~\\ +\cellcolor{gray} & & \verb~40~ & & \verb~ [TestCategory("StandardRepository")]~\\ +\cellcolor{gray} & & \verb~41~ & & \verb~ [TestMethod]~\\ +\cellcolor{gray} & & \verb~42~ & & \verb~ public void GetAllFromSimpleDataEntitiesTable()~\\ +\cellcolor{green} & 1 & \verb~43~ & & \verb~ {~\\ +\cellcolor{green} & 1 & \verb~44~ & & \verb~ var repository = LocalIoCContainer.Resolve x.Id == 2).FirstOrDefault();~\\ +\cellcolor{green} & 1 & \verb~83~ & & \verb~ Assert.AreEqual("Test 2", actual.Name);~\\ +\cellcolor{gray} & & \verb~84~ & & \verb~~\\ +\cellcolor{green} & 1 & \verb~85~ & & \verb~ repository.Dispose();~\\ +\cellcolor{green} & 1 & \verb~86~ & & \verb~ }~\\ +\cellcolor{gray} & & \verb~87~ & & \verb~~\\ +\cellcolor{gray} & & \verb~88~ & & \verb~ [TestCategory("StandardRepository")]~\\ +\cellcolor{gray} & & \verb~89~ & & \verb~ [TestMethod]~\\ +\cellcolor{gray} & & \verb~90~ & & \verb~ public void FindAsyncTest()~\\ +\cellcolor{green} & 1 & \verb~91~ & & \verb~ {~\\ +\cellcolor{green} & 1 & \verb~92~ & & \verb~ var repository = LocalIoCContainer.Resolve x.Id == 1).SingleOrDef~\\ +\cellcolor{green} & 1 & \verb~119~ & & \verb~ Assert.AreEqual("Test 1", actual.Name);~\\ +\cellcolor{gray} & & \verb~120~ & & \verb~~\\ +\cellcolor{green} & 1 & \verb~121~ & & \verb~ repository.Dispose();~\\ +\cellcolor{green} & 1 & \verb~122~ & & \verb~ }~\\ +\cellcolor{gray} & & \verb~123~ & & \verb~~\\ +\cellcolor{gray} & & \verb~124~ & & \verb~ [TestCategory("StandardRepository")]~\\ +\cellcolor{gray} & & \verb~125~ & & \verb~ [TestMethod]~\\ +\cellcolor{gray} & & \verb~126~ & & \verb~ public void ExistsTestAudit()~\\ +\cellcolor{green} & 1 & \verb~127~ & & \verb~ {~\\ +\cellcolor{green} & 1 & \verb~128~ & & \verb~ var repository = LocalIoCContainer.Resolve x.Id == 1);~\\ +\cellcolor{green} & 1 & \verb~131~ & & \verb~ Assert.IsTrue(actual);~\\ +\cellcolor{gray} & & \verb~132~ & & \verb~~\\ +\cellcolor{green} & 1 & \verb~133~ & & \verb~ repository.Dispose();~\\ +\cellcolor{green} & 1 & \verb~134~ & & \verb~ }~\\ +\cellcolor{gray} & & \verb~135~ & & \verb~~\\ +\cellcolor{gray} & & \verb~136~ & & \verb~ [TestCategory("StandardRepository")]~\\ +\cellcolor{gray} & & \verb~137~ & & \verb~ [TestMethod]~\\ +\cellcolor{gray} & & \verb~138~ & & \verb~ public void FindAndReloadAsyncTestAudit()~\\ +\cellcolor{green} & 1 & \verb~139~ & & \verb~ {~\\ +\cellcolor{green} & 1 & \verb~140~ & & \verb~ var repository = LocalIoCContainer.Resolve logSetup = message => Debug.WriteLine(message);~\\ +\cellcolor{gray} & & \verb~23~ & & \verb~~\\ +\cellcolor{green} & 1 & \verb~24~ & & \verb~ LocalIoCContainer = new UnityContainer();~\\ +\cellcolor{green} & 1 & \verb~25~ & & \verb~ LocalIoCContainer.RegisterType), typeo~\\ +\cellcolor{gray} & & \verb~35~ & & \verb~ // , new HierarchicalLifetimeManager()~\\ +\cellcolor{gray} & & \verb~36~ & & \verb~ // , new InjectionConstructor(connectionString)~\\ +\cellcolor{gray} & & \verb~37~ & & \verb~ // , new InjectionProperty("Logging", logSetup));~\\ +\cellcolor{gray} & & \verb~38~ & & \verb~~\\ +\cellcolor{gray} & & \verb~39~ & & \verb~ //Use an nmemory database~\\ +\cellcolor{green} & 1 & \verb~40~ & & \verb~ LocalIoCContainer.RegisterType(typeof(IDatabaseFactory<>), typeof(~\\ +\cellcolor{green} & 1 & \verb~41~ & & \verb~ , new HierarchicalLifetimeManager()~\\ +\cellcolor{green} & 1 & \verb~42~ & & \verb~ , new InjectionProperty("Logging", logSetup));~\\ +\cellcolor{green} & 1 & \verb~43~ & & \verb~ }~\\ +\cellcolor{gray} & & \verb~44~ & & \verb~~\\ +\cellcolor{gray} & & \verb~45~ & & \verb~ [TestCategory("StandardRepository")]~\\ +\cellcolor{gray} & & \verb~46~ & & \verb~ [TestMethod]~\\ +\cellcolor{gray} & & \verb~47~ & & \verb~ public void UpdateTestMethod()~\\ +\cellcolor{green} & 1 & \verb~48~ & & \verb~ {~\\ +\cellcolor{green} & 1 & \verb~49~ & & \verb~ var repository = LocalIoCContainer.Resolve x.Id == 2);~\\ +\cellcolor{green} & 1 & \verb~91~ & & \verb~ repository.Save();~\\ +\cellcolor{gray} & & \verb~92~ & & \verb~~\\ +\cellcolor{green} & 1 & \verb~93~ & & \verb~ var actual = repository.Find(2);~\\ +\cellcolor{gray} & & \verb~94~ & & \verb~~\\ +\cellcolor{green} & 1 & \verb~95~ & & \verb~ Assert.AreEqual("Updated Name 2", actual.Name);~\\ +\cellcolor{gray} & & \verb~96~ & & \verb~~\\ +\cellcolor{green} & 1 & \verb~97~ & & \verb~ repository.Dispose();~\\ +\cellcolor{green} & 1 & \verb~98~ & & \verb~ }~\\ +\cellcolor{gray} & & \verb~99~ & & \verb~~\\ +\cellcolor{gray} & & \verb~100~ & & \verb~ [TestCategory("StandardRepository")]~\\ +\cellcolor{gray} & & \verb~101~ & & \verb~ [TestMethod]~\\ +\cellcolor{gray} & & \verb~102~ & & \verb~ [ExpectedException(typeof(ArgumentOutOfRangeException))]~\\ +\cellcolor{gray} & & \verb~103~ & & \verb~ public void UpdateByTestMethodIncorrectId()~\\ +\cellcolor{green} & 1 & \verb~104~ & & \verb~ {~\\ +\cellcolor{green} & 1 & \verb~105~ & & \verb~ var repository = LocalIoCContainer.Resolve x.Id == 55);~\\ +\cellcolor{red} & 0 & \verb~110~ & & \verb~ }~\\ +\cellcolor{gray} & & \verb~111~ & & \verb~ }~\\ +\cellcolor{gray} & & \verb~112~ & & \verb~}~\\ +\end{longtable} +\newpage +\section{EntityFramework.Repository6.Tests.TestDbInitializer} +\subsection{Summary} +\begin{longtable}[l]{ll} +\textbf{Class:} & EntityFramework.Repository6.Tests.TestDbInitializer\\ +\textbf{Assembly:} & entityframework.repository6.tests.dll\\ +\textbf{File(s):} & \begin{minipage}[t]{12cm}{orkRepository6\textbackslash EntityFrameworkRepository6Tests\textbackslash SampleData\textbackslash TestDbInitializer.cs}\end{minipage} \\ +\textbf{Covered lines:} & 7\\ +\textbf{Uncovered lines:} & 0\\ +\textbf{Coverable lines:} & 7\\ +\textbf{Total lines:} & 24\\ +\textbf{Line coverage:} & 100\%\\ +\end{longtable} +\subsection{Metrics} +\begin{longtable}[l]{|l|l|l|} +\hline +\textbf{Method} & \textbf{Blocks covered} & \textbf{Blocks not covered}\\ +\hline +\textbf{Seed(PersistentLayer} & 10 & 0\\ +\hline +\end{longtable} +\subsection{File(s)} +\subsubsection{orkRepository6\textbackslash EntityFrameworkRepository6Tests\textbackslash SampleData\textbackslash TestDbInitializer.cs} +\begin{longtable}[l]{lrrll} +\textbf{} & \textbf{\#} & \textbf{Line} & \textbf{} & \textbf{Line coverage}\\ +\cellcolor{gray} & & \verb~1~ & & \verb~using PersistentLayer.Contexts;~\\ +\cellcolor{gray} & & \verb~2~ & & \verb~using PersistentLayer.Entities;~\\ +\cellcolor{gray} & & \verb~3~ & & \verb~using System;~\\ +\cellcolor{gray} & & \verb~4~ & & \verb~using System.Collections.Generic;~\\ +\cellcolor{gray} & & \verb~5~ & & \verb~using System.Data.Entity;~\\ +\cellcolor{gray} & & \verb~6~ & & \verb~using System.Linq;~\\ +\cellcolor{gray} & & \verb~7~ & & \verb~using System.Text;~\\ +\cellcolor{gray} & & \verb~8~ & & \verb~using System.Threading.Tasks;~\\ +\cellcolor{gray} & & \verb~9~ & & \verb~~\\ +\cellcolor{gray} & & \verb~10~ & & \verb~namespace EntityFramework.Repository6.Tests~\\ +\cellcolor{gray} & & \verb~11~ & & \verb~{~\\ +\cellcolor{gray} & & \verb~12~ & & \verb~ public class TestDbInitializer : DropCreateDatabaseAlways Logging { get; set; }~\\ +\cellcolor{gray} & & \verb~18~ & & \verb~~\\ +\cellcolor{gray} & & \verb~19~ & & \verb~ public YourCustomDataContext GetNewDbContext()~\\ +\cellcolor{green} & 1 & \verb~20~ & & \verb~ {~\\ +\cellcolor{green} & 1 & \verb~21~ & & \verb~ var data = new ObjectData();~\\ +\cellcolor{gray} & & \verb~22~ & & \verb~~\\ +\cellcolor{green} & 1 & \verb~23~ & & \verb~ data.Table("SimpleDataEntities").Add(new SimpleD~\\ +\cellcolor{green} & 1 & \verb~24~ & & \verb~ data.Table("SimpleDataEntities").Add(new SimpleD~\\ +\cellcolor{green} & 1 & \verb~25~ & & \verb~ data.Table("SimpleDataEntities").Add(new SimpleD~\\ +\cellcolor{green} & 1 & \verb~26~ & & \verb~ data.Table("SimpleDataEntities").Add(new SimpleD~\\ +\cellcolor{green} & 1 & \verb~27~ & & \verb~ data.Table("SimpleDataEntities").Add(new SimpleD~\\ +\cellcolor{gray} & & \verb~28~ & & \verb~~\\ +\cellcolor{green} & 1 & \verb~29~ & & \verb~ data.Table("SimpleCompositeKeyEntities")~\\ +\cellcolor{gray} & & \verb~30~ & & \verb~~\\ +\cellcolor{green} & 1 & \verb~31~ & & \verb~ var dataLoader = new ObjectDataLoader(data);~\\ +\cellcolor{gray} & & \verb~32~ & & \verb~~\\ +\cellcolor{green} & 1 & \verb~33~ & & \verb~ var connection = Effort.DbConnectionFactory.CreateTransient(dataLo~\\ +\cellcolor{gray} & & \verb~34~ & & \verb~~\\ +\cellcolor{green} & 1 & \verb~35~ & & \verb~ var _context = new YourCustomDataContext(connection);~\\ +\cellcolor{gray} & & \verb~36~ & & \verb~~\\ +\cellcolor{green} & 1 & \verb~37~ & & \verb~ _context.Database.CreateIfNotExists();~\\ +\cellcolor{green} & 1 & \verb~38~ & & \verb~ _context.Database.Initialize(true);~\\ +\cellcolor{gray} & & \verb~39~ & & \verb~~\\ +\cellcolor{green} & 1 & \verb~40~ & & \verb~ if (Logging != null) { _context.Database.Log = Logging; }~\\ +\cellcolor{gray} & & \verb~41~ & & \verb~~\\ +\cellcolor{green} & 1 & \verb~42~ & & \verb~ return _context;~\\ +\cellcolor{green} & 1 & \verb~43~ & & \verb~ }~\\ +\cellcolor{gray} & & \verb~44~ & & \verb~ }~\\ +\cellcolor{gray} & & \verb~45~ & & \verb~}~\\ +\end{longtable} +\newpage +\section{PersistentLayer.Auditable.Contexts.YourCustomDataContext} +\subsection{Summary} +\begin{longtable}[l]{ll} +\textbf{Class:} & PersistentLayer.Auditable.Contexts.YourCustomDataContext\\ +\textbf{Assembly:} & persistentlayer.auditable.dll\\ +\textbf{File(s):} & \begin{minipage}[t]{12cm}{rameworkRepository6\textbackslash PersistentLayerAuditable\textbackslash Contexts\textbackslash YourCustomDataContext.cs}\end{minipage} \\ +\textbf{Covered lines:} & 4\\ +\textbf{Uncovered lines:} & 1\\ +\textbf{Coverable lines:} & 5\\ +\textbf{Total lines:} & 30\\ +\textbf{Line coverage:} & 80\%\\ +\end{longtable} +\subsection{Metrics} +\begin{longtable}[l]{|l|l|l|} +\hline +\textbf{Method} & \textbf{Blocks covered} & \textbf{Blocks not covered}\\ +\hline +\textbf{YourCustomDataContex} & 0 & 2\\ +\hline +\textbf{YourCustomDataContex} & 2 & 0\\ +\hline +\end{longtable} +\subsection{File(s)} +\subsubsection{rameworkRepository6\textbackslash PersistentLayerAuditable\textbackslash Contexts\textbackslash YourCustomDataContext.cs} +\begin{longtable}[l]{lrrll} +\textbf{} & \textbf{\#} & \textbf{Line} & \textbf{} & \textbf{Line coverage}\\ +\cellcolor{gray} & & \verb~1~ & & \verb~using PersistentLayer.Auditable.Entities;~\\ +\cellcolor{gray} & & \verb~2~ & & \verb~using System;~\\ +\cellcolor{gray} & & \verb~3~ & & \verb~using System.Collections.Generic;~\\ +\cellcolor{gray} & & \verb~4~ & & \verb~using System.Data.Entity;~\\ +\cellcolor{gray} & & \verb~5~ & & \verb~using System.Linq;~\\ +\cellcolor{gray} & & \verb~6~ & & \verb~using System.Text;~\\ +\cellcolor{gray} & & \verb~7~ & & \verb~using System.Threading.Tasks;~\\ +\cellcolor{gray} & & \verb~8~ & & \verb~using System.Data.Common;~\\ +\cellcolor{gray} & & \verb~9~ & & \verb~using System.Data.Entity.ModelConfiguration.Conventions;~\\ +\cellcolor{gray} & & \verb~10~ & & \verb~using PersistentLayer.Auditable.Initializers;~\\ +\cellcolor{gray} & & \verb~11~ & & \verb~using EntityFramework.Auditable.Repository6;~\\ +\cellcolor{gray} & & \verb~12~ & & \verb~~\\ +\cellcolor{gray} & & \verb~13~ & & \verb~namespace PersistentLayer.Auditable.Contexts~\\ +\cellcolor{gray} & & \verb~14~ & & \verb~{~\\ +\cellcolor{gray} & & \verb~15~ & & \verb~ public class YourCustomDataContext : AuditableBaseContext SimpleDataEntities { get; set; }~\\ +\cellcolor{green} & 1 & \verb~18~ & & \verb~ public DbSet SimpleCompositeKeyEntities { ge~\\ +\cellcolor{green} & 1 & \verb~19~ & & \verb~ public DbSet SimpleDataEntityAudits { get; set;~\\ +\cellcolor{gray} & & \verb~20~ & & \verb~~\\ +\cellcolor{gray} & & \verb~21~ & & \verb~~\\ +\cellcolor{red} & 0 & \verb~22~ & & \verb~ public YourCustomDataContext(string connectionString) : base(connectio~\\ +\cellcolor{green} & 1 & \verb~23~ & & \verb~ public YourCustomDataContext(DbConnection dbConnection) : base(dbConne~\\ +\cellcolor{gray} & & \verb~24~ & & \verb~~\\ +\cellcolor{gray} & & \verb~25~ & & \verb~ //protected override void OnModelCreating(DbModelBuilder modelBuilder)~\\ +\cellcolor{gray} & & \verb~26~ & & \verb~ //{~\\ +\cellcolor{gray} & & \verb~27~ & & \verb~ // modelBuilder.Conventions.Remove(~\\ +\cellcolor{gray} & & \verb~28~ & & \verb~ //}~\\ +\cellcolor{gray} & & \verb~29~ & & \verb~ }~\\ +\cellcolor{gray} & & \verb~30~ & & \verb~}~\\ +\end{longtable} +\newpage +\section{PersistentLayer.Auditable.Entities.PersistentEntity} +\subsection{Summary} +\begin{longtable}[l]{ll} +\textbf{Class:} & PersistentLayer.Auditable.Entities.PersistentEntity\\ +\textbf{Assembly:} & persistentlayer.auditable.dll\\ +\textbf{File(s):} & \begin{minipage}[t]{12cm}{tityFrameworkRepository6\textbackslash PersistentLayerAuditable\textbackslash Entities\textbackslash PersistentEntity.cs}\end{minipage} \\ +\textbf{Covered lines:} & 0\\ +\textbf{Uncovered lines:} & 1\\ +\textbf{Coverable lines:} & 1\\ +\textbf{Total lines:} & 13\\ +\textbf{Line coverage:} & 0\%\\ +\end{longtable} +\subsection{File(s)} +\subsubsection{tityFrameworkRepository6\textbackslash PersistentLayerAuditable\textbackslash Entities\textbackslash PersistentEntity.cs} +\begin{longtable}[l]{lrrll} +\textbf{} & \textbf{\#} & \textbf{Line} & \textbf{} & \textbf{Line coverage}\\ +\cellcolor{gray} & & \verb~1~ & & \verb~using System;~\\ +\cellcolor{gray} & & \verb~2~ & & \verb~using System.Collections.Generic;~\\ +\cellcolor{gray} & & \verb~3~ & & \verb~using System.Linq;~\\ +\cellcolor{gray} & & \verb~4~ & & \verb~using System.Text;~\\ +\cellcolor{gray} & & \verb~5~ & & \verb~using System.Threading.Tasks;~\\ +\cellcolor{gray} & & \verb~6~ & & \verb~~\\ +\cellcolor{gray} & & \verb~7~ & & \verb~namespace PersistentLayer.Auditable.Entities~\\ +\cellcolor{gray} & & \verb~8~ & & \verb~{~\\ +\cellcolor{gray} & & \verb~9~ & & \verb~ public abstract class PersistentEntity~\\ +\cellcolor{gray} & & \verb~10~ & & \verb~ {~\\ +\cellcolor{red} & 0 & \verb~11~ & & \verb~ public int Id { get; set; }~\\ +\cellcolor{gray} & & \verb~12~ & & \verb~ }~\\ +\cellcolor{gray} & & \verb~13~ & & \verb~}~\\ +\end{longtable} +\newpage +\section{PersistentLayer.Auditable.Entities.SimpleCompositeKeyEntity} +\subsection{Summary} +\begin{longtable}[l]{ll} +\textbf{Class:} & PersistentLayer.Auditable.Entities.SimpleCompositeKeyEntity\\ +\textbf{Assembly:} & persistentlayer.auditable.dll\\ +\textbf{File(s):} & \begin{minipage}[t]{12cm}{eworkRepository6\textbackslash PersistentLayerAuditable\textbackslash Entities\textbackslash SimpleCompositeKeyEntity.cs}\end{minipage} \\ +\textbf{Covered lines:} & 2\\ +\textbf{Uncovered lines:} & 0\\ +\textbf{Coverable lines:} & 2\\ +\textbf{Total lines:} & 20\\ +\textbf{Line coverage:} & 100\%\\ +\end{longtable} +\subsection{File(s)} +\subsubsection{eworkRepository6\textbackslash PersistentLayerAuditable\textbackslash Entities\textbackslash SimpleCompositeKeyEntity.cs} +\begin{longtable}[l]{lrrll} +\textbf{} & \textbf{\#} & \textbf{Line} & \textbf{} & \textbf{Line coverage}\\ +\cellcolor{gray} & & \verb~1~ & & \verb~using System;~\\ +\cellcolor{gray} & & \verb~2~ & & \verb~using System.Collections.Generic;~\\ +\cellcolor{gray} & & \verb~3~ & & \verb~using System.ComponentModel.DataAnnotations;~\\ +\cellcolor{gray} & & \verb~4~ & & \verb~using System.ComponentModel.DataAnnotations.Schema;~\\ +\cellcolor{gray} & & \verb~5~ & & \verb~using System.Linq;~\\ +\cellcolor{gray} & & \verb~6~ & & \verb~using System.Text;~\\ +\cellcolor{gray} & & \verb~7~ & & \verb~using System.Threading.Tasks;~\\ +\cellcolor{gray} & & \verb~8~ & & \verb~~\\ +\cellcolor{gray} & & \verb~9~ & & \verb~namespace PersistentLayer.Auditable.Entities~\\ +\cellcolor{gray} & & \verb~10~ & & \verb~{~\\ +\cellcolor{gray} & & \verb~11~ & & \verb~ public class SimpleCompositeKeyEntity~\\ +\cellcolor{gray} & & \verb~12~ & & \verb~ {~\\ +\cellcolor{gray} & & \verb~13~ & & \verb~ [Key]~\\ +\cellcolor{gray} & & \verb~14~ & & \verb~ [Column(Order = 1)]~\\ +\cellcolor{green} & 1 & \verb~15~ & & \verb~ public int Id { get; set; }~\\ +\cellcolor{gray} & & \verb~16~ & & \verb~ [Key]~\\ +\cellcolor{gray} & & \verb~17~ & & \verb~ [Column(Order = 2)]~\\ +\cellcolor{green} & 1 & \verb~18~ & & \verb~ public string Name { get; set; }~\\ +\cellcolor{gray} & & \verb~19~ & & \verb~ }~\\ +\cellcolor{gray} & & \verb~20~ & & \verb~}~\\ +\end{longtable} +\newpage +\section{PersistentLayer.Auditable.Entities.SimpleDataEntity} +\subsection{Summary} +\begin{longtable}[l]{ll} +\textbf{Class:} & PersistentLayer.Auditable.Entities.SimpleDataEntity\\ +\textbf{Assembly:} & persistentlayer.auditable.dll\\ +\textbf{File(s):} & \begin{minipage}[t]{12cm}{tityFrameworkRepository6\textbackslash PersistentLayerAuditable\textbackslash Entities\textbackslash SimpleDataEntity.cs}\end{minipage} \\ +\textbf{Covered lines:} & 2\\ +\textbf{Uncovered lines:} & 0\\ +\textbf{Coverable lines:} & 2\\ +\textbf{Total lines:} & 13\\ +\textbf{Line coverage:} & 100\%\\ +\end{longtable} +\subsection{File(s)} +\subsubsection{tityFrameworkRepository6\textbackslash PersistentLayerAuditable\textbackslash Entities\textbackslash SimpleDataEntity.cs} +\begin{longtable}[l]{lrrll} +\textbf{} & \textbf{\#} & \textbf{Line} & \textbf{} & \textbf{Line coverage}\\ +\cellcolor{gray} & & \verb~1~ & & \verb~using EntityFramework.Auditing;~\\ +\cellcolor{gray} & & \verb~2~ & & \verb~using System.ComponentModel.DataAnnotations;~\\ +\cellcolor{gray} & & \verb~3~ & & \verb~using System.ComponentModel.DataAnnotations.Schema;~\\ +\cellcolor{gray} & & \verb~4~ & & \verb~~\\ +\cellcolor{gray} & & \verb~5~ & & \verb~namespace PersistentLayer.Auditable.Entities~\\ +\cellcolor{gray} & & \verb~6~ & & \verb~{~\\ +\cellcolor{gray} & & \verb~7~ & & \verb~ public class SimpleDataEntity : AuditableEntity~\\ +\cellcolor{gray} & & \verb~8~ & & \verb~ {~\\ +\cellcolor{gray} & & \verb~9~ & & \verb~ [Key, DatabaseGenerated(DatabaseGeneratedOption.Identity)]~\\ +\cellcolor{green} & 1 & \verb~10~ & & \verb~ public virtual int Id { get; set; }~\\ +\cellcolor{green} & 1 & \verb~11~ & & \verb~ public string Name { get; set; }~\\ +\cellcolor{gray} & & \verb~12~ & & \verb~ }~\\ +\cellcolor{gray} & & \verb~13~ & & \verb~}~\\ +\end{longtable} +\newpage +\section{PersistentLayer.Auditable.Entities.SimpleDataEntityAudit} +\subsection{Summary} +\begin{longtable}[l]{ll} +\textbf{Class:} & PersistentLayer.Auditable.Entities.SimpleDataEntityAudit\\ +\textbf{Assembly:} & persistentlayer.auditable.dll\\ +\textbf{File(s):} & \begin{minipage}[t]{12cm}{rameworkRepository6\textbackslash PersistentLayerAuditable\textbackslash Entities\textbackslash SimpleDataAuditEntity.cs}\end{minipage} \\ +\textbf{Covered lines:} & 3\\ +\textbf{Uncovered lines:} & 0\\ +\textbf{Coverable lines:} & 3\\ +\textbf{Total lines:} & 16\\ +\textbf{Line coverage:} & 100\%\\ +\end{longtable} +\subsection{File(s)} +\subsubsection{rameworkRepository6\textbackslash PersistentLayerAuditable\textbackslash Entities\textbackslash SimpleDataAuditEntity.cs} +\begin{longtable}[l]{lrrll} +\textbf{} & \textbf{\#} & \textbf{Line} & \textbf{} & \textbf{Line coverage}\\ +\cellcolor{gray} & & \verb~1~ & & \verb~using EntityFramework.Auditing;~\\ +\cellcolor{gray} & & \verb~2~ & & \verb~using System.ComponentModel.DataAnnotations;~\\ +\cellcolor{gray} & & \verb~3~ & & \verb~using System.ComponentModel.DataAnnotations.Schema;~\\ +\cellcolor{gray} & & \verb~4~ & & \verb~~\\ +\cellcolor{gray} & & \verb~5~ & & \verb~namespace PersistentLayer.Auditable.Entities~\\ +\cellcolor{gray} & & \verb~6~ & & \verb~{~\\ +\cellcolor{gray} & & \verb~7~ & & \verb~ public class SimpleDataEntityAudit : AuditEntity~\\ +\cellcolor{gray} & & \verb~8~ & & \verb~ {~\\ +\cellcolor{gray} & & \verb~9~ & & \verb~ [Key, DatabaseGenerated(DatabaseGeneratedOption.Identity)]~\\ +\cellcolor{green} & 1 & \verb~10~ & & \verb~ public int Id { get; set; }~\\ +\cellcolor{gray} & & \verb~11~ & & \verb~~\\ +\cellcolor{green} & 1 & \verb~12~ & & \verb~ public override int AuditSourceId { get; set; }~\\ +\cellcolor{gray} & & \verb~13~ & & \verb~~\\ +\cellcolor{green} & 1 & \verb~14~ & & \verb~ public string Name { get; set; }~\\ +\cellcolor{gray} & & \verb~15~ & & \verb~ }~\\ +\cellcolor{gray} & & \verb~16~ & & \verb~}~\\ +\end{longtable} +\newpage +\section{PersistentLayer.Auditable.Initializers.MyDbInitializer} +\subsection{Summary} +\begin{longtable}[l]{ll} +\textbf{Class:} & PersistentLayer.Auditable.Initializers.MyDbInitializer\\ +\textbf{Assembly:} & persistentlayer.auditable.dll\\ +\textbf{File(s):} & \begin{minipage}[t]{12cm}{yFrameworkRepository6\textbackslash PersistentLayerAuditable\textbackslash Initializers\textbackslash MyDbInitializer.cs}\end{minipage} \\ +\textbf{Covered lines:} & 0\\ +\textbf{Uncovered lines:} & 7\\ +\textbf{Coverable lines:} & 7\\ +\textbf{Total lines:} & 24\\ +\textbf{Line coverage:} & 0\%\\ +\end{longtable} +\subsection{Metrics} +\begin{longtable}[l]{|l|l|l|} +\hline +\textbf{Method} & \textbf{Blocks covered} & \textbf{Blocks not covered}\\ +\hline +\textbf{Seed(PersistentLayer} & 0 & 10\\ +\hline +\end{longtable} +\subsection{File(s)} +\subsubsection{yFrameworkRepository6\textbackslash PersistentLayerAuditable\textbackslash Initializers\textbackslash MyDbInitializer.cs} +\begin{longtable}[l]{lrrll} +\textbf{} & \textbf{\#} & \textbf{Line} & \textbf{} & \textbf{Line coverage}\\ +\cellcolor{gray} & & \verb~1~ & & \verb~using PersistentLayer.Auditable.Contexts;~\\ +\cellcolor{gray} & & \verb~2~ & & \verb~using PersistentLayer.Auditable.Entities;~\\ +\cellcolor{gray} & & \verb~3~ & & \verb~using System;~\\ +\cellcolor{gray} & & \verb~4~ & & \verb~using System.Collections.Generic;~\\ +\cellcolor{gray} & & \verb~5~ & & \verb~using System.Data.Entity;~\\ +\cellcolor{gray} & & \verb~6~ & & \verb~using System.Linq;~\\ +\cellcolor{gray} & & \verb~7~ & & \verb~using System.Text;~\\ +\cellcolor{gray} & & \verb~8~ & & \verb~using System.Threading.Tasks;~\\ +\cellcolor{gray} & & \verb~9~ & & \verb~~\\ +\cellcolor{gray} & & \verb~10~ & & \verb~namespace PersistentLayer.Auditable.Initializers~\\ +\cellcolor{gray} & & \verb~11~ & & \verb~{~\\ +\cellcolor{gray} & & \verb~12~ & & \verb~ public class MyDbInitializer : DropCreateDatabaseIfModelChanges~\\ +\cellcolor{gray} & & \verb~16~ & & \verb~ {~\\ +\cellcolor{green} & 1 & \verb~17~ & & \verb~ public DbSet SimpleDataEntities { get; set; }~\\ +\cellcolor{green} & 1 & \verb~18~ & & \verb~ public DbSet SimpleCompositeKeyEntities { ge~\\ +\cellcolor{gray} & & \verb~19~ & & \verb~~\\ +\cellcolor{gray} & & \verb~20~ & & \verb~~\\ +\cellcolor{red} & 0 & \verb~21~ & & \verb~ public YourCustomDataContext(string connectionString) : base(connectio~\\ +\cellcolor{green} & 1 & \verb~22~ & & \verb~ public YourCustomDataContext(DbConnection dbConnection) : base(dbConne~\\ +\cellcolor{gray} & & \verb~23~ & & \verb~~\\ +\cellcolor{gray} & & \verb~24~ & & \verb~ //protected override void OnModelCreating(DbModelBuilder modelBuilder)~\\ +\cellcolor{gray} & & \verb~25~ & & \verb~ //{~\\ +\cellcolor{gray} & & \verb~26~ & & \verb~ // modelBuilder.Conventions.Remove(~\\ +\cellcolor{gray} & & \verb~27~ & & \verb~ //}~\\ +\cellcolor{gray} & & \verb~28~ & & \verb~ }~\\ +\cellcolor{gray} & & \verb~29~ & & \verb~}~\\ +\end{longtable} +\newpage +\section{PersistentLayer.Entities.PersistentEntity} +\subsection{Summary} +\begin{longtable}[l]{ll} +\textbf{Class:} & PersistentLayer.Entities.PersistentEntity\\ +\textbf{Assembly:} & persistentlayer.dll\\ +\textbf{File(s):} & \begin{minipage}[t]{12cm}{opment\textbackslash EntityFrameworkRepository6\textbackslash PersistentLayer\textbackslash Entities\textbackslash PersistentEntity.cs}\end{minipage} \\ +\textbf{Covered lines:} & 1\\ +\textbf{Uncovered lines:} & 0\\ +\textbf{Coverable lines:} & 1\\ +\textbf{Total lines:} & 13\\ +\textbf{Line coverage:} & 100\%\\ +\end{longtable} +\subsection{File(s)} +\subsubsection{opment\textbackslash EntityFrameworkRepository6\textbackslash PersistentLayer\textbackslash Entities\textbackslash PersistentEntity.cs} +\begin{longtable}[l]{lrrll} +\textbf{} & \textbf{\#} & \textbf{Line} & \textbf{} & \textbf{Line coverage}\\ +\cellcolor{gray} & & \verb~1~ & & \verb~using System;~\\ +\cellcolor{gray} & & \verb~2~ & & \verb~using System.Collections.Generic;~\\ +\cellcolor{gray} & & \verb~3~ & & \verb~using System.Linq;~\\ +\cellcolor{gray} & & \verb~4~ & & \verb~using System.Text;~\\ +\cellcolor{gray} & & \verb~5~ & & \verb~using System.Threading.Tasks;~\\ +\cellcolor{gray} & & \verb~6~ & & \verb~~\\ +\cellcolor{gray} & & \verb~7~ & & \verb~namespace PersistentLayer.Entities~\\ +\cellcolor{gray} & & \verb~8~ & & \verb~{~\\ +\cellcolor{gray} & & \verb~9~ & & \verb~ public abstract class PersistentEntity~\\ +\cellcolor{gray} & & \verb~10~ & & \verb~ {~\\ +\cellcolor{green} & 1 & \verb~11~ & & \verb~ public int Id { get; set; }~\\ +\cellcolor{gray} & & \verb~12~ & & \verb~ }~\\ +\cellcolor{gray} & & \verb~13~ & & \verb~}~\\ +\end{longtable} +\newpage +\section{PersistentLayer.Entities.SimpleCompositeKeyEntity} +\subsection{Summary} +\begin{longtable}[l]{ll} +\textbf{Class:} & PersistentLayer.Entities.SimpleCompositeKeyEntity\\ +\textbf{Assembly:} & persistentlayer.dll\\ +\textbf{File(s):} & \begin{minipage}[t]{12cm}{ntityFrameworkRepository6\textbackslash PersistentLayer\textbackslash Entities\textbackslash SimpleCompositeKeyEntity.cs}\end{minipage} \\ +\textbf{Covered lines:} & 2\\ +\textbf{Uncovered lines:} & 0\\ +\textbf{Coverable lines:} & 2\\ +\textbf{Total lines:} & 20\\ +\textbf{Line coverage:} & 100\%\\ +\end{longtable} +\subsection{File(s)} +\subsubsection{ntityFrameworkRepository6\textbackslash PersistentLayer\textbackslash Entities\textbackslash SimpleCompositeKeyEntity.cs} +\begin{longtable}[l]{lrrll} +\textbf{} & \textbf{\#} & \textbf{Line} & \textbf{} & \textbf{Line coverage}\\ +\cellcolor{gray} & & \verb~1~ & & \verb~using System;~\\ +\cellcolor{gray} & & \verb~2~ & & \verb~using System.Collections.Generic;~\\ +\cellcolor{gray} & & \verb~3~ & & \verb~using System.ComponentModel.DataAnnotations;~\\ +\cellcolor{gray} & & \verb~4~ & & \verb~using System.ComponentModel.DataAnnotations.Schema;~\\ +\cellcolor{gray} & & \verb~5~ & & \verb~using System.Linq;~\\ +\cellcolor{gray} & & \verb~6~ & & \verb~using System.Text;~\\ +\cellcolor{gray} & & \verb~7~ & & \verb~using System.Threading.Tasks;~\\ +\cellcolor{gray} & & \verb~8~ & & \verb~~\\ +\cellcolor{gray} & & \verb~9~ & & \verb~namespace PersistentLayer.Entities~\\ +\cellcolor{gray} & & \verb~10~ & & \verb~{~\\ +\cellcolor{gray} & & \verb~11~ & & \verb~ public class SimpleCompositeKeyEntity~\\ +\cellcolor{gray} & & \verb~12~ & & \verb~ {~\\ +\cellcolor{gray} & & \verb~13~ & & \verb~ [Key]~\\ +\cellcolor{gray} & & \verb~14~ & & \verb~ [Column(Order = 1)]~\\ +\cellcolor{green} & 1 & \verb~15~ & & \verb~ public int Id { get; set; }~\\ +\cellcolor{gray} & & \verb~16~ & & \verb~ [Key]~\\ +\cellcolor{gray} & & \verb~17~ & & \verb~ [Column(Order = 2)]~\\ +\cellcolor{green} & 1 & \verb~18~ & & \verb~ public string Name { get; set; }~\\ +\cellcolor{gray} & & \verb~19~ & & \verb~ }~\\ +\cellcolor{gray} & & \verb~20~ & & \verb~}~\\ +\end{longtable} +\newpage +\section{PersistentLayer.Entities.SimpleDataEntity} +\subsection{Summary} +\begin{longtable}[l]{ll} +\textbf{Class:} & PersistentLayer.Entities.SimpleDataEntity\\ +\textbf{Assembly:} & persistentlayer.dll\\ +\textbf{File(s):} & \begin{minipage}[t]{12cm}{opment\textbackslash EntityFrameworkRepository6\textbackslash PersistentLayer\textbackslash Entities\textbackslash SimpleDataEntity.cs}\end{minipage} \\ +\textbf{Covered lines:} & 1\\ +\textbf{Uncovered lines:} & 0\\ +\textbf{Coverable lines:} & 1\\ +\textbf{Total lines:} & 7\\ +\textbf{Line coverage:} & 100\%\\ +\end{longtable} +\subsection{File(s)} +\subsubsection{opment\textbackslash EntityFrameworkRepository6\textbackslash PersistentLayer\textbackslash Entities\textbackslash SimpleDataEntity.cs} +\begin{longtable}[l]{lrrll} +\textbf{} & \textbf{\#} & \textbf{Line} & \textbf{} & \textbf{Line coverage}\\ +\cellcolor{gray} & & \verb~1~ & & \verb~namespace PersistentLayer.Entities~\\ +\cellcolor{gray} & & \verb~2~ & & \verb~{~\\ +\cellcolor{gray} & & \verb~3~ & & \verb~ public class SimpleDataEntity : PersistentEntity~\\ +\cellcolor{gray} & & \verb~4~ & & \verb~ {~\\ +\cellcolor{green} & 1 & \verb~5~ & & \verb~ public string Name { get; set; }~\\ +\cellcolor{gray} & & \verb~6~ & & \verb~ }~\\ +\cellcolor{gray} & & \verb~7~ & & \verb~}~\\ +\end{longtable} +\newpage +\section{PersistentLayer.Initializers.MyDbInitializer} +\subsection{Summary} +\begin{longtable}[l]{ll} +\textbf{Class:} & PersistentLayer.Initializers.MyDbInitializer\\ +\textbf{Assembly:} & persistentlayer.dll\\ +\textbf{File(s):} & \begin{minipage}[t]{12cm}{ent\textbackslash EntityFrameworkRepository6\textbackslash PersistentLayer\textbackslash Initializers\textbackslash MyDbInitializer.cs}\end{minipage} \\ +\textbf{Covered lines:} & 0\\ +\textbf{Uncovered lines:} & 7\\ +\textbf{Coverable lines:} & 7\\ +\textbf{Total lines:} & 24\\ +\textbf{Line coverage:} & 0\%\\ +\end{longtable} +\subsection{Metrics} +\begin{longtable}[l]{|l|l|l|} +\hline +\textbf{Method} & \textbf{Blocks covered} & \textbf{Blocks not covered}\\ +\hline +\textbf{Seed(PersistentLayer} & 0 & 10\\ +\hline +\end{longtable} +\subsection{File(s)} +\subsubsection{ent\textbackslash EntityFrameworkRepository6\textbackslash PersistentLayer\textbackslash Initializers\textbackslash MyDbInitializer.cs} +\begin{longtable}[l]{lrrll} +\textbf{} & \textbf{\#} & \textbf{Line} & \textbf{} & \textbf{Line coverage}\\ +\cellcolor{gray} & & \verb~1~ & & \verb~using PersistentLayer.Contexts;~\\ +\cellcolor{gray} & & \verb~2~ & & \verb~using PersistentLayer.Entities;~\\ +\cellcolor{gray} & & \verb~3~ & & \verb~using System;~\\ +\cellcolor{gray} & & \verb~4~ & & \verb~using System.Collections.Generic;~\\ +\cellcolor{gray} & & \verb~5~ & & \verb~using System.Data.Entity;~\\ +\cellcolor{gray} & & \verb~6~ & & \verb~using System.Linq;~\\ +\cellcolor{gray} & & \verb~7~ & & \verb~using System.Text;~\\ +\cellcolor{gray} & & \verb~8~ & & \verb~using System.Threading.Tasks;~\\ +\cellcolor{gray} & & \verb~9~ & & \verb~~\\ +\cellcolor{gray} & & \verb~10~ & & \verb~namespace PersistentLayer.Initializers~\\ +\cellcolor{gray} & & \verb~11~ & & \verb~{~\\ +\cellcolor{gray} & & \verb~12~ & & \verb~ public class MyDbInitializer : DropCreateDatabaseIfModelChanges - Generated by: ReportGenerator 2.5.2.0 + Generated by: ReportGenerator 2.5.5.0 Coverage Coverage - 83.7%83.7% + 89.1%89.1% diff --git a/CodeCoverageReport/combined.js b/CodeCoverageReport/combined.js index dbafd14..43f6003 100644 --- a/CodeCoverageReport/combined.js +++ b/CodeCoverageReport/combined.js @@ -311,12 +311,35 @@ window.matchMedia || (window.matchMedia = function() { var assemblies = [ + { + "name" : "entityframework.auditable.repository6.dll", + "classes" : [ + { "name" : "EntityFramework.Auditable.Repository6.AuditableBaseContext", "reportPath" : "entityframework.auditable.repository6.dll_AuditableBaseContext_TContext_.htm", "coveredLines" : 2, "uncoveredLines" : 5, "coverableLines" : 7, "totalLines" : 24, "coverageType" : "LineCoverage", "methodCoverage" : "-", "coveredBranches" : 0, "totalBranches" : 0, "lineCoverageHistory" : [], "branchCoverageHistory" : [] }, + { "name" : "EntityFramework.Auditable.Repository6.AuditableBaseRepository", "reportPath" : "entityframework.auditable.repository6.dll_AuditableBaseRepository.htm", "coveredLines" : 0, "uncoveredLines" : 3, "coverableLines" : 3, "totalLines" : 31, "coverageType" : "LineCoverage", "methodCoverage" : "-", "coveredBranches" : 0, "totalBranches" : 0, "lineCoverageHistory" : [], "branchCoverageHistory" : [] }, + { "name" : "EntityFramework.Auditable.Repository6.AuditableBaseRepository", "reportPath" : "entityframework.auditable.repository6.dll_AuditableBaseRepository_C__T_.htm", "coveredLines" : 6, "uncoveredLines" : 0, "coverableLines" : 6, "totalLines" : 31, "coverageType" : "LineCoverage", "methodCoverage" : "-", "coveredBranches" : 0, "totalBranches" : 0, "lineCoverageHistory" : [], "branchCoverageHistory" : [] }, + { "name" : "EntityFramework.Repository6.BaseContext", "reportPath" : "entityframework.auditable.repository6.dll_BaseContext_TContext_.htm", "coveredLines" : 0, "uncoveredLines" : 7, "coverableLines" : 7, "totalLines" : 23, "coverageType" : "LineCoverage", "methodCoverage" : "-", "coveredBranches" : 0, "totalBranches" : 0, "lineCoverageHistory" : [], "branchCoverageHistory" : [] }, + { "name" : "EntityFramework.Repository6.BaseRepository", "reportPath" : "entityframework.auditable.repository6.dll_BaseRepository.htm", "coveredLines" : 12, "uncoveredLines" : 7, "coverableLines" : 19, "totalLines" : 241, "coverageType" : "LineCoverage", "methodCoverage" : "-", "coveredBranches" : 0, "totalBranches" : 0, "lineCoverageHistory" : [], "branchCoverageHistory" : [] }, + { "name" : "EntityFramework.Repository6.BaseRepository", "reportPath" : "entityframework.auditable.repository6.dll_BaseRepository_C__T_.htm", "coveredLines" : 119, "uncoveredLines" : 4, "coverableLines" : 123, "totalLines" : 241, "coverageType" : "LineCoverage", "methodCoverage" : "-", "coveredBranches" : 0, "totalBranches" : 0, "lineCoverageHistory" : [], "branchCoverageHistory" : [] }, + { "name" : "EntityFramework.Repository6.DatabaseFactory", "reportPath" : "entityframework.auditable.repository6.dll_DatabaseFactory_C_.htm", "coveredLines" : 0, "uncoveredLines" : 11, "coverableLines" : 11, "totalLines" : 33, "coverageType" : "LineCoverage", "methodCoverage" : "-", "coveredBranches" : 0, "totalBranches" : 0, "lineCoverageHistory" : [], "branchCoverageHistory" : [] }, + { "name" : "EntityFramework.Repository6.Delta", "reportPath" : "entityframework.auditable.repository6.dll_Delta_T_.htm", "coveredLines" : 23, "uncoveredLines" : 0, "coverableLines" : 23, "totalLines" : 43, "coverageType" : "LineCoverage", "methodCoverage" : "-", "coveredBranches" : 0, "totalBranches" : 0, "lineCoverageHistory" : [], "branchCoverageHistory" : [] }, + ]}, + { + "name" : "entityframework.auditable.repository6.tests.dll", + "classes" : [ + { "name" : "EntityFramework.Auditable.Repository6.Tests.RepositoryCreateTests", "reportPath" : "entityframework.auditable.repository6.tests.dll_RepositoryCreateTests.htm", "coveredLines" : 80, "uncoveredLines" : 1, "coverableLines" : 81, "totalLines" : 168, "coverageType" : "LineCoverage", "methodCoverage" : "-", "coveredBranches" : 0, "totalBranches" : 0, "lineCoverageHistory" : [], "branchCoverageHistory" : [] }, + { "name" : "EntityFramework.Auditable.Repository6.Tests.RepositoryDeleteTests", "reportPath" : "entityframework.auditable.repository6.tests.dll_RepositoryDeleteTests.htm", "coveredLines" : 32, "uncoveredLines" : 0, "coverableLines" : 32, "totalLines" : 88, "coverageType" : "LineCoverage", "methodCoverage" : "-", "coveredBranches" : 0, "totalBranches" : 0, "lineCoverageHistory" : [], "branchCoverageHistory" : [] }, + { "name" : "EntityFramework.Auditable.Repository6.Tests.RepositoryReadTests", "reportPath" : "entityframework.auditable.repository6.tests.dll_RepositoryReadTests.htm", "coveredLines" : 78, "uncoveredLines" : 0, "coverableLines" : 78, "totalLines" : 182, "coverageType" : "LineCoverage", "methodCoverage" : "-", "coveredBranches" : 0, "totalBranches" : 0, "lineCoverageHistory" : [], "branchCoverageHistory" : [] }, + { "name" : "EntityFramework.Auditable.Repository6.Tests.RepositoryUpdateTests", "reportPath" : "entityframework.auditable.repository6.tests.dll_RepositoryUpdateTests.htm", "coveredLines" : 61, "uncoveredLines" : 1, "coverableLines" : 62, "totalLines" : 142, "coverageType" : "LineCoverage", "methodCoverage" : "-", "coveredBranches" : 0, "totalBranches" : 0, "lineCoverageHistory" : [], "branchCoverageHistory" : [] }, + { "name" : "EntityFramework.Auditable.Repository6.Tests.TestDbInitializer", "reportPath" : "entityframework.auditable.repository6.tests.dll_TestDbInitializer.htm", "coveredLines" : 7, "uncoveredLines" : 0, "coverableLines" : 7, "totalLines" : 24, "coverageType" : "LineCoverage", "methodCoverage" : "-", "coveredBranches" : 0, "totalBranches" : 0, "lineCoverageHistory" : [], "branchCoverageHistory" : [] }, + { "name" : "EntityFramework.Auditable.Repository6.Tests.TestExampleDatabaseFactory", "reportPath" : "entityframework.auditable.repository6.tests.dll_TestExampleDatabaseFactory.htm", "coveredLines" : 17, "uncoveredLines" : 0, "coverableLines" : 17, "totalLines" : 45, "coverageType" : "LineCoverage", "methodCoverage" : "-", "coveredBranches" : 0, "totalBranches" : 0, "lineCoverageHistory" : [], "branchCoverageHistory" : [] }, + { "name" : "EntityFramework.Repository6.Tests.DeltaTests", "reportPath" : "entityframework.auditable.repository6.tests.dll_DeltaTests.htm", "coveredLines" : 64, "uncoveredLines" : 4, "coverableLines" : 68, "totalLines" : 144, "coverageType" : "LineCoverage", "methodCoverage" : "-", "coveredBranches" : 0, "totalBranches" : 0, "lineCoverageHistory" : [], "branchCoverageHistory" : [] }, + ]}, { "name" : "entityframework.auditing.dll", "classes" : [ { "name" : "EntityFramework.Auditing.AuditableEntity", "reportPath" : "entityframework.auditing.dll_AuditableEntity.htm", "coveredLines" : 2, "uncoveredLines" : 0, "coverableLines" : 2, "totalLines" : 35, "coverageType" : "LineCoverage", "methodCoverage" : "-", "coveredBranches" : 0, "totalBranches" : 0, "lineCoverageHistory" : [], "branchCoverageHistory" : [] }, { "name" : "EntityFramework.Auditing.AuditConfigurationSection", "reportPath" : "entityframework.auditing.dll_AuditConfigurationSection.htm", "coveredLines" : 6, "uncoveredLines" : 3, "coverableLines" : 9, "totalLines" : 42, "coverageType" : "LineCoverage", "methodCoverage" : "-", "coveredBranches" : 0, "totalBranches" : 0, "lineCoverageHistory" : [], "branchCoverageHistory" : [] }, - { "name" : "EntityFramework.Auditing.AuditDbContext", "reportPath" : "entityframework.auditing.dll_AuditDbContext.htm", "coveredLines" : 178, "uncoveredLines" : 38, "coverableLines" : 216, "totalLines" : 430, "coverageType" : "LineCoverage", "methodCoverage" : "-", "coveredBranches" : 0, "totalBranches" : 0, "lineCoverageHistory" : [], "branchCoverageHistory" : [] }, + { "name" : "EntityFramework.Auditing.AuditDbContext", "reportPath" : "entityframework.auditing.dll_AuditDbContext.htm", "coveredLines" : 157, "uncoveredLines" : 30, "coverableLines" : 187, "totalLines" : 400, "coverageType" : "LineCoverage", "methodCoverage" : "-", "coveredBranches" : 0, "totalBranches" : 0, "lineCoverageHistory" : [], "branchCoverageHistory" : [] }, { "name" : "EntityFramework.Auditing.AuditEntity", "reportPath" : "entityframework.auditing.dll_AuditEntity.htm", "coveredLines" : 6, "uncoveredLines" : 0, "coverableLines" : 6, "totalLines" : 55, "coverageType" : "LineCoverage", "methodCoverage" : "-", "coveredBranches" : 0, "totalBranches" : 0, "lineCoverageHistory" : [], "branchCoverageHistory" : [] }, { "name" : "EntityFramework.Auditing.AuditTypeInfo", "reportPath" : "entityframework.auditing.dll_AuditTypeInfo.htm", "coveredLines" : 7, "uncoveredLines" : 0, "coverableLines" : 7, "totalLines" : 33, "coverageType" : "LineCoverage", "methodCoverage" : "-", "coveredBranches" : 0, "totalBranches" : 0, "lineCoverageHistory" : [], "branchCoverageHistory" : [] }, { "name" : "EntityFramework.Auditing.EntityElement", "reportPath" : "entityframework.auditing.dll_EntityElement.htm", "coveredLines" : 6, "uncoveredLines" : 6, "coverableLines" : 12, "totalLines" : 45, "coverageType" : "LineCoverage", "methodCoverage" : "-", "coveredBranches" : 0, "totalBranches" : 0, "lineCoverageHistory" : [], "branchCoverageHistory" : [] }, @@ -331,42 +354,36 @@ var assemblies = [ { "name" : "EntityFramework.Auditing.Test.CustomerAudit", "reportPath" : "entityframework.auditing.test.dll_CustomerAudit.htm", "coveredLines" : 2, "uncoveredLines" : 0, "coverableLines" : 2, "totalLines" : 25, "coverageType" : "LineCoverage", "methodCoverage" : "-", "coveredBranches" : 0, "totalBranches" : 0, "lineCoverageHistory" : [], "branchCoverageHistory" : [] }, ]}, { - "name" : "entityframeworkauditablerepository6.dll", + "name" : "entityframework.repository6.dll", "classes" : [ - { "name" : "EntityFrameworkAuditableRepository6.Base.BaseContext", "reportPath" : "entityframeworkauditablerepository6.dll_BaseContext_TContext_.htm", "coveredLines" : 3, "uncoveredLines" : 9, "coverableLines" : 12, "totalLines" : 29, "coverageType" : "LineCoverage", "methodCoverage" : "-", "coveredBranches" : 0, "totalBranches" : 0, "lineCoverageHistory" : [], "branchCoverageHistory" : [] }, - { "name" : "EntityFrameworkAuditableRepository6.Base.BaseRepository", "reportPath" : "entityframeworkauditablerepository6.dll_BaseRepository.htm", "coveredLines" : 8, "uncoveredLines" : 12, "coverableLines" : 20, "totalLines" : 250, "coverageType" : "LineCoverage", "methodCoverage" : "-", "coveredBranches" : 0, "totalBranches" : 0, "lineCoverageHistory" : [], "branchCoverageHistory" : [] }, - { "name" : "EntityFrameworkAuditableRepository6.Base.BaseRepository", "reportPath" : "entityframeworkauditablerepository6.dll_BaseRepository_C__T_.htm", "coveredLines" : 81, "uncoveredLines" : 26, "coverableLines" : 107, "totalLines" : 250, "coverageType" : "LineCoverage", "methodCoverage" : "-", "coveredBranches" : 0, "totalBranches" : 0, "lineCoverageHistory" : [], "branchCoverageHistory" : [] }, - { "name" : "EntityFrameworkAuditableRepository6.Base.DatabaseFactory", "reportPath" : "entityframeworkauditablerepository6.dll_DatabaseFactory_C_.htm", "coveredLines" : 0, "uncoveredLines" : 11, "coverableLines" : 11, "totalLines" : 34, "coverageType" : "LineCoverage", "methodCoverage" : "-", "coveredBranches" : 0, "totalBranches" : 0, "lineCoverageHistory" : [], "branchCoverageHistory" : [] }, - { "name" : "EntityFrameworkAuditableRepository6.Base.Delta", "reportPath" : "entityframeworkauditablerepository6.dll_Delta_T_.htm", "coveredLines" : 22, "uncoveredLines" : 0, "coverableLines" : 22, "totalLines" : 41, "coverageType" : "LineCoverage", "methodCoverage" : "-", "coveredBranches" : 0, "totalBranches" : 0, "lineCoverageHistory" : [], "branchCoverageHistory" : [] }, + { "name" : "EntityFramework.Repository6.BaseContext", "reportPath" : "entityframework.repository6.dll_BaseContext_TContext_.htm", "coveredLines" : 2, "uncoveredLines" : 5, "coverableLines" : 7, "totalLines" : 23, "coverageType" : "LineCoverage", "methodCoverage" : "-", "coveredBranches" : 0, "totalBranches" : 0, "lineCoverageHistory" : [], "branchCoverageHistory" : [] }, + { "name" : "EntityFramework.Repository6.BaseRepository", "reportPath" : "entityframework.repository6.dll_BaseRepository.htm", "coveredLines" : 12, "uncoveredLines" : 7, "coverableLines" : 19, "totalLines" : 241, "coverageType" : "LineCoverage", "methodCoverage" : "-", "coveredBranches" : 0, "totalBranches" : 0, "lineCoverageHistory" : [], "branchCoverageHistory" : [] }, + { "name" : "EntityFramework.Repository6.BaseRepository", "reportPath" : "entityframework.repository6.dll_BaseRepository_C__T_.htm", "coveredLines" : 119, "uncoveredLines" : 4, "coverableLines" : 123, "totalLines" : 241, "coverageType" : "LineCoverage", "methodCoverage" : "-", "coveredBranches" : 0, "totalBranches" : 0, "lineCoverageHistory" : [], "branchCoverageHistory" : [] }, + { "name" : "EntityFramework.Repository6.DatabaseFactory", "reportPath" : "entityframework.repository6.dll_DatabaseFactory_C_.htm", "coveredLines" : 0, "uncoveredLines" : 11, "coverableLines" : 11, "totalLines" : 33, "coverageType" : "LineCoverage", "methodCoverage" : "-", "coveredBranches" : 0, "totalBranches" : 0, "lineCoverageHistory" : [], "branchCoverageHistory" : [] }, + { "name" : "EntityFramework.Repository6.Delta", "reportPath" : "entityframework.repository6.dll_Delta_T_.htm", "coveredLines" : 23, "uncoveredLines" : 0, "coverableLines" : 23, "totalLines" : 43, "coverageType" : "LineCoverage", "methodCoverage" : "-", "coveredBranches" : 0, "totalBranches" : 0, "lineCoverageHistory" : [], "branchCoverageHistory" : [] }, ]}, { - "name" : "entityframeworkauditablerepository6tests.dll", + "name" : "entityframework.repository6.tests.dll", "classes" : [ - { "name" : "EntityFrameworkAuditableRepository6Tests.RepositoryCreateTests", "reportPath" : "entityframeworkauditablerepository6tests.dll_RepositoryCreateTests.htm", "coveredLines" : 62, "uncoveredLines" : 1, "coverableLines" : 63, "totalLines" : 140, "coverageType" : "LineCoverage", "methodCoverage" : "-", "coveredBranches" : 0, "totalBranches" : 0, "lineCoverageHistory" : [], "branchCoverageHistory" : [] }, - { "name" : "EntityFrameworkAuditableRepository6Tests.RepositoryReadTests", "reportPath" : "entityframeworkauditablerepository6tests.dll_RepositoryReadTests.htm", "coveredLines" : 46, "uncoveredLines" : 0, "coverableLines" : 46, "totalLines" : 116, "coverageType" : "LineCoverage", "methodCoverage" : "-", "coveredBranches" : 0, "totalBranches" : 0, "lineCoverageHistory" : [], "branchCoverageHistory" : [] }, - { "name" : "EntityFrameworkAuditableRepository6Tests.RepositoryUpdateTests", "reportPath" : "entityframeworkauditablerepository6tests.dll_RepositoryUpdateTests.htm", "coveredLines" : 60, "uncoveredLines" : 1, "coverableLines" : 61, "totalLines" : 144, "coverageType" : "LineCoverage", "methodCoverage" : "-", "coveredBranches" : 0, "totalBranches" : 0, "lineCoverageHistory" : [], "branchCoverageHistory" : [] }, - { "name" : "EntityFrameworkAuditableRepository6Tests.TestDbInitializer", "reportPath" : "entityframeworkauditablerepository6tests.dll_TestDbInitializer.htm", "coveredLines" : 7, "uncoveredLines" : 0, "coverableLines" : 7, "totalLines" : 24, "coverageType" : "LineCoverage", "methodCoverage" : "-", "coveredBranches" : 0, "totalBranches" : 0, "lineCoverageHistory" : [], "branchCoverageHistory" : [] }, - { "name" : "EntityFrameworkAuditableRepository6Tests.TestExampleDatabaseFactory", "reportPath" : "entityframeworkauditablerepository6tests.dll_TestExampleDatabaseFactory.htm", "coveredLines" : 17, "uncoveredLines" : 0, "coverableLines" : 17, "totalLines" : 45, "coverageType" : "LineCoverage", "methodCoverage" : "-", "coveredBranches" : 0, "totalBranches" : 0, "lineCoverageHistory" : [], "branchCoverageHistory" : [] }, - { "name" : "EntityFrameworkRepository6Tests.DeltaTests", "reportPath" : "entityframeworkauditablerepository6tests.dll_DeltaTests.htm", "coveredLines" : 36, "uncoveredLines" : 2, "coverableLines" : 38, "totalLines" : 91, "coverageType" : "LineCoverage", "methodCoverage" : "-", "coveredBranches" : 0, "totalBranches" : 0, "lineCoverageHistory" : [], "branchCoverageHistory" : [] }, + { "name" : "EntityFramework.Repository6.Tests.DeltaTests", "reportPath" : "entityframework.repository6.tests.dll_DeltaTests.htm", "coveredLines" : 48, "uncoveredLines" : 2, "coverableLines" : 50, "totalLines" : 111, "coverageType" : "LineCoverage", "methodCoverage" : "-", "coveredBranches" : 0, "totalBranches" : 0, "lineCoverageHistory" : [], "branchCoverageHistory" : [] }, + { "name" : "EntityFramework.Repository6.Tests.RepositoryCreateTests", "reportPath" : "entityframework.repository6.tests.dll_RepositoryCreateTests.htm", "coveredLines" : 80, "uncoveredLines" : 1, "coverableLines" : 81, "totalLines" : 165, "coverageType" : "LineCoverage", "methodCoverage" : "-", "coveredBranches" : 0, "totalBranches" : 0, "lineCoverageHistory" : [], "branchCoverageHistory" : [] }, + { "name" : "EntityFramework.Repository6.Tests.RepositoryDeleteTests", "reportPath" : "entityframework.repository6.tests.dll_RepositoryDeleteTests.htm", "coveredLines" : 32, "uncoveredLines" : 0, "coverableLines" : 32, "totalLines" : 87, "coverageType" : "LineCoverage", "methodCoverage" : "-", "coveredBranches" : 0, "totalBranches" : 0, "lineCoverageHistory" : [], "branchCoverageHistory" : [] }, + { "name" : "EntityFramework.Repository6.Tests.RepositoryReadTests", "reportPath" : "entityframework.repository6.tests.dll_RepositoryReadTests.htm", "coveredLines" : 78, "uncoveredLines" : 0, "coverableLines" : 78, "totalLines" : 178, "coverageType" : "LineCoverage", "methodCoverage" : "-", "coveredBranches" : 0, "totalBranches" : 0, "lineCoverageHistory" : [], "branchCoverageHistory" : [] }, + { "name" : "EntityFramework.Repository6.Tests.RepositoryUpdateTests", "reportPath" : "entityframework.repository6.tests.dll_RepositoryUpdateTests.htm", "coveredLines" : 46, "uncoveredLines" : 1, "coverableLines" : 47, "totalLines" : 112, "coverageType" : "LineCoverage", "methodCoverage" : "-", "coveredBranches" : 0, "totalBranches" : 0, "lineCoverageHistory" : [], "branchCoverageHistory" : [] }, + { "name" : "EntityFramework.Repository6.Tests.TestDbInitializer", "reportPath" : "entityframework.repository6.tests.dll_TestDbInitializer.htm", "coveredLines" : 7, "uncoveredLines" : 0, "coverableLines" : 7, "totalLines" : 24, "coverageType" : "LineCoverage", "methodCoverage" : "-", "coveredBranches" : 0, "totalBranches" : 0, "lineCoverageHistory" : [], "branchCoverageHistory" : [] }, + { "name" : "EntityFramework.Repository6.Tests.TestExampleDatabaseFactory", "reportPath" : "entityframework.repository6.tests.dll_TestExampleDatabaseFactory.htm", "coveredLines" : 17, "uncoveredLines" : 0, "coverableLines" : 17, "totalLines" : 45, "coverageType" : "LineCoverage", "methodCoverage" : "-", "coveredBranches" : 0, "totalBranches" : 0, "lineCoverageHistory" : [], "branchCoverageHistory" : [] }, ]}, { - "name" : "entityframeworkrepository6.dll", + "name" : "persistentlayer.auditable.dll", "classes" : [ - { "name" : "EntityFrameworkRepository6.Base.BaseContext", "reportPath" : "entityframeworkrepository6.dll_BaseContext_TContext_.htm", "coveredLines" : 3, "uncoveredLines" : 9, "coverableLines" : 12, "totalLines" : 28, "coverageType" : "LineCoverage", "methodCoverage" : "-", "coveredBranches" : 0, "totalBranches" : 0, "lineCoverageHistory" : [], "branchCoverageHistory" : [] }, - { "name" : "EntityFrameworkRepository6.Base.BaseRepository", "reportPath" : "entityframeworkrepository6.dll_BaseRepository.htm", "coveredLines" : 8, "uncoveredLines" : 9, "coverableLines" : 17, "totalLines" : 236, "coverageType" : "LineCoverage", "methodCoverage" : "-", "coveredBranches" : 0, "totalBranches" : 0, "lineCoverageHistory" : [], "branchCoverageHistory" : [] }, - { "name" : "EntityFrameworkRepository6.Base.BaseRepository", "reportPath" : "entityframeworkrepository6.dll_BaseRepository_C__T_.htm", "coveredLines" : 81, "uncoveredLines" : 23, "coverableLines" : 104, "totalLines" : 236, "coverageType" : "LineCoverage", "methodCoverage" : "-", "coveredBranches" : 0, "totalBranches" : 0, "lineCoverageHistory" : [], "branchCoverageHistory" : [] }, - { "name" : "EntityFrameworkRepository6.Base.DatabaseFactory", "reportPath" : "entityframeworkrepository6.dll_DatabaseFactory_C_.htm", "coveredLines" : 0, "uncoveredLines" : 11, "coverableLines" : 11, "totalLines" : 33, "coverageType" : "LineCoverage", "methodCoverage" : "-", "coveredBranches" : 0, "totalBranches" : 0, "lineCoverageHistory" : [], "branchCoverageHistory" : [] }, - { "name" : "EntityFrameworkRepository6.Base.Delta", "reportPath" : "entityframeworkrepository6.dll_Delta_T_.htm", "coveredLines" : 22, "uncoveredLines" : 0, "coverableLines" : 22, "totalLines" : 41, "coverageType" : "LineCoverage", "methodCoverage" : "-", "coveredBranches" : 0, "totalBranches" : 0, "lineCoverageHistory" : [], "branchCoverageHistory" : [] }, - ]}, - { - "name" : "entityframeworkrepository6tests.dll", - "classes" : [ - { "name" : "EntityFrameworkRepository6Tests.DeltaTests", "reportPath" : "entityframeworkrepository6tests.dll_DeltaTests.htm", "coveredLines" : 36, "uncoveredLines" : 2, "coverableLines" : 38, "totalLines" : 90, "coverageType" : "LineCoverage", "methodCoverage" : "-", "coveredBranches" : 0, "totalBranches" : 0, "lineCoverageHistory" : [], "branchCoverageHistory" : [] }, - { "name" : "EntityFrameworkRepository6Tests.RepositoryCreateTests", "reportPath" : "entityframeworkrepository6tests.dll_RepositoryCreateTests.htm", "coveredLines" : 62, "uncoveredLines" : 1, "coverableLines" : 63, "totalLines" : 137, "coverageType" : "LineCoverage", "methodCoverage" : "-", "coveredBranches" : 0, "totalBranches" : 0, "lineCoverageHistory" : [], "branchCoverageHistory" : [] }, - { "name" : "EntityFrameworkRepository6Tests.RepositoryReadTests", "reportPath" : "entityframeworkrepository6tests.dll_RepositoryReadTests.htm", "coveredLines" : 46, "uncoveredLines" : 0, "coverableLines" : 46, "totalLines" : 112, "coverageType" : "LineCoverage", "methodCoverage" : "-", "coveredBranches" : 0, "totalBranches" : 0, "lineCoverageHistory" : [], "branchCoverageHistory" : [] }, - { "name" : "EntityFrameworkRepository6Tests.RepositoryUpdateTests", "reportPath" : "entityframeworkrepository6tests.dll_RepositoryUpdateTests.htm", "coveredLines" : 46, "uncoveredLines" : 1, "coverableLines" : 47, "totalLines" : 111, "coverageType" : "LineCoverage", "methodCoverage" : "-", "coveredBranches" : 0, "totalBranches" : 0, "lineCoverageHistory" : [], "branchCoverageHistory" : [] }, - { "name" : "EntityFrameworkRepository6Tests.TestDbInitializer", "reportPath" : "entityframeworkrepository6tests.dll_TestDbInitializer.htm", "coveredLines" : 7, "uncoveredLines" : 0, "coverableLines" : 7, "totalLines" : 24, "coverageType" : "LineCoverage", "methodCoverage" : "-", "coveredBranches" : 0, "totalBranches" : 0, "lineCoverageHistory" : [], "branchCoverageHistory" : [] }, - { "name" : "EntityFrameworkRepository6Tests.TestExampleDatabaseFactory", "reportPath" : "entityframeworkrepository6tests.dll_TestExampleDatabaseFactory.htm", "coveredLines" : 17, "uncoveredLines" : 0, "coverableLines" : 17, "totalLines" : 45, "coverageType" : "LineCoverage", "methodCoverage" : "-", "coveredBranches" : 0, "totalBranches" : 0, "lineCoverageHistory" : [], "branchCoverageHistory" : [] }, + { "name" : "PersistentLayer.Auditable.Contexts.YourCustomDataContext", "reportPath" : "persistentlayer.auditable.dll_YourCustomDataContext.htm", "coveredLines" : 4, "uncoveredLines" : 1, "coverableLines" : 5, "totalLines" : 30, "coverageType" : "LineCoverage", "methodCoverage" : "-", "coveredBranches" : 0, "totalBranches" : 0, "lineCoverageHistory" : [], "branchCoverageHistory" : [] }, + { "name" : "PersistentLayer.Auditable.Entities.PersistentEntity", "reportPath" : "persistentlayer.auditable.dll_PersistentEntity.htm", "coveredLines" : 0, "uncoveredLines" : 1, "coverableLines" : 1, "totalLines" : 13, "coverageType" : "LineCoverage", "methodCoverage" : "-", "coveredBranches" : 0, "totalBranches" : 0, "lineCoverageHistory" : [], "branchCoverageHistory" : [] }, + { "name" : "PersistentLayer.Auditable.Entities.SimpleCompositeKeyEntity", "reportPath" : "persistentlayer.auditable.dll_SimpleCompositeKeyEntity.htm", "coveredLines" : 2, "uncoveredLines" : 0, "coverableLines" : 2, "totalLines" : 20, "coverageType" : "LineCoverage", "methodCoverage" : "-", "coveredBranches" : 0, "totalBranches" : 0, "lineCoverageHistory" : [], "branchCoverageHistory" : [] }, + { "name" : "PersistentLayer.Auditable.Entities.SimpleDataEntity", "reportPath" : "persistentlayer.auditable.dll_SimpleDataEntity.htm", "coveredLines" : 2, "uncoveredLines" : 0, "coverableLines" : 2, "totalLines" : 13, "coverageType" : "LineCoverage", "methodCoverage" : "-", "coveredBranches" : 0, "totalBranches" : 0, "lineCoverageHistory" : [], "branchCoverageHistory" : [] }, + { "name" : "PersistentLayer.Auditable.Entities.SimpleDataEntityAudit", "reportPath" : "persistentlayer.auditable.dll_SimpleDataEntityAudit.htm", "coveredLines" : 3, "uncoveredLines" : 0, "coverableLines" : 3, "totalLines" : 16, "coverageType" : "LineCoverage", "methodCoverage" : "-", "coveredBranches" : 0, "totalBranches" : 0, "lineCoverageHistory" : [], "branchCoverageHistory" : [] }, + { "name" : "PersistentLayer.Auditable.Initializers.MyDbInitializer", "reportPath" : "persistentlayer.auditable.dll_MyDbInitializer.htm", "coveredLines" : 0, "uncoveredLines" : 7, "coverableLines" : 7, "totalLines" : 24, "coverageType" : "LineCoverage", "methodCoverage" : "-", "coveredBranches" : 0, "totalBranches" : 0, "lineCoverageHistory" : [], "branchCoverageHistory" : [] }, + { "name" : "PersistentLayer.Auditable.Repositories.SimpleCompositeKeyEntityRepository", "reportPath" : "persistentlayer.auditable.dll_SimpleCompositeKeyEntityRepository.htm", "coveredLines" : 3, "uncoveredLines" : 0, "coverableLines" : 3, "totalLines" : 26, "coverageType" : "LineCoverage", "methodCoverage" : "-", "coveredBranches" : 0, "totalBranches" : 0, "lineCoverageHistory" : [], "branchCoverageHistory" : [] }, + { "name" : "PersistentLayer.Auditable.Repositories.SimpleDataEntityRepository", "reportPath" : "persistentlayer.auditable.dll_SimpleDataEntityRepository.htm", "coveredLines" : 6, "uncoveredLines" : 0, "coverableLines" : 6, "totalLines" : 27, "coverageType" : "LineCoverage", "methodCoverage" : "-", "coveredBranches" : 0, "totalBranches" : 0, "lineCoverageHistory" : [], "branchCoverageHistory" : [] }, ]}, { "name" : "persistentlayer.dll", @@ -376,20 +393,8 @@ var assemblies = [ { "name" : "PersistentLayer.Entities.SimpleCompositeKeyEntity", "reportPath" : "persistentlayer.dll_SimpleCompositeKeyEntity.htm", "coveredLines" : 2, "uncoveredLines" : 0, "coverableLines" : 2, "totalLines" : 20, "coverageType" : "LineCoverage", "methodCoverage" : "-", "coveredBranches" : 0, "totalBranches" : 0, "lineCoverageHistory" : [], "branchCoverageHistory" : [] }, { "name" : "PersistentLayer.Entities.SimpleDataEntity", "reportPath" : "persistentlayer.dll_SimpleDataEntity.htm", "coveredLines" : 1, "uncoveredLines" : 0, "coverableLines" : 1, "totalLines" : 7, "coverageType" : "LineCoverage", "methodCoverage" : "-", "coveredBranches" : 0, "totalBranches" : 0, "lineCoverageHistory" : [], "branchCoverageHistory" : [] }, { "name" : "PersistentLayer.Initializers.MyDbInitializer", "reportPath" : "persistentlayer.dll_MyDbInitializer.htm", "coveredLines" : 0, "uncoveredLines" : 7, "coverableLines" : 7, "totalLines" : 24, "coverageType" : "LineCoverage", "methodCoverage" : "-", "coveredBranches" : 0, "totalBranches" : 0, "lineCoverageHistory" : [], "branchCoverageHistory" : [] }, - { "name" : "PersistentLayer.Repositories.SimpleCompositeKeyEntityRepository", "reportPath" : "persistentlayer.dll_SimpleCompositeKeyEntityRepository.htm", "coveredLines" : 4, "uncoveredLines" : 0, "coverableLines" : 4, "totalLines" : 24, "coverageType" : "LineCoverage", "methodCoverage" : "-", "coveredBranches" : 0, "totalBranches" : 0, "lineCoverageHistory" : [], "branchCoverageHistory" : [] }, - { "name" : "PersistentLayer.Repositories.SimpleDataEntityRepository", "reportPath" : "persistentlayer.dll_SimpleDataEntityRepository.htm", "coveredLines" : 4, "uncoveredLines" : 0, "coverableLines" : 4, "totalLines" : 24, "coverageType" : "LineCoverage", "methodCoverage" : "-", "coveredBranches" : 0, "totalBranches" : 0, "lineCoverageHistory" : [], "branchCoverageHistory" : [] }, - ]}, - { - "name" : "persistentlayerauditable.dll", - "classes" : [ - { "name" : "PersistentLayerAuditable.Contexts.YourCustomDataContext", "reportPath" : "persistentlayerauditable.dll_YourCustomDataContext.htm", "coveredLines" : 4, "uncoveredLines" : 1, "coverableLines" : 5, "totalLines" : 30, "coverageType" : "LineCoverage", "methodCoverage" : "-", "coveredBranches" : 0, "totalBranches" : 0, "lineCoverageHistory" : [], "branchCoverageHistory" : [] }, - { "name" : "PersistentLayerAuditable.Entities.PersistentEntity", "reportPath" : "persistentlayerauditable.dll_PersistentEntity.htm", "coveredLines" : 0, "uncoveredLines" : 1, "coverableLines" : 1, "totalLines" : 13, "coverageType" : "LineCoverage", "methodCoverage" : "-", "coveredBranches" : 0, "totalBranches" : 0, "lineCoverageHistory" : [], "branchCoverageHistory" : [] }, - { "name" : "PersistentLayerAuditable.Entities.SimpleCompositeKeyEntity", "reportPath" : "persistentlayerauditable.dll_SimpleCompositeKeyEntity.htm", "coveredLines" : 2, "uncoveredLines" : 0, "coverableLines" : 2, "totalLines" : 20, "coverageType" : "LineCoverage", "methodCoverage" : "-", "coveredBranches" : 0, "totalBranches" : 0, "lineCoverageHistory" : [], "branchCoverageHistory" : [] }, - { "name" : "PersistentLayerAuditable.Entities.SimpleDataEntity", "reportPath" : "persistentlayerauditable.dll_SimpleDataEntity.htm", "coveredLines" : 2, "uncoveredLines" : 0, "coverableLines" : 2, "totalLines" : 13, "coverageType" : "LineCoverage", "methodCoverage" : "-", "coveredBranches" : 0, "totalBranches" : 0, "lineCoverageHistory" : [], "branchCoverageHistory" : [] }, - { "name" : "PersistentLayerAuditable.Entities.SimpleDataEntityAudit", "reportPath" : "persistentlayerauditable.dll_SimpleDataEntityAudit.htm", "coveredLines" : 3, "uncoveredLines" : 0, "coverableLines" : 3, "totalLines" : 16, "coverageType" : "LineCoverage", "methodCoverage" : "-", "coveredBranches" : 0, "totalBranches" : 0, "lineCoverageHistory" : [], "branchCoverageHistory" : [] }, - { "name" : "PersistentLayerAuditable.Initializers.MyDbInitializer", "reportPath" : "persistentlayerauditable.dll_MyDbInitializer.htm", "coveredLines" : 0, "uncoveredLines" : 7, "coverableLines" : 7, "totalLines" : 24, "coverageType" : "LineCoverage", "methodCoverage" : "-", "coveredBranches" : 0, "totalBranches" : 0, "lineCoverageHistory" : [], "branchCoverageHistory" : [] }, - { "name" : "PersistentLayerAuditable.Repositories.SimpleCompositeKeyEntityRepository", "reportPath" : "persistentlayerauditable.dll_SimpleCompositeKeyEntityRepository.htm", "coveredLines" : 4, "uncoveredLines" : 0, "coverableLines" : 4, "totalLines" : 24, "coverageType" : "LineCoverage", "methodCoverage" : "-", "coveredBranches" : 0, "totalBranches" : 0, "lineCoverageHistory" : [], "branchCoverageHistory" : [] }, - { "name" : "PersistentLayerAuditable.Repositories.SimpleDataEntityRepository", "reportPath" : "persistentlayerauditable.dll_SimpleDataEntityRepository.htm", "coveredLines" : 4, "uncoveredLines" : 0, "coverableLines" : 4, "totalLines" : 24, "coverageType" : "LineCoverage", "methodCoverage" : "-", "coveredBranches" : 0, "totalBranches" : 0, "lineCoverageHistory" : [], "branchCoverageHistory" : [] }, + { "name" : "PersistentLayer.Repositories.SimpleCompositeKeyEntityRepository", "reportPath" : "persistentlayer.dll_SimpleCompositeKeyEntityRepository.htm", "coveredLines" : 3, "uncoveredLines" : 0, "coverableLines" : 3, "totalLines" : 25, "coverageType" : "LineCoverage", "methodCoverage" : "-", "coveredBranches" : 0, "totalBranches" : 0, "lineCoverageHistory" : [], "branchCoverageHistory" : [] }, + { "name" : "PersistentLayer.Repositories.SimpleDataEntityRepository", "reportPath" : "persistentlayer.dll_SimpleDataEntityRepository.htm", "coveredLines" : 3, "uncoveredLines" : 0, "coverableLines" : 3, "totalLines" : 25, "coverageType" : "LineCoverage", "methodCoverage" : "-", "coveredBranches" : 0, "totalBranches" : 0, "lineCoverageHistory" : [], "branchCoverageHistory" : [] }, ]}, ]; diff --git a/CodeCoverageReport/entityframework.auditable.repository6.dll_AuditableBaseContext_TContext_.htm b/CodeCoverageReport/entityframework.auditable.repository6.dll_AuditableBaseContext_TContext_.htm new file mode 100644 index 0000000..e4f6527 --- /dev/null +++ b/CodeCoverageReport/entityframework.auditable.repository6.dll_AuditableBaseContext_TContext_.htm @@ -0,0 +1,84 @@ + + + + + +EntityFramework.Auditable.Repository6.AuditableBaseContext<TContext> - Coverage Report + +
+

Summary

+ ++++ + + + + + + + + + + +
Class:EntityFramework.Auditable.Repository6.AuditableBaseContext<TContext>
Assembly:entityframework.auditable.repository6.dll
File(s):C:\Development\EntityFrameworkRepository6\EntityFrameworkAuditableRepository6\AuditableBaseContext.cs
Covered lines:2
Uncovered lines:5
Coverable lines:7
Total lines:24
Line coverage:28.5%
+

Metrics

+ + + + + + + + + + + +
MethodBlocks covered  Blocks not covered  
AuditableBaseContext()10
AuditableBaseContext(System.Data.Common.DbConnection)30
AuditableBaseContext(System.Data.Common.DbConnection, bool)03
AuditableBaseContext(string)03
AuditableBaseContext(string, System.Data.Entity.IDatabaseInitializer<TContext>)03
AuditableBaseContext(System.Data.Common.DbConnection, System.Data.Entity.IDatabaseInitializer<TContext>)03
AuditableBaseContext(System.Data.Common.DbConnection, System.Data.Entity.IDatabaseInitializer<TContext>, bool)03
+

File(s)

+

C:\Development\EntityFrameworkRepository6\EntityFrameworkAuditableRepository6\AuditableBaseContext.cs

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + +
#LineLine coverage
 1using EntityFramework.Auditing;
 2using System.Data.Common;
 3using System.Data.Entity;
 4
 5namespace EntityFramework.Auditable.Repository6
 6{
 7    public class AuditableBaseContext<TContext> : AuditDbContext
 8            where TContext : AuditDbContext
 9    {
 110        static AuditableBaseContext() { }
 11
 112        protected AuditableBaseContext(DbConnection dbConnection) : base(dbConnection, true) { Database.SetInitializer<T
 13
 014        protected AuditableBaseContext(DbConnection dbConnection, bool contextOwnsConnection) : base(dbConnection, conte
 15
 016        protected AuditableBaseContext(string connectionString) : base(connectionString) { Database.SetInitializer<TCont
 17
 018        protected AuditableBaseContext(string connectionString, IDatabaseInitializer<TContext> initializerStrategy) : ba
 19
 020        protected AuditableBaseContext(DbConnection dbConnection, IDatabaseInitializer<TContext> initializerStrategy) : 
 21
 022        protected AuditableBaseContext(DbConnection dbConnection, IDatabaseInitializer<TContext> initializerStrategy, bo
 23    }
 24}
+
+
+ + \ No newline at end of file diff --git a/CodeCoverageReport/entityframework.auditable.repository6.dll_AuditableBaseRepository.htm b/CodeCoverageReport/entityframework.auditable.repository6.dll_AuditableBaseRepository.htm new file mode 100644 index 0000000..608ab5b --- /dev/null +++ b/CodeCoverageReport/entityframework.auditable.repository6.dll_AuditableBaseRepository.htm @@ -0,0 +1,79 @@ + + + + + +EntityFramework.Auditable.Repository6.AuditableBaseRepository - Coverage Report + +
+

Summary

+ ++++ + + + + + + + + + + +
Class:EntityFramework.Auditable.Repository6.AuditableBaseRepository
Assembly:entityframework.auditable.repository6.dll
File(s):C:\Development\EntityFrameworkRepository6\EntityFrameworkAuditableRepository6\AuditableBaseRepository.cs
Covered lines:0
Uncovered lines:3
Coverable lines:3
Total lines:31
Line coverage:0%
+

Metrics

+ + + + + +
MethodBlocks covered  Blocks not covered  
SaveAsync()05
+

File(s)

+

C:\Development\EntityFrameworkRepository6\EntityFrameworkAuditableRepository6\AuditableBaseRepository.cs

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
#LineLine coverage
 1using EntityFramework.Auditing;
 2using EntityFramework.Repository6;
 3using EntityFramework.Repository6.Interfaces;
 4using System;
 5using System.Threading.Tasks;
 6
 7namespace EntityFramework.Auditable.Repository6
 8{
 9    public abstract class AuditableBaseRepository<C, T> :
 10        BaseRepository<C, T>
 11        , IBaseRepository<C, T>
 12        , IDisposable
 13        , IAuditSaveFunctions<T>
 14        where T : class
 15        where C : AuditDbContext
 16    {
 17        protected AuditableBaseRepository(C context) : base(context)
 18        {
 19        }
 20
 21        public async virtual Task<int> SaveAsync(string userName)
 022        {
 023            return await Context.SaveChangesAsync(userName);
 024        }
 25
 26        public virtual int Save(string userName)
 27        {
 28            return Context.SaveChanges(userName);
 29        }
 30    }
 31}
+
+
+
+

Methods/Properties

+SaveAsync()
+
+
+ + \ No newline at end of file diff --git a/CodeCoverageReport/entityframework.auditable.repository6.dll_AuditableBaseRepository_C__T_.htm b/CodeCoverageReport/entityframework.auditable.repository6.dll_AuditableBaseRepository_C__T_.htm new file mode 100644 index 0000000..aae9301 --- /dev/null +++ b/CodeCoverageReport/entityframework.auditable.repository6.dll_AuditableBaseRepository_C__T_.htm @@ -0,0 +1,81 @@ + + + + + +EntityFramework.Auditable.Repository6.AuditableBaseRepository<C, T> - Coverage Report + +
+

Summary

+ ++++ + + + + + + + + + + +
Class:EntityFramework.Auditable.Repository6.AuditableBaseRepository<C, T>
Assembly:entityframework.auditable.repository6.dll
File(s):C:\Development\EntityFrameworkRepository6\EntityFrameworkAuditableRepository6\AuditableBaseRepository.cs
Covered lines:6
Uncovered lines:0
Coverable lines:6
Total lines:31
Line coverage:100%
+

Metrics

+ + + + + + +
MethodBlocks covered  Blocks not covered  
AuditableBaseRepository(C)20
Save(string)40
+

File(s)

+

C:\Development\EntityFrameworkRepository6\EntityFrameworkAuditableRepository6\AuditableBaseRepository.cs

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
#LineLine coverage
 1using EntityFramework.Auditing;
 2using EntityFramework.Repository6;
 3using EntityFramework.Repository6.Interfaces;
 4using System;
 5using System.Threading.Tasks;
 6
 7namespace EntityFramework.Auditable.Repository6
 8{
 9    public abstract class AuditableBaseRepository<C, T> :
 10        BaseRepository<C, T>
 11        , IBaseRepository<C, T>
 12        , IDisposable
 13        , IAuditSaveFunctions<T>
 14        where T : class
 15        where C : AuditDbContext
 16    {
 117        protected AuditableBaseRepository(C context) : base(context)
 118        {
 119        }
 20
 21        public async virtual Task<int> SaveAsync(string userName)
 22        {
 23            return await Context.SaveChangesAsync(userName);
 24        }
 25
 26        public virtual int Save(string userName)
 127        {
 128            return Context.SaveChanges(userName);
 129        }
 30    }
 31}
+
+
+
+

Methods/Properties

+AuditableBaseRepository(C)
+Save(string)
+
+
+ + \ No newline at end of file diff --git a/CodeCoverageReport/entityframeworkauditablerepository6.dll_BaseContext_TContext_.htm b/CodeCoverageReport/entityframework.auditable.repository6.dll_BaseContext_TContext_.htm similarity index 59% rename from CodeCoverageReport/entityframeworkauditablerepository6.dll_BaseContext_TContext_.htm rename to CodeCoverageReport/entityframework.auditable.repository6.dll_BaseContext_TContext_.htm index c4cd19f..8fbd92c 100644 --- a/CodeCoverageReport/entityframeworkauditablerepository6.dll_BaseContext_TContext_.htm +++ b/CodeCoverageReport/entityframework.auditable.repository6.dll_BaseContext_TContext_.htm @@ -3,7 +3,7 @@ -EntityFrameworkAuditableRepository6.Base.BaseContext<TContext> - Coverage Report +EntityFramework.Repository6.BaseContext<TContext> - Coverage Report

Summary

@@ -13,72 +13,70 @@

Summary

-Class:EntityFrameworkAuditableRepository6.Base.BaseContext<TContext> -Assembly:entityframeworkauditablerepository6.dll -File(s):C:\Development\EntityFrameworkRepository6\EntityFrameworkAuditableRepository6\BaseContext.cs -Covered lines:3 -Uncovered lines:9 -Coverable lines:12 -Total lines:29 -Line coverage:25% +Class:EntityFramework.Repository6.BaseContext<TContext> +Assembly:entityframework.auditable.repository6.dll +File(s):C:\Development\EntityFrameworkRepository6\EntityFrameworkRepository6\BaseContext.cs +Covered lines:0 +Uncovered lines:7 +Coverable lines:7 +Total lines:23 +Line coverage:0%

Metrics

- - + + + +
MethodBlocks covered  Blocks not covered  
BaseContext()10
BaseContext(System.Data.Common.DbConnection)30
BaseContext()01
BaseContext(System.Data.Common.DbConnection)03
BaseContext(System.Data.Common.DbConnection, bool)03
BaseContext(string)03
BaseContext(string, System.Data.Entity.IDatabaseInitializer<TContext>)03
BaseContext(System.Data.Common.DbConnection, System.Data.Entity.IDatabaseInitializer<TContext>)03
BaseContext(System.Data.Common.DbConnection, System.Data.Entity.IDatabaseInitializer<TContext>, bool)03

File(s)

-

C:\Development\EntityFrameworkRepository6\EntityFrameworkAuditableRepository6\BaseContext.cs

+

C:\Development\EntityFrameworkRepository6\EntityFrameworkRepository6\BaseContext.cs

- - - - - - - - - - - - - + + + + + + + + + + + + + - + - + - - - - - - - - - - - + + + + +
#LineLine coverage
 1using EntityFramework.Auditing;
 2using System.Data.Common;
 3using System.Data.Entity;
 4
 5namespace EntityFrameworkAuditableRepository6.Base
 6{
 7    public class BaseContext<TContext> : AuditDbContext
 8            where TContext : AuditDbContext
 9    {
 10        static BaseContext()
 111        {
 12            //Database.SetInitializer<TContext>(null);
 113        }
 1using System.Data.Common;
 2using System.Data.Entity;
 3
 4namespace EntityFramework.Repository6
 5{
 6    public class BaseContext<TContext> : DbContext
 7            where TContext : DbContext
 8    {
 09        static BaseContext() { }
 10
 011        protected BaseContext(DbConnection dbConnection) : base(dbConnection, true) { Database.SetInitializer<TContext>(
 12
 013        protected BaseContext(DbConnection dbConnection, bool contextOwnsConnection) : base(dbConnection, contextOwnsCon
 14
 115        protected BaseContext(DbConnection dbConnection) : base(dbConnection) { Database.SetInitializer<TContext>(null);
 015        protected BaseContext(string connectionString) : base(connectionString) { Database.SetInitializer<TContext>(null
 16
 017        protected BaseContext(string connectionString) : base(connectionString) { Database.SetInitializer<TContext>(null
 017        protected BaseContext(string connectionString, IDatabaseInitializer<TContext> initializerStrategy) : base(connec
 18
 019        protected BaseContext(string connectionString, IDatabaseInitializer<TContext> initializerStrategy) : base(connec
 020        {
 021            Database.SetInitializer<TContext>(initializerStrategy);
 022        }
 23
 024        protected BaseContext(DbConnection dbConnection, IDatabaseInitializer<TContext> initializerStrategy) : base(dbCo
 025        {
 026            Database.SetInitializer<TContext>(initializerStrategy);
 027        }
 28    }
 29}
 019        protected BaseContext(DbConnection dbConnection, IDatabaseInitializer<TContext> initializerStrategy) : base(dbCo
 20
 021        protected BaseContext(DbConnection dbConnection, IDatabaseInitializer<TContext> initializerStrategy, bool contex
 22    }
 23}
-
+
diff --git a/CodeCoverageReport/entityframeworkauditablerepository6.dll_BaseRepository.htm b/CodeCoverageReport/entityframework.auditable.repository6.dll_BaseRepository.htm similarity index 76% rename from CodeCoverageReport/entityframeworkauditablerepository6.dll_BaseRepository.htm rename to CodeCoverageReport/entityframework.auditable.repository6.dll_BaseRepository.htm index 9293327..781b7cb 100644 --- a/CodeCoverageReport/entityframeworkauditablerepository6.dll_BaseRepository.htm +++ b/CodeCoverageReport/entityframework.auditable.repository6.dll_BaseRepository.htm @@ -3,7 +3,7 @@ -EntityFrameworkAuditableRepository6.Base.BaseRepository - Coverage Report +EntityFramework.Repository6.BaseRepository - Coverage Report

Summary

@@ -13,14 +13,14 @@

Summary

-Class:EntityFrameworkAuditableRepository6.Base.BaseRepository -Assembly:entityframeworkauditablerepository6.dll -File(s):C:\Development\EntityFrameworkRepository6\EntityFrameworkAuditableRepository6\BaseRepository.cs -Covered lines:8 -Uncovered lines:12 -Coverable lines:20 -Total lines:250 -Line coverage:40% +Class:EntityFramework.Repository6.BaseRepository +Assembly:entityframework.auditable.repository6.dll +File(s):C:\Development\EntityFrameworkRepository6\EntityFrameworkRepository6\BaseRepository.cs +Covered lines:12 +Uncovered lines:7 +Coverable lines:19 +Total lines:241 +Line coverage:63.1%

Metrics

@@ -29,18 +29,17 @@

Metrics

FindAsync()60 FindAsync()60 -ReloadAsync()06 -SaveAsync()05 +ReloadAsync()60 SaveAsync()05 CountAsync()06

File(s)

-

C:\Development\EntityFrameworkRepository6\EntityFrameworkAuditableRepository6\BaseRepository.cs

+

C:\Development\EntityFrameworkRepository6\EntityFrameworkRepository6\BaseRepository.cs

- + @@ -48,260 +47,250 @@

- + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - - - - - - - - + + + + + + + + + + + - + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + - - - - - - - - + + + + + + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
#LineLine coverage
 1using EntityFramework.Auditing;
 1using EntityFramework.Repository6.Interfaces;
 2using System;
 3using System.Collections.Generic;
 4using System.Data.Entity;
 6using System.Linq.Expressions;
 7using System.Threading.Tasks;
 8
 9namespace EntityFrameworkAuditableRepository6.Base
 9namespace EntityFramework.Repository6
 10{
 11    public interface IBaseRepository<C, T> : IDisposable
 12            where T : class
 13            where C : AuditDbContext
 14    {
 15        C Context { get; set; }
 16        IQueryable<T> GetAll();
 17        IQueryable<T> FindBy(Expression<Func<T, bool>> predicate);
 18        IQueryable<T> FindByReadOnly(Expression<Func<T, bool>> predicate);
 19        T Add(T entity);
 20        IEnumerable<T> Add(IEnumerable<T> entities);
 21        void Delete(T entity);
 22        void Delete(IEnumerable<T> entities);
 23        void Reload(T entity);
 24        void ReloadAsync(T entity);
 25        void Update(T entity, int id);
 26        void Update(T entity, Expression<Func<T, bool>> predicate);
 27        void Update(Delta<T> delta, params object[] ids);
 28        Task<int> SaveAsync();
 29        int Save();
 30        Task<int> SaveAsync(string userName);
 31        int Save(string userName);
 32        T Find(int id);
 33        T Find(params object[] ids);
 34        Task<T> FindAsync(int id);
 35        Task<T> FindAsync(params object[] ids);
 36        bool Exists(Expression<Func<T, bool>> predicate);
 37        void AddUpdateIgnoreField(string fieldName);
 38        int Count();
 39        Task<int> CountAsync();
 40    }
 41
 42    public abstract class BaseRepository<C, T> : IBaseRepository<C, T>,
 43            IDisposable
 44        where T : class
 45        where C : AuditDbContext
 46    {
 47        public C Context { get; set; }
 48        public Lazy<List<string>> IgnoreFieldsOnUpdate = new Lazy<List<string>>();
 11    public abstract class BaseRepository<C, T> :
 12            IBaseRepository<C, T>
 13            , IDisposable
 14        where T : class
 15        where C : DbContext
 16    {
 17        protected C Context { get; set; }
 18        protected Lazy<List<string>> IgnoreFieldsOnUpdate = new Lazy<List<string>>();
 19        protected Lazy<List<Expression<Func<T, bool>>>> IgnoreFieldsOnUpdate2 = new Lazy<List<Expression<Func<T, bool>>>
 20
 21        protected BaseRepository(C context)
 22        {
 23            Context = context;
 24        }
 25
 26        public virtual void AddUpdateIgnoreField(string fieldName)
 27        {
 28            IgnoreFieldsOnUpdate.Value.Add(fieldName);
 29        }
 30
 31        public virtual void AddUpdateIgnoreField(Expression<Func<T, bool>> fieldName)
 32        {
 33            IgnoreFieldsOnUpdate2.Value.Add(fieldName);
 34        }
 35
 36        public virtual T Find(int id)
 37        {
 38            T entity = Context.Set<T>().Find(id);
 39
 40            return entity;
 41        }
 42
 43        public virtual T Find(params object[] ids)
 44        {
 45            T entity = Context.Set<T>().Find(ids);
 46
 47            return entity;
 48        }
 49
 50        public void AddUpdateIgnoreField(string fieldName)
 51        {
 52            IgnoreFieldsOnUpdate.Value.Add(fieldName);
 53        }
 54
 55        public virtual T Find(int id)
 56        {
 57            T entity = Context.Set<T>().Find(id);
 58
 59            return entity;
 60        }
 50        public virtual async Task<T> FindAsync(int id)
 151        {
 152            var query = Context.Set<T>().FindAsync(id);
 153            return await query;
 154        }
 55
 56        public virtual async Task<T> FindAsync(params object[] ids)
 157        {
 158            var query = Context.Set<T>().FindAsync(ids);
 159            return await query;
 160        }
 61
 62        public virtual T Find(params object[] ids)
 62        public virtual IQueryable<T> FindBy(Expression<Func<T, bool>> predicate)
 63        {
 64            T entity = Context.Set<T>().Find(ids);
 65
 66            return entity;
 67        }
 68
 69        public virtual async Task<T> FindAsync(int id)
 170        {
 171            var query = Context.Set<T>().FindAsync(id);
 172            return await query;
 173        }
 74
 75        public virtual async Task<T> FindAsync(params object[] ids)
 176        {
 177            var query = Context.Set<T>().FindAsync(ids);
 178            return await query;
 179        }
 80
 81        public virtual IQueryable<T> FindBy(Expression<Func<T, bool>> predicate)
 82        {
 83            IQueryable<T> query = Context.Set<T>().Where(predicate);
 84            return query;
 85        }
 86
 87        public virtual bool Exists(Expression<Func<T, bool>> predicate)
 88        {
 89            return Context.Set<T>().AsNoTracking().Any(predicate);
 90        }
 91
 92        public virtual void Delete(T entity)
 93        {
 94            Context.Set<T>().Remove(entity);
 95        }
 96
 97        public virtual void Delete(IEnumerable<T> entities)
 98        {
 99            foreach (T entity in entities)
 100            {
 101                Delete(entity);
 102            }
 103        }
 104
 105        public virtual void Reload(T entity)
 106        {
 107            Context.Entry<T>(entity).Reload();
 108        }
 109
 110        public async virtual void ReloadAsync(T entity)
 0111        {
 0112            await Context.Entry<T>(entity).ReloadAsync();
 0113        }
 114
 115        public virtual IQueryable<T> FindByReadOnly(Expression<Func<T, bool>> predicate)
 116        {
 117            IQueryable<T> query = Context.Set<T>().AsNoTracking().Where(predicate);
 118            return query;
 119        }
 120
 121        public virtual IQueryable<T> GetAll()
 122        {
 123            IQueryable<T> query = Context.Set<T>().AsNoTracking();
 124
 125            return query;
 126        }
 127
 128        public virtual T Add(T entity)
 129        {
 130            Context.Set<T>().Add(entity);
 131
 132            return entity;
 133        }
 134
 135        public virtual IEnumerable<T> Add(IEnumerable<T> entities)
 136        {
 137            Context.Set<T>().AddRange(entities);
 138
 139            return entities;
 140        }
 64            IQueryable<T> query = Context.Set<T>().Where(predicate);
 65            return query;
 66        }
 67
 68        public virtual bool Exists(Expression<Func<T, bool>> predicate)
 69        {
 70            return Context.Set<T>().AsNoTracking().Any(predicate);
 71        }
 72
 73        public virtual void Delete(T entity)
 74        {
 75            Context.Set<T>().Remove(entity);
 76        }
 77
 78        public virtual void Delete(IEnumerable<T> entities)
 79        {
 80            foreach (T entity in entities)
 81            {
 82                Delete(entity);
 83            }
 84        }
 85
 86        public virtual void Reload(T entity)
 87        {
 88            Context.Entry<T>(entity).Reload();
 89        }
 90
 91        public async virtual Task ReloadAsync(T entity)
 192        {
 193            await Context.Entry<T>(entity).ReloadAsync();
 194        }
 95
 96        public virtual IQueryable<T> FindByReadOnly(Expression<Func<T, bool>> predicate)
 97        {
 98            IQueryable<T> query = Context.Set<T>().AsNoTracking().Where(predicate);
 99            return query;
 100        }
 101
 102        public virtual IQueryable<T> GetAll()
 103        {
 104            IQueryable<T> query = Context.Set<T>().AsNoTracking();
 105
 106            return query;
 107        }
 108
 109        public virtual T Add(T entity)
 110        {
 111            Context.Set<T>().Add(entity);
 112
 113            return entity;
 114        }
 115
 116        public virtual IEnumerable<T> Add(IEnumerable<T> entities)
 117        {
 118            Context.Set<T>().AddRange(entities);
 119
 120            return entities;
 121        }
 122
 123        public virtual void Update(T entity, int id)
 124        {
 125            var entityToUpdate = Context.Set<T>().Find(id);
 126
 127            if (entityToUpdate == null) throw CreateEntityNotFoundException<ArgumentOutOfRangeException>(id.ToString(), 
 128
 129            Context.Entry(entityToUpdate).CurrentValues.SetValues(entity);
 130
 131            MarkIgnoreFields(entityToUpdate);
 132        }
 133
 134        public virtual void Update(T entity, Expression<Func<T, bool>> predicate)
 135        {
 136            var entityToUpdate = Context.Set<T>().Where(predicate).SingleOrDefault();
 137
 138            if (entityToUpdate == null) throw CreateEntityNotFoundException<ArgumentOutOfRangeException>(predicate.ToStr
 139
 140            Context.Entry(entityToUpdate).CurrentValues.SetValues(entity);
 141
 142        public virtual void Update(T entity, int id)
 143        {
 144            var entityToUpdate = Context.Set<T>().Find(id);
 145
 146            if (entityToUpdate == null) throw new Exception(string.Format("{0} is not a valid identity key for {1}.", id
 147
 148            Context.Entry(entityToUpdate).CurrentValues.SetValues(entity);
 149
 150            MarkIgnoreFields(entityToUpdate);
 151        }
 152
 153        public virtual void Update(T entity, Expression<Func<T, bool>> predicate)
 154        {
 155            var entityToUpdate = Context.Set<T>().Where(predicate).SingleOrDefault();
 156
 157            if (entityToUpdate == null) throw new Exception(string.Format("{0} is not a valid identity key for {1}.", pr
 142            MarkIgnoreFields(entityToUpdate);
 143        }
 144
 145        public virtual void Update(Delta<T> delta, params object[] ids)
 146        {
 147            var entityToUpdate = Context.Set<T>().Find(ids);
 148
 149            if (entityToUpdate == null) throw CreateEntityNotFoundException<ArgumentOutOfRangeException>(ids.ToString(),
 150
 151            foreach (string field in delta.UpdatedFields())
 152            {
 153                var fieldToSet = typeof(T).GetProperty(field);
 154                var dataOrigion = delta.Internal.GetType().GetProperty(field);
 155
 156                fieldToSet.SetValue(entityToUpdate, dataOrigion.GetValue(delta.Internal));
 157            }
 158
 159            Context.Entry(entityToUpdate).CurrentValues.SetValues(entity);
 160
 161            MarkIgnoreFields(entityToUpdate);
 162        }
 163
 164        public virtual void Update(Delta<T> delta, params object[] ids)
 165        {
 166            var entityToUpdate = Context.Set<T>().Find(ids);
 159            MarkIgnoreFields(entityToUpdate);
 160        }
 161
 162        public void Update(Delta<T> delta, Expression<Func<T, bool>> predicate)
 163        {
 164            var entityToUpdate = Context.Set<T>().Where(predicate).SingleOrDefault();
 165
 166            if (entityToUpdate == null) throw CreateEntityNotFoundException<ArgumentOutOfRangeException>(predicate.ToStr
 167
 168            if (entityToUpdate == null) throw new Exception(string.Format("{0} is not a valid identity keys for {1}.", i
 169
 170            foreach (string field in delta.UpdatedFields())
 171            {
 172                var fieldToSet = typeof(T).GetProperty(field);
 173                var dataOrigion = delta.Internal.GetType().GetProperty(field);
 174
 175                fieldToSet.SetValue(entityToUpdate, dataOrigion.GetValue(delta.Internal));
 176            }
 177
 178            MarkIgnoreFields(entityToUpdate);
 179        }
 180
 181        protected virtual void MarkIgnoreFields(T entityToUpdate)
 182        {
 183            if(IgnoreFieldsOnUpdate.IsValueCreated)
 184            {
 185                foreach(var item in IgnoreFieldsOnUpdate.Value)
 186                {
 187                    Context.Entry(entityToUpdate).Property(item).IsModified = false;
 188                }
 189            }
 190
 191        }
 192
 193        public async virtual Task<int> SaveAsync()
 0194        {
 0195            return await Context.SaveChangesAsync();
 0196        }
 197
 198        public virtual int Save()
 199        {
 200            return Context.SaveChanges();
 201        }
 202
 203        public async virtual Task<int> SaveAsync(string userName)
 0204        {
 0205            return await Context.SaveChangesAsync(userName);
 0206        }
 207
 208        public virtual int Save(string userName)
 209        {
 210            return Context.SaveChanges(userName);
 211        }
 212
 213        public virtual int Count()
 214        {
 215            return Context.Set<T>().Count();
 216        }
 217
 218        public async virtual Task<int> CountAsync()
 0219        {
 0220            return await Context.Set<T>().CountAsync();
 0221        }
 222
 223        #region IDisposable Support
 224        private bool disposedValue = false; // To detect redundant calls
 225
 226        protected virtual void Dispose(bool disposing)
 227        {
 228            if (!disposedValue)
 229            {
 230                if (disposing)
 231                {
 232                    if (Context != null)
 233                    {
 234                        Context.Dispose();
 235                        Context = null;
 236                    }
 237                }
 238
 239                disposedValue = true;
 240            }
 241        }
 242
 243        public void Dispose()
 244        {
 245            Dispose(true);
 246        }
 247        #endregion
 248
 249    }
 250}
 168            foreach (string field in delta.UpdatedFields())
 169            {
 170                var fieldToSet = typeof(T).GetProperty(field);
 171                var dataOrigion = delta.Internal.GetType().GetProperty(field);
 172
 173                fieldToSet.SetValue(entityToUpdate, dataOrigion.GetValue(delta.Internal));
 174            }
 175
 176            MarkIgnoreFields(entityToUpdate);
 177        }
 178
 179        protected virtual E CreateEntityNotFoundException<E>(string entityId, string entityType)
 180        {
 181            return (E)Activator.CreateInstance(typeof(E), string.Format("{0} is not a valid identity key(s) for {1}.", e
 182        }
 183
 184        protected virtual void MarkIgnoreFields(T entityToUpdate)
 185        {
 186            if(IgnoreFieldsOnUpdate.IsValueCreated)
 1187            { IgnoreFieldsOnUpdate.Value.ForEach(ignoreField => Context.Entry(entityToUpdate).Property(ignoreField).IsMo
 188
 189
 190            if(IgnoreFieldsOnUpdate2.IsValueCreated)
 0191            { IgnoreFieldsOnUpdate2.Value.ForEach(ignoreField => Context.Entry(entityToUpdate).Property(ignoreField).IsM
 192        }
 193
 194        public async virtual Task<int> SaveAsync()
 0195        {
 0196            return await Context.SaveChangesAsync();
 0197        }
 198
 199        public virtual int Save()
 200        {
 201            return Context.SaveChanges();
 202        }
 203
 204        public virtual int Count()
 205        {
 206            return Context.Set<T>().Count();
 207        }
 208
 209        public async virtual Task<int> CountAsync()
 0210        {
 0211            return await Context.Set<T>().CountAsync();
 0212        }
 213
 214        #region IDisposable Support
 215        private bool disposedValue = false; // To detect redundant calls
 216
 217        protected virtual void Dispose(bool disposing)
 218        {
 219            if (!disposedValue)
 220            {
 221                if (disposing)
 222                {
 223                    if (Context != null)
 224                    {
 225                        Context.Dispose();
 226                        Context = null;
 227                    }
 228                }
 229
 230                disposedValue = true;
 231            }
 232        }
 233
 234        public void Dispose()
 235        {
 236            Dispose(true);
 237        }
 238        #endregion
 239
 240    }
 241}
-
+
diff --git a/CodeCoverageReport/entityframeworkauditablerepository6.dll_BaseRepository_C__T_.htm b/CodeCoverageReport/entityframework.auditable.repository6.dll_BaseRepository_C__T_.htm similarity index 61% rename from CodeCoverageReport/entityframeworkauditablerepository6.dll_BaseRepository_C__T_.htm rename to CodeCoverageReport/entityframework.auditable.repository6.dll_BaseRepository_C__T_.htm index 07080c7..8ac76c6 100644 --- a/CodeCoverageReport/entityframeworkauditablerepository6.dll_BaseRepository_C__T_.htm +++ b/CodeCoverageReport/entityframework.auditable.repository6.dll_BaseRepository_C__T_.htm @@ -3,7 +3,7 @@ -EntityFrameworkAuditableRepository6.Base.BaseRepository<C, T> - Coverage Report +EntityFramework.Repository6.BaseRepository<C, T> - Coverage Report

Summary

@@ -13,50 +13,52 @@

Summary

-Class:EntityFrameworkAuditableRepository6.Base.BaseRepository<C, T> -Assembly:entityframeworkauditablerepository6.dll -File(s):C:\Development\EntityFrameworkRepository6\EntityFrameworkAuditableRepository6\BaseRepository.cs -Covered lines:81 -Uncovered lines:26 -Coverable lines:107 -Total lines:250 -Line coverage:75.7% +Class:EntityFramework.Repository6.BaseRepository<C, T> +Assembly:entityframework.auditable.repository6.dll +File(s):C:\Development\EntityFrameworkRepository6\EntityFrameworkRepository6\BaseRepository.cs +Covered lines:119 +Uncovered lines:4 +Coverable lines:123 +Total lines:241 +Line coverage:96.7%

Metrics

+ + - - - - - + + + + + - + - - - + + + + + - -
MethodBlocks covered  Blocks not covered  
BaseRepository(C)50
AddUpdateIgnoreField(string)30
AddUpdateIgnoreField(System.Linq.Expressions.Expression<System.Func<T, bool>>)03
Find(int)50
Find(object[])50
FindBy(System.Linq.Expressions.Expression<System.Func<T, bool>>)50
Exists(System.Linq.Expressions.Expression<System.Func<T, bool>>)06
Delete(T)04
Delete(System.Collections.Generic.IEnumerable<T>)09
Reload(T)04
FindByReadOnly(System.Linq.Expressions.Expression<System.Func<T, bool>>)06
Exists(System.Linq.Expressions.Expression<System.Func<T, bool>>)60
Delete(T)40
Delete(System.Collections.Generic.IEnumerable<T>)90
Reload(T)40
FindByReadOnly(System.Linq.Expressions.Expression<System.Func<T, bool>>)60
GetAll()50
Add(T)50
Add(System.Collections.Generic.IEnumerable<T>)05
Add(System.Collections.Generic.IEnumerable<T>)50
Update(T, int)105
Update(T, System.Linq.Expressions.Expression<System.Func<T, bool>>)170
Update(EntityFrameworkAuditableRepository6.Base.Delta<T>, object[])226
MarkIgnoreFields(T)160
Update(T, System.Linq.Expressions.Expression<System.Func<T, bool>>)160
Update(EntityFramework.Repository6.Delta<T>, object[])270
Update(EntityFramework.Repository6.Delta<T>, System.Linq.Expressions.Expression<System.Func<T, bool>>)280
CreateEntityNotFoundException<E>(string, string)50
MarkIgnoreFields(T)94
Save()40
Save(string)04
Count()50
Dispose(bool)110
Dispose()20
BaseRepository()30

File(s)

-

C:\Development\EntityFrameworkRepository6\EntityFrameworkAuditableRepository6\BaseRepository.cs

+

C:\Development\EntityFrameworkRepository6\EntityFrameworkRepository6\BaseRepository.cs

- + @@ -64,278 +66,271 @@

- + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - - - - - - - - + + + + + + + + + + + - + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + - - - - - - - - + + + + + + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
#LineLine coverage
 1using EntityFramework.Auditing;
 1using EntityFramework.Repository6.Interfaces;
 2using System;
 3using System.Collections.Generic;
 4using System.Data.Entity;
 6using System.Linq.Expressions;
 7using System.Threading.Tasks;
 8
 9namespace EntityFrameworkAuditableRepository6.Base
 9namespace EntityFramework.Repository6
 10{
 11    public interface IBaseRepository<C, T> : IDisposable
 12            where T : class
 13            where C : AuditDbContext
 14    {
 15        C Context { get; set; }
 16        IQueryable<T> GetAll();
 17        IQueryable<T> FindBy(Expression<Func<T, bool>> predicate);
 18        IQueryable<T> FindByReadOnly(Expression<Func<T, bool>> predicate);
 19        T Add(T entity);
 20        IEnumerable<T> Add(IEnumerable<T> entities);
 21        void Delete(T entity);
 22        void Delete(IEnumerable<T> entities);
 23        void Reload(T entity);
 24        void ReloadAsync(T entity);
 25        void Update(T entity, int id);
 26        void Update(T entity, Expression<Func<T, bool>> predicate);
 27        void Update(Delta<T> delta, params object[] ids);
 28        Task<int> SaveAsync();
 29        int Save();
 30        Task<int> SaveAsync(string userName);
 31        int Save(string userName);
 32        T Find(int id);
 33        T Find(params object[] ids);
 34        Task<T> FindAsync(int id);
 35        Task<T> FindAsync(params object[] ids);
 36        bool Exists(Expression<Func<T, bool>> predicate);
 37        void AddUpdateIgnoreField(string fieldName);
 38        int Count();
 39        Task<int> CountAsync();
 40    }
 41
 42    public abstract class BaseRepository<C, T> : IBaseRepository<C, T>,
 43            IDisposable
 44        where T : class
 45        where C : AuditDbContext
 46    {
 147        public C Context { get; set; }
 148        public Lazy<List<string>> IgnoreFieldsOnUpdate = new Lazy<List<string>>();
 11    public abstract class BaseRepository<C, T> :
 12            IBaseRepository<C, T>
 13            , IDisposable
 14        where T : class
 15        where C : DbContext
 16    {
 117        protected C Context { get; set; }
 118        protected Lazy<List<string>> IgnoreFieldsOnUpdate = new Lazy<List<string>>();
 119        protected Lazy<List<Expression<Func<T, bool>>>> IgnoreFieldsOnUpdate2 = new Lazy<List<Expression<Func<T, bool>>>
 20
 121        protected BaseRepository(C context)
 122        {
 123            Context = context;
 124        }
 25
 26        public virtual void AddUpdateIgnoreField(string fieldName)
 127        {
 128            IgnoreFieldsOnUpdate.Value.Add(fieldName);
 129        }
 30
 31        public virtual void AddUpdateIgnoreField(Expression<Func<T, bool>> fieldName)
 032        {
 033            IgnoreFieldsOnUpdate2.Value.Add(fieldName);
 034        }
 35
 36        public virtual T Find(int id)
 137        {
 138            T entity = Context.Set<T>().Find(id);
 39
 140            return entity;
 141        }
 42
 43        public virtual T Find(params object[] ids)
 144        {
 145            T entity = Context.Set<T>().Find(ids);
 46
 147            return entity;
 148        }
 49
 50        public void AddUpdateIgnoreField(string fieldName)
 151        {
 152            IgnoreFieldsOnUpdate.Value.Add(fieldName);
 153        }
 54
 55        public virtual T Find(int id)
 156        {
 157            T entity = Context.Set<T>().Find(id);
 58
 159            return entity;
 160        }
 50        public virtual async Task<T> FindAsync(int id)
 51        {
 52            var query = Context.Set<T>().FindAsync(id);
 53            return await query;
 54        }
 55
 56        public virtual async Task<T> FindAsync(params object[] ids)
 57        {
 58            var query = Context.Set<T>().FindAsync(ids);
 59            return await query;
 60        }
 61
 62        public virtual T Find(params object[] ids)
 62        public virtual IQueryable<T> FindBy(Expression<Func<T, bool>> predicate)
 163        {
 164            T entity = Context.Set<T>().Find(ids);
 65
 166            return entity;
 167        }
 68
 69        public virtual async Task<T> FindAsync(int id)
 70        {
 71            var query = Context.Set<T>().FindAsync(id);
 72            return await query;
 73        }
 74
 75        public virtual async Task<T> FindAsync(params object[] ids)
 76        {
 77            var query = Context.Set<T>().FindAsync(ids);
 78            return await query;
 79        }
 80
 81        public virtual IQueryable<T> FindBy(Expression<Func<T, bool>> predicate)
 182        {
 183            IQueryable<T> query = Context.Set<T>().Where(predicate);
 184            return query;
 185        }
 86
 87        public virtual bool Exists(Expression<Func<T, bool>> predicate)
 088        {
 089            return Context.Set<T>().AsNoTracking().Any(predicate);
 090        }
 91
 92        public virtual void Delete(T entity)
 093        {
 094            Context.Set<T>().Remove(entity);
 095        }
 96
 97        public virtual void Delete(IEnumerable<T> entities)
 098        {
 099            foreach (T entity in entities)
 0100            {
 0101                Delete(entity);
 0102            }
 0103        }
 104
 105        public virtual void Reload(T entity)
 0106        {
 0107            Context.Entry<T>(entity).Reload();
 0108        }
 109
 110        public async virtual void ReloadAsync(T entity)
 111        {
 112            await Context.Entry<T>(entity).ReloadAsync();
 113        }
 114
 115        public virtual IQueryable<T> FindByReadOnly(Expression<Func<T, bool>> predicate)
 0116        {
 0117            IQueryable<T> query = Context.Set<T>().AsNoTracking().Where(predicate);
 0118            return query;
 0119        }
 120
 121        public virtual IQueryable<T> GetAll()
 1122        {
 1123            IQueryable<T> query = Context.Set<T>().AsNoTracking();
 124
 1125            return query;
 1126        }
 127
 128        public virtual T Add(T entity)
 1129        {
 1130            Context.Set<T>().Add(entity);
 131
 1132            return entity;
 1133        }
 134
 135        public virtual IEnumerable<T> Add(IEnumerable<T> entities)
 0136        {
 0137            Context.Set<T>().AddRange(entities);
 138
 0139            return entities;
 0140        }
 164            IQueryable<T> query = Context.Set<T>().Where(predicate);
 165            return query;
 166        }
 67
 68        public virtual bool Exists(Expression<Func<T, bool>> predicate)
 169        {
 170            return Context.Set<T>().AsNoTracking().Any(predicate);
 171        }
 72
 73        public virtual void Delete(T entity)
 174        {
 175            Context.Set<T>().Remove(entity);
 176        }
 77
 78        public virtual void Delete(IEnumerable<T> entities)
 179        {
 180            foreach (T entity in entities)
 181            {
 182                Delete(entity);
 183            }
 184        }
 85
 86        public virtual void Reload(T entity)
 187        {
 188            Context.Entry<T>(entity).Reload();
 189        }
 90
 91        public async virtual Task ReloadAsync(T entity)
 92        {
 93            await Context.Entry<T>(entity).ReloadAsync();
 94        }
 95
 96        public virtual IQueryable<T> FindByReadOnly(Expression<Func<T, bool>> predicate)
 197        {
 198            IQueryable<T> query = Context.Set<T>().AsNoTracking().Where(predicate);
 199            return query;
 1100        }
 101
 102        public virtual IQueryable<T> GetAll()
 1103        {
 1104            IQueryable<T> query = Context.Set<T>().AsNoTracking();
 105
 1106            return query;
 1107        }
 108
 109        public virtual T Add(T entity)
 1110        {
 1111            Context.Set<T>().Add(entity);
 112
 1113            return entity;
 1114        }
 115
 116        public virtual IEnumerable<T> Add(IEnumerable<T> entities)
 1117        {
 1118            Context.Set<T>().AddRange(entities);
 119
 1120            return entities;
 1121        }
 122
 123        public virtual void Update(T entity, int id)
 1124        {
 1125            var entityToUpdate = Context.Set<T>().Find(id);
 126
 1127            if (entityToUpdate == null) throw CreateEntityNotFoundException<ArgumentOutOfRangeException>(id.ToString(), 
 128
 1129            Context.Entry(entityToUpdate).CurrentValues.SetValues(entity);
 130
 1131            MarkIgnoreFields(entityToUpdate);
 1132        }
 133
 134        public virtual void Update(T entity, Expression<Func<T, bool>> predicate)
 1135        {
 1136            var entityToUpdate = Context.Set<T>().Where(predicate).SingleOrDefault();
 137
 1138            if (entityToUpdate == null) throw CreateEntityNotFoundException<ArgumentOutOfRangeException>(predicate.ToStr
 139
 1140            Context.Entry(entityToUpdate).CurrentValues.SetValues(entity);
 141
 142        public virtual void Update(T entity, int id)
 1143        {
 1144            var entityToUpdate = Context.Set<T>().Find(id);
 145
 1146            if (entityToUpdate == null) throw new Exception(string.Format("{0} is not a valid identity key for {1}.", id
 147
 1148            Context.Entry(entityToUpdate).CurrentValues.SetValues(entity);
 149
 1150            MarkIgnoreFields(entityToUpdate);
 1151        }
 152
 153        public virtual void Update(T entity, Expression<Func<T, bool>> predicate)
 1154        {
 1155            var entityToUpdate = Context.Set<T>().Where(predicate).SingleOrDefault();
 156
 1157            if (entityToUpdate == null) throw new Exception(string.Format("{0} is not a valid identity key for {1}.", pr
 1142            MarkIgnoreFields(entityToUpdate);
 1143        }
 144
 145        public virtual void Update(Delta<T> delta, params object[] ids)
 1146        {
 1147            var entityToUpdate = Context.Set<T>().Find(ids);
 148
 1149            if (entityToUpdate == null) throw CreateEntityNotFoundException<ArgumentOutOfRangeException>(ids.ToString(),
 150
 1151            foreach (string field in delta.UpdatedFields())
 1152            {
 1153                var fieldToSet = typeof(T).GetProperty(field);
 1154                var dataOrigion = delta.Internal.GetType().GetProperty(field);
 155
 1156                fieldToSet.SetValue(entityToUpdate, dataOrigion.GetValue(delta.Internal));
 1157            }
 158
 1159            Context.Entry(entityToUpdate).CurrentValues.SetValues(entity);
 160
 1161            MarkIgnoreFields(entityToUpdate);
 1162        }
 163
 164        public virtual void Update(Delta<T> delta, params object[] ids)
 1165        {
 1166            var entityToUpdate = Context.Set<T>().Find(ids);
 1159            MarkIgnoreFields(entityToUpdate);
 1160        }
 161
 162        public void Update(Delta<T> delta, Expression<Func<T, bool>> predicate)
 1163        {
 1164            var entityToUpdate = Context.Set<T>().Where(predicate).SingleOrDefault();
 165
 1166            if (entityToUpdate == null) throw CreateEntityNotFoundException<ArgumentOutOfRangeException>(predicate.ToStr
 167
 1168            if (entityToUpdate == null) throw new Exception(string.Format("{0} is not a valid identity keys for {1}.", i
 169
 1170            foreach (string field in delta.UpdatedFields())
 1171            {
 1172                var fieldToSet = typeof(T).GetProperty(field);
 1173                var dataOrigion = delta.Internal.GetType().GetProperty(field);
 174
 1175                fieldToSet.SetValue(entityToUpdate, dataOrigion.GetValue(delta.Internal));
 1176            }
 177
 1178            MarkIgnoreFields(entityToUpdate);
 1179        }
 180
 181        protected virtual void MarkIgnoreFields(T entityToUpdate)
 1182        {
 1183            if(IgnoreFieldsOnUpdate.IsValueCreated)
 1184            {
 1185                foreach(var item in IgnoreFieldsOnUpdate.Value)
 1186                {
 1187                    Context.Entry(entityToUpdate).Property(item).IsModified = false;
 1188                }
 1189            }
 190
 1191        }
 192
 193        public async virtual Task<int> SaveAsync()
 194        {
 195            return await Context.SaveChangesAsync();
 196        }
 197
 198        public virtual int Save()
 1199        {
 1200            return Context.SaveChanges();
 1201        }
 202
 203        public async virtual Task<int> SaveAsync(string userName)
 204        {
 205            return await Context.SaveChangesAsync(userName);
 206        }
 207
 208        public virtual int Save(string userName)
 0209        {
 0210            return Context.SaveChanges(userName);
 0211        }
 212
 213        public virtual int Count()
 1214        {
 1215            return Context.Set<T>().Count();
 1216        }
 217
 218        public async virtual Task<int> CountAsync()
 219        {
 220            return await Context.Set<T>().CountAsync();
 221        }
 222
 223        #region IDisposable Support
 1224        private bool disposedValue = false; // To detect redundant calls
 225
 226        protected virtual void Dispose(bool disposing)
 1227        {
 1228            if (!disposedValue)
 1229            {
 1230                if (disposing)
 1231                {
 1232                    if (Context != null)
 1233                    {
 1234                        Context.Dispose();
 1235                        Context = null;
 1236                    }
 1237                }
 238
 1239                disposedValue = true;
 1240            }
 1241        }
 242
 243        public void Dispose()
 1244        {
 1245            Dispose(true);
 1246        }
 247        #endregion
 248
 249    }
 250}
 1168            foreach (string field in delta.UpdatedFields())
 1169            {
 1170                var fieldToSet = typeof(T).GetProperty(field);
 1171                var dataOrigion = delta.Internal.GetType().GetProperty(field);
 172
 1173                fieldToSet.SetValue(entityToUpdate, dataOrigion.GetValue(delta.Internal));
 1174            }
 175
 1176            MarkIgnoreFields(entityToUpdate);
 1177        }
 178
 179        protected virtual E CreateEntityNotFoundException<E>(string entityId, string entityType)
 1180        {
 1181            return (E)Activator.CreateInstance(typeof(E), string.Format("{0} is not a valid identity key(s) for {1}.", e
 1182        }
 183
 184        protected virtual void MarkIgnoreFields(T entityToUpdate)
 1185        {
 1186            if(IgnoreFieldsOnUpdate.IsValueCreated)
 1187            { IgnoreFieldsOnUpdate.Value.ForEach(ignoreField => Context.Entry(entityToUpdate).Property(ignoreField).IsMo
 188
 189
 1190            if(IgnoreFieldsOnUpdate2.IsValueCreated)
 0191            { IgnoreFieldsOnUpdate2.Value.ForEach(ignoreField => Context.Entry(entityToUpdate).Property(ignoreField).IsM
 1192        }
 193
 194        public async virtual Task<int> SaveAsync()
 195        {
 196            return await Context.SaveChangesAsync();
 197        }
 198
 199        public virtual int Save()
 1200        {
 1201            return Context.SaveChanges();
 1202        }
 203
 204        public virtual int Count()
 1205        {
 1206            return Context.Set<T>().Count();
 1207        }
 208
 209        public async virtual Task<int> CountAsync()
 210        {
 211            return await Context.Set<T>().CountAsync();
 212        }
 213
 214        #region IDisposable Support
 1215        private bool disposedValue = false; // To detect redundant calls
 216
 217        protected virtual void Dispose(bool disposing)
 1218        {
 1219            if (!disposedValue)
 1220            {
 1221                if (disposing)
 1222                {
 1223                    if (Context != null)
 1224                    {
 1225                        Context.Dispose();
 1226                        Context = null;
 1227                    }
 1228                }
 229
 1230                disposedValue = true;
 1231            }
 1232        }
 233
 234        public void Dispose()
 1235        {
 1236            Dispose(true);
 1237        }
 238        #endregion
 239
 240    }
 241}
-
+

Methods/Properties

-Context()
-Context(C)
-BaseRepository()
-AddUpdateIgnoreField(string)
-Find(int)
-Find(object[])
-FindBy(System.Linq.Expressions.Expression<System.Func<T, bool>>)
-Exists(System.Linq.Expressions.Expression<System.Func<T, bool>>)
-Delete(T)
-Delete(System.Collections.Generic.IEnumerable<T>)
-Reload(T)
-FindByReadOnly(System.Linq.Expressions.Expression<System.Func<T, bool>>)
-GetAll()
-Add(T)
-Add(System.Collections.Generic.IEnumerable<T>)
-Update(T, int)
-Update(T, System.Linq.Expressions.Expression<System.Func<T, bool>>)
-Update(EntityFrameworkAuditableRepository6.Base.Delta<T>, object[])
-MarkIgnoreFields(T)
-Save()
-Save(string)
-Count()
-Dispose(bool)
-Dispose()
+Context()
+Context(C)
+BaseRepository(C)
+AddUpdateIgnoreField(string)
+AddUpdateIgnoreField(System.Linq.Expressions.Expression<System.Func<T, bool>>)
+Find(int)
+Find(object[])
+FindBy(System.Linq.Expressions.Expression<System.Func<T, bool>>)
+Exists(System.Linq.Expressions.Expression<System.Func<T, bool>>)
+Delete(T)
+Delete(System.Collections.Generic.IEnumerable<T>)
+Reload(T)
+FindByReadOnly(System.Linq.Expressions.Expression<System.Func<T, bool>>)
+GetAll()
+Add(T)
+Add(System.Collections.Generic.IEnumerable<T>)
+Update(T, int)
+Update(T, System.Linq.Expressions.Expression<System.Func<T, bool>>)
+Update(EntityFramework.Repository6.Delta<T>, object[])
+Update(EntityFramework.Repository6.Delta<T>, System.Linq.Expressions.Expression<System.Func<T, bool>>)
+CreateEntityNotFoundException<E>(string, string)
+MarkIgnoreFields(T)
+Save()
+Count()
+Dispose(bool)
+Dispose()

diff --git a/CodeCoverageReport/entityframeworkrepository6.dll_DatabaseFactory_C_.htm b/CodeCoverageReport/entityframework.auditable.repository6.dll_DatabaseFactory_C_.htm similarity index 96% rename from CodeCoverageReport/entityframeworkrepository6.dll_DatabaseFactory_C_.htm rename to CodeCoverageReport/entityframework.auditable.repository6.dll_DatabaseFactory_C_.htm index 6cf17a8..e0c649a 100644 --- a/CodeCoverageReport/entityframeworkrepository6.dll_DatabaseFactory_C_.htm +++ b/CodeCoverageReport/entityframework.auditable.repository6.dll_DatabaseFactory_C_.htm @@ -3,7 +3,7 @@ -EntityFrameworkRepository6.Base.DatabaseFactory<C> - Coverage Report +EntityFramework.Repository6.DatabaseFactory<C> - Coverage Report

Summary

@@ -13,8 +13,8 @@

Summary

-Class:EntityFrameworkRepository6.Base.DatabaseFactory<C> -Assembly:entityframeworkrepository6.dll +Class:EntityFramework.Repository6.DatabaseFactory<C> +Assembly:entityframework.auditable.repository6.dll File(s):C:\Development\EntityFrameworkRepository6\EntityFrameworkRepository6\DatabaseFactory.cs Covered lines:0 Uncovered lines:11 @@ -39,7 +39,7 @@

 1using System;  2using System.Data.Entity;  34namespace EntityFrameworkRepository6.Base4namespace EntityFramework.Repository6  5{  6    public interface IDatabaseFactory<C>  7    { @@ -71,7 +71,7 @@

 33} -

+

Methods/Properties

diff --git a/CodeCoverageReport/entityframeworkauditablerepository6.dll_Delta_T_.htm b/CodeCoverageReport/entityframework.auditable.repository6.dll_Delta_T_.htm similarity index 77% rename from CodeCoverageReport/entityframeworkauditablerepository6.dll_Delta_T_.htm rename to CodeCoverageReport/entityframework.auditable.repository6.dll_Delta_T_.htm index 1a51075..ee4a4b9 100644 --- a/CodeCoverageReport/entityframeworkauditablerepository6.dll_Delta_T_.htm +++ b/CodeCoverageReport/entityframework.auditable.repository6.dll_Delta_T_.htm @@ -3,7 +3,7 @@ -EntityFrameworkAuditableRepository6.Base.Delta<T> - Coverage Report +EntityFramework.Repository6.Delta<T> - Coverage Report

Summary

@@ -13,13 +13,13 @@

Summary

-Class:EntityFrameworkAuditableRepository6.Base.Delta<T> -Assembly:entityframeworkauditablerepository6.dll -File(s):C:\Development\EntityFrameworkRepository6\EntityFrameworkAuditableRepository6\Delta.cs -Covered lines:22 +Class:EntityFramework.Repository6.Delta<T> +Assembly:entityframework.auditable.repository6.dll +File(s):C:\Development\EntityFrameworkRepository6\EntityFramework.SharedRepository\Delta.cs +Covered lines:23 Uncovered lines:0 -Coverable lines:22 -Total lines:41 +Coverable lines:23 +Total lines:43 Line coverage:100% @@ -33,64 +33,66 @@

Metrics

File(s)

-

C:\Development\EntityFrameworkRepository6\EntityFrameworkAuditableRepository6\Delta.cs

+

C:\Development\EntityFrameworkRepository6\EntityFramework.SharedRepository\Delta.cs

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
#LineLine coverage
 1using System;
 2using System.Collections;
 3using System.Collections.Generic;
 4using System.Reflection;
 5
 6namespace EntityFrameworkAuditableRepository6.Base
 7{
 8    public class Delta<T> where T : class
 9    {
 110        List<string> Fields { get; set; }
 111        public T Internal { get; set; }
 12
 13        public List<string> UpdatedFields()
 114        {
 115            return Fields;
 116        }
 17
 118        public Delta()
 119        {
 120            Internal = (T)Activator.CreateInstance(typeof(T));
 121            Fields = new List<string>();
 122        }
 23
 24        public void SetValue(string fieldName, object data)
 125        {
 126            var prop1 = typeof(T).GetProperty(fieldName);
 127            if(prop1 == null)
 128            {
 129                throw new ArgumentException($"{fieldName} was not a property found on the object.");
 30            }
 31            try
 132            {
 133                prop1.SetValue(Internal, data);
 134                Fields.Add(fieldName);
 135            }catch(ArgumentException ex)
 136            {
 137                throw ex;
 38            }
 139        }
 40    }
 41}
 2using System.Collections.Generic;
 3using System.Linq;
 4using System.Text;
 5using System.Threading.Tasks;
 6
 7namespace EntityFramework.Repository6
 8{
 9    public class Delta<T> where T : class
 10    {
 111        List<string> Fields { get; set; }
 112        public T Internal { get; set; }
 13
 14        public List<string> UpdatedFields()
 115        {
 116            return Fields;
 117        }
 18
 119        public Delta()
 120        {
 121            Internal = (T)Activator.CreateInstance(typeof(T));
 122            Fields = new List<string>();
 123        }
 24
 25        public void SetValue(string fieldName, object data)
 126        {
 127            var prop1 = typeof(T).GetProperty(fieldName);
 128            if (prop1 == null)
 129            {
 130                throw new ArgumentException($"{fieldName} was not a property found on the object.");
 31            }
 32            try
 133            {
 134                prop1.SetValue(Internal, data);
 135                Fields.Add(fieldName);
 136            }
 137            catch (ArgumentException ex)
 138            {
 139                throw ex;
 40            }
 141        }
 42    }
 43}
-
+
diff --git a/CodeCoverageReport/entityframeworkauditablerepository6tests.dll_RepositoryCreateTests.htm b/CodeCoverageReport/entityframework.auditable.repository6.tests.dll_DeltaTests.htm similarity index 73% rename from CodeCoverageReport/entityframeworkauditablerepository6tests.dll_RepositoryCreateTests.htm rename to CodeCoverageReport/entityframework.auditable.repository6.tests.dll_DeltaTests.htm index 408da4e..edd5ac6 100644 --- a/CodeCoverageReport/entityframeworkauditablerepository6tests.dll_RepositoryCreateTests.htm +++ b/CodeCoverageReport/entityframework.auditable.repository6.tests.dll_DeltaTests.htm @@ -3,7 +3,7 @@ -EntityFrameworkAuditableRepository6Tests.RepositoryCreateTests - Coverage Report +EntityFramework.Repository6.Tests.DeltaTests - Coverage Report

Summary

@@ -13,14 +13,14 @@

Summary

-Class:EntityFrameworkAuditableRepository6Tests.RepositoryCreateTests -Assembly:entityframeworkauditablerepository6tests.dll -File(s):C:\Development\EntityFrameworkRepository6\EntityFrameworkAuditableRepository6Tests\RepositoryCreateTests.cs -Covered lines:62 -Uncovered lines:1 -Coverable lines:63 -Total lines:140 -Line coverage:98.4% +Class:EntityFramework.Repository6.Tests.DeltaTests +Assembly:entityframework.auditable.repository6.tests.dll +File(s):C:\Development\EntityFrameworkRepository6\EntityFrameworkAuditableRepository6Tests\DeltaTests.cs +Covered lines:64 +Uncovered lines:4 +Coverable lines:68 +Total lines:144 +Line coverage:94.1%

Metrics

@@ -28,15 +28,16 @@

Metrics

MethodBlocks covered  Blocks not covered   Setup()180 -InsertTestMethodAudit()140 -InsertTestMethod2Audit()140 -InsertTestMethod3Audit()140 -InsertIntoCompositeKeyTableMethodAudit()240 -InsertDuplicateIntoCompositeKeyTableMethodAudit()171 +DeltaTest1Audit()160 +DeltaTestWrongDataType1Audit()81 +DeltaTestInvalidFieldName1Audit()81 +DeltaTest2Audit()270 +DeltaTestFailAudit()91 +DeltaTestFailWithPredicateAudit()171

File(s)

-

C:\Development\EntityFrameworkRepository6\EntityFrameworkAuditableRepository6Tests\RepositoryCreateTests.cs

+

C:\Development\EntityFrameworkRepository6\EntityFrameworkAuditableRepository6Tests\DeltaTests.cs

@@ -44,17 +45,17 @@

- - - - - - + + + + + + - + - + @@ -67,133 +68,138 @@

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + - - - + + + - - - - - - - - - + + + + + + + + + - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + +
#LineLine coverage
 2using Microsoft.VisualStudio.TestTools.UnitTesting;
 3using System.Diagnostics;
 4using Microsoft.Practices.Unity;
 5using PersistentLayerAuditable.Repositories;
 6using System.Linq;
 7using PersistentLayerAuditable.Entities;
 8using System.Data.Entity.Infrastructure;
 9using EntityFrameworkAuditableRepository6.Base;
 10using EntityFramework.Auditing;
 5using System.Linq;
 6using System.Data.Entity.Infrastructure;
 7using PersistentLayer.Auditable.Repositories;
 8using EntityFramework.Auditable.Repository6.Tests;
 9using PersistentLayer.Auditable.Entities;
 10using EntityFramework.Repository6;
 11
 12namespace EntityFrameworkAuditableRepository6Tests
 12namespace EntityFramework.Repository6.Tests
 13{
 14    [TestClass]
 15    public class RepositoryCreateTests
 15    public class DeltaTests
 16    {
 117        UnityContainer LocalIoCContainer { get; set; }
 18
 125            LocalIoCContainer.RegisterType<ISimpleDataEntityRepository, SimpleDataEntityRepository>(new HierarchicalLife
 126            LocalIoCContainer.RegisterType<ISimpleCompositeKeyEntityRepository, SimpleCompositeKeyEntityRepository>(new 
 27
 28            //AuditDbContext.RegisterAuditType(typeof(SimpleDataEntity), typeof(SimpleDataAuditEntity));
 29
 30            //Use a physical database file
 31            //var connectionString = @"Data Source = (LocalDb)\MSSQLLocalDB; Database = TestDatabase; Integrated Securit
 32            //or
 33            //var connectionString = @"TestDatabase";
 34            //LocalIoCContainer.RegisterType(typeof(IDatabaseFactory<>), typeof(DatabaseFactory<>)
 35            //    , new HierarchicalLifetimeManager()
 36            //    , new InjectionConstructor(connectionString)
 37            //    , new InjectionProperty("Logging", logSetup));
 38
 39            //Use an nmemory database
 140            LocalIoCContainer.RegisterType(typeof(IDatabaseFactory<>), typeof(TestExampleDatabaseFactory)
 141                , new HierarchicalLifetimeManager()
 142                , new InjectionProperty("Logging", logSetup));
 143        }
 44
 45        [TestCategory("AuditRepository")]
 46        [TestMethod]
 47        public void InsertTestMethodAudit()
 148        {
 149            var repository = LocalIoCContainer.Resolve<ISimpleDataEntityRepository>();
 150            var newItem = new SimpleDataEntity { Name = "My Test" };
 151            var actual = repository.Add(newItem);
 152            var result = repository.Save();
 53
 154            Assert.AreNotEqual(0, actual.Id);
 55
 156            var actual2 = repository.Find(actual.Id);
 57
 158            Assert.AreEqual("My Test", actual2.Name);
 59
 160            repository.Dispose();
 28            //Use a physical database file
 29            //var connectionString = @"Data Source = (LocalDb)\MSSQLLocalDB; Database = TestDatabase; Integrated Securit
 30            //or
 31            //var connectionString = @"TestDatabase";
 32            //LocalIoCContainer.RegisterType(typeof(IDatabaseFactory<>), typeof(DatabaseFactory<>)
 33            //    , new HierarchicalLifetimeManager()
 34            //    , new InjectionConstructor(connectionString)
 35            //    , new InjectionProperty("Logging", logSetup));
 36
 37            //Use an nmemory database
 138            LocalIoCContainer.RegisterType(typeof(IDatabaseFactory<>), typeof(TestExampleDatabaseFactory)
 139                , new HierarchicalLifetimeManager()
 140                , new InjectionProperty("Logging", logSetup));
 141        }
 42
 43        [TestCategory("AuditRepository")]
 44        [TestMethod]
 45        public void DeltaTest1Audit()
 146        {
 147            var repository = LocalIoCContainer.Resolve<ISimpleDataEntityRepository>();
 148            var newItem = new SimpleDataEntity { Name = "Delta Test" };
 149            var actual = repository.Add(newItem);
 150            var result = repository.Save();
 51
 152            var delta1 = new Delta<SimpleDataEntity>();
 153            delta1.SetValue("Name", "Delta Change Test");
 54
 155            repository.Update(delta1, newItem.Id);
 56
 157            repository.Save();
 58
 159            var updatedValue = repository.Find(actual.Id);
 160            Assert.AreEqual("Delta Change Test", updatedValue.Name);
 161        }
 62
 63        [TestCategory("AuditRepository")]
 64        [TestMethod]
 65        public void InsertTestMethod2Audit()
 166        {
 167            var repository = LocalIoCContainer.Resolve<ISimpleDataEntityRepository>();
 168            var newItem = new SimpleDataEntity { Name = "My Test 200" };
 169            var actual = repository.Add(newItem);
 170            var result = repository.Save();
 71
 172            Assert.AreNotEqual(0, actual.Id);
 73
 174            var actual2 = repository.Find(actual.Id);
 75
 176            Assert.AreEqual("My Test 200", actual2.Name);
 77
 178            repository.Dispose();
 179        }
 80
 81        [TestCategory("AuditRepository")]
 82        [TestMethod]
 83        public void InsertTestMethod3Audit()
 184        {
 185            var repository = LocalIoCContainer.Resolve<ISimpleDataEntityRepository>();
 186            var newItem = new SimpleDataEntity { Name = "My Test 300" };
 187            var actual = repository.Add(newItem);
 188            var result = repository.Save();
 89
 190            Assert.AreNotEqual(0, actual.Id);
 65        [ExpectedException(typeof(ArgumentException))]
 66        public void DeltaTestWrongDataType1Audit()
 167        {
 168            var repository = LocalIoCContainer.Resolve<ISimpleDataEntityRepository>();
 169            var newItem = new SimpleDataEntity { Name = "Delta Test" };
 170            var actual = repository.Add(newItem);
 171            var result = repository.Save();
 72
 173            var delta1 = new Delta<SimpleDataEntity>();
 174            delta1.SetValue("Name", 1);
 075        }
 76
 77        [TestCategory("AuditRepository")]
 78        [TestMethod]
 79        [ExpectedException(typeof(ArgumentException))]
 80        public void DeltaTestInvalidFieldName1Audit()
 181        {
 182            var repository = LocalIoCContainer.Resolve<ISimpleDataEntityRepository>();
 183            var newItem = new SimpleDataEntity { Name = "Delta Test" };
 184            var actual = repository.Add(newItem);
 185            var result = repository.Save();
 86
 187            var delta1 = new Delta<SimpleDataEntity>();
 188            delta1.SetValue("NameNotRight", "Right data type");
 089        }
 90
 91
 192            var actual2 = repository.Find(actual.Id);
 93
 194            Assert.AreEqual("My Test 300", actual2.Name);
 95
 196            repository.Dispose();
 197        }
 98
 99        [TestCategory("AuditRepository")]
 100        [TestMethod]
 101        public void InsertIntoCompositeKeyTableMethodAudit()
 1102        {
 1103            var repository = LocalIoCContainer.Resolve<ISimpleCompositeKeyEntityRepository>();
 1104            var newItem = new SimpleCompositeKeyEntity { Id = 1, Name = "Composite Test" };
 1105            var actual = repository.Add(newItem);
 1106            var result = repository.Save();
 92        [TestCategory("AuditRepository")]
 93        [TestMethod]
 94        public void DeltaTest2Audit()
 195        {
 196            var repository = LocalIoCContainer.Resolve<ISimpleDataEntityRepository>();
 197            var newItem = new SimpleDataEntity { Name = "Delta Test" };
 198            var actual = repository.Add(newItem);
 199            var result = repository.Save();
 100
 1101            var delta2 = new Delta<SimpleDataEntity>();
 1102            delta2.SetValue("Name", "Delta Change Test 2");
 103
 1104            repository.Update(delta2, e => e.Id == newItem.Id);
 105
 1106            repository.Save();
 107
 1108            Assert.AreNotEqual(0, actual.Id);
 109
 1110            var actual2 = repository.Find(actual.Id, actual.Name);
 1108            var updatedValue = repository.Find(actual.Id);
 1109            Assert.AreEqual("Delta Change Test 2", updatedValue.Name);
 1110        }
 111
 1112            var saveAgain = repository.Add(new SimpleCompositeKeyEntity { Id = 2, Name = "Composite Test" });
 1113            var result2 = repository.Save();
 114
 1115            Assert.AreNotEqual(actual.Id, saveAgain.Id);
 116
 1117            Assert.AreEqual("Composite Test", actual2.Name);
 118
 1119            repository.Dispose();
 1120        }
 112        [TestCategory("AuditRepository")]
 113        [TestMethod]
 114        [ExpectedException(typeof(ArgumentOutOfRangeException))]
 115        public void DeltaTestFailAudit()
 1116        {
 1117            var repository = LocalIoCContainer.Resolve<ISimpleDataEntityRepository>();
 1118            var newItem = new SimpleDataEntity { Name = "Delta Test" };
 1119            var actual = repository.Add(newItem);
 1120            var result = repository.Save();
 121
 122        [TestCategory("AuditRepository")]
 123        [TestMethod]
 124        [ExpectedException(typeof(DbUpdateException))]
 125        public void InsertDuplicateIntoCompositeKeyTableMethodAudit()
 1126        {
 1127            var repository = LocalIoCContainer.Resolve<ISimpleCompositeKeyEntityRepository>();
 1128            var newItem = new SimpleCompositeKeyEntity { Id = 1, Name = "Composite Test" };
 1129            var actual = repository.Add(newItem);
 1130            var result = repository.Save();
 131
 1132            Assert.AreNotEqual(0, actual.Id);
 133
 1134            var actual2 = repository.Find(actual.Id, actual.Name);
 135
 1136            var saveAgain = repository.Add(new SimpleCompositeKeyEntity { Id = 1, Name = "Composite Test" });
 1137            var result2 = repository.Save();
 0138        }
 139    }
 140}
 1122            var delta1 = new Delta<SimpleDataEntity>();
 1123            delta1.SetValue("Name", "Delta Change Test");
 124
 1125            repository.Update(delta1, 55);
 0126        }
 127
 128        [TestCategory("AuditRepository")]
 129        [TestMethod]
 130        [ExpectedException(typeof(ArgumentOutOfRangeException))]
 131        public void DeltaTestFailWithPredicateAudit()
 1132        {
 1133            var repository = LocalIoCContainer.Resolve<ISimpleDataEntityRepository>();
 1134            var newItem = new SimpleDataEntity { Name = "Delta Test" };
 1135            var actual = repository.Add(newItem);
 1136            var result = repository.Save();
 137
 1138            var delta1 = new Delta<SimpleDataEntity>();
 1139            delta1.SetValue("Name", "Delta Change Test");
 140
 1141            repository.Update(delta1, x=>x.Id == 55);
 0142        }
 143    }
 144}
-
+
diff --git a/CodeCoverageReport/entityframework.auditable.repository6.tests.dll_RepositoryCreateTests.htm b/CodeCoverageReport/entityframework.auditable.repository6.tests.dll_RepositoryCreateTests.htm new file mode 100644 index 0000000..2af1a78 --- /dev/null +++ b/CodeCoverageReport/entityframework.auditable.repository6.tests.dll_RepositoryCreateTests.htm @@ -0,0 +1,230 @@ + + + + + +EntityFramework.Auditable.Repository6.Tests.RepositoryCreateTests - Coverage Report + +
+

Summary

+ ++++ + + + + + + + + + + +
Class:EntityFramework.Auditable.Repository6.Tests.RepositoryCreateTests
Assembly:entityframework.auditable.repository6.tests.dll
File(s):C:\Development\EntityFrameworkRepository6\EntityFrameworkAuditableRepository6Tests\RepositoryCreateTests.cs
Covered lines:80
Uncovered lines:1
Coverable lines:81
Total lines:168
Line coverage:98.7%
+

Metrics

+ + + + + + + + + + + +
MethodBlocks covered  Blocks not covered  
Setup()180
InsertTestMethodAudit()140
InsertTestMethod2Audit()140
InsertTestMethod3Audit()140
InsertMultipleTestAudit()200
InsertIntoCompositeKeyTableMethodAudit()240
InsertDuplicateIntoCompositeKeyTableMethodAudit()171
+

File(s)

+

C:\Development\EntityFrameworkRepository6\EntityFrameworkAuditableRepository6Tests\RepositoryCreateTests.cs

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
#LineLine coverage
 1using System;
 2using Microsoft.VisualStudio.TestTools.UnitTesting;
 3using System.Diagnostics;
 4using Microsoft.Practices.Unity;
 5using PersistentLayer.Auditable.Repositories;
 6using System.Linq;
 7using PersistentLayer.Auditable.Entities;
 8using System.Data.Entity.Infrastructure;
 9using EntityFramework.Auditing;
 10using EntityFramework.Repository6;
 11using System.Collections.Generic;
 12
 13namespace EntityFramework.Auditable.Repository6.Tests
 14{
 15    [TestClass]
 16    public class RepositoryCreateTests
 17    {
 118        UnityContainer LocalIoCContainer { get; set; }
 19
 20        [TestInitialize]
 21        public void Setup()
 122        {
 123            Action<string> logSetup = message => Debug.WriteLine(message);
 24
 125            LocalIoCContainer = new UnityContainer();
 126            LocalIoCContainer.RegisterType<ISimpleDataEntityRepository, SimpleDataEntityRepository>(new HierarchicalLife
 127            LocalIoCContainer.RegisterType<ISimpleCompositeKeyEntityRepository, SimpleCompositeKeyEntityRepository>(new 
 28
 29            //AuditDbContext.RegisterAuditType(typeof(SimpleDataEntity), typeof(SimpleDataAuditEntity));
 30
 31            //Use a physical database file
 32            //var connectionString = @"Data Source = (LocalDb)\MSSQLLocalDB; Database = TestDatabase; Integrated Securit
 33            //or
 34            //var connectionString = @"TestDatabase";
 35            //LocalIoCContainer.RegisterType(typeof(IDatabaseFactory<>), typeof(DatabaseFactory<>)
 36            //    , new HierarchicalLifetimeManager()
 37            //    , new InjectionConstructor(connectionString)
 38            //    , new InjectionProperty("Logging", logSetup));
 39
 40            //Use an nmemory database
 141            LocalIoCContainer.RegisterType(typeof(IDatabaseFactory<>), typeof(TestExampleDatabaseFactory)
 142                , new HierarchicalLifetimeManager()
 143                , new InjectionProperty("Logging", logSetup));
 144        }
 45
 46        [TestCategory("AuditRepository")]
 47        [TestMethod]
 48        public void InsertTestMethodAudit()
 149        {
 150            var repository = LocalIoCContainer.Resolve<ISimpleDataEntityRepository>();
 151            var newItem = new SimpleDataEntity { Name = "My Test" };
 152            var actual = repository.Add(newItem);
 153            var result = repository.Save();
 54
 155            Assert.AreNotEqual(0, actual.Id);
 56
 157            var actual2 = repository.Find(actual.Id);
 58
 159            Assert.AreEqual("My Test", actual2.Name);
 60
 161            repository.Dispose();
 162        }
 63
 64        [TestCategory("AuditRepository")]
 65        [TestMethod]
 66        public void InsertTestMethod2Audit()
 167        {
 168            var repository = LocalIoCContainer.Resolve<ISimpleDataEntityRepository>();
 169            var newItem = new SimpleDataEntity { Name = "My Test 200" };
 170            var actual = repository.Add(newItem);
 171            var result = repository.Save();
 72
 173            Assert.AreNotEqual(0, actual.Id);
 74
 175            var actual2 = repository.Find(actual.Id);
 76
 177            Assert.AreEqual("My Test 200", actual2.Name);
 78
 179            repository.Dispose();
 180        }
 81
 82        [TestCategory("AuditRepository")]
 83        [TestMethod]
 84        public void InsertTestMethod3Audit()
 185        {
 186            var repository = LocalIoCContainer.Resolve<ISimpleDataEntityRepository>();
 187            var newItem = new SimpleDataEntity { Name = "My Test 300" };
 188            var actual = repository.Add(newItem);
 189            var result = repository.Save();
 90
 191            Assert.AreNotEqual(0, actual.Id);
 92
 193            var actual2 = repository.Find(actual.Id);
 94
 195            Assert.AreEqual("My Test 300", actual2.Name);
 96
 197            repository.Dispose();
 198        }
 99
 100        [TestCategory("AuditRepository")]
 101        [TestMethod]
 102        public void InsertMultipleTestAudit()
 1103        {
 1104            var repository = LocalIoCContainer.Resolve<ISimpleDataEntityRepository>();
 105
 1106            var actual1 = repository.Count();
 107
 1108            var newItem1 = new SimpleDataEntity { Name = "Multiple Item 1" };
 1109            var newItem2 = new SimpleDataEntity { Name = "Multiple Item 2" };
 1110            var newItem3 = new SimpleDataEntity { Name = "Multiple Item 3" };
 1111            var actual = repository.Add(new List<SimpleDataEntity>
 1112            {
 1113                newItem1
 1114                , newItem2
 1115                , newItem3
 1116            });
 1117            var result = repository.Save();
 118
 1119            var actual2 = repository.Count();
 120
 1121            Assert.AreEqual(7, actual1);
 1122            Assert.AreEqual(10, actual2);
 123
 1124            repository.Dispose();
 1125        }
 126
 127        [TestCategory("AuditRepository")]
 128        [TestMethod]
 129        public void InsertIntoCompositeKeyTableMethodAudit()
 1130        {
 1131            var repository = LocalIoCContainer.Resolve<ISimpleCompositeKeyEntityRepository>();
 1132            var newItem = new SimpleCompositeKeyEntity { Id = 1, Name = "Composite Test" };
 1133            var actual = repository.Add(newItem);
 1134            var result = repository.Save();
 135
 1136            Assert.AreNotEqual(0, actual.Id);
 137
 1138            var actual2 = repository.Find(actual.Id, actual.Name);
 139
 1140            var saveAgain = repository.Add(new SimpleCompositeKeyEntity { Id = 2, Name = "Composite Test" });
 1141            var result2 = repository.Save();
 142
 1143            Assert.AreNotEqual(actual.Id, saveAgain.Id);
 144
 1145            Assert.AreEqual("Composite Test", actual2.Name);
 146
 1147            repository.Dispose();
 1148        }
 149
 150        [TestCategory("AuditRepository")]
 151        [TestMethod]
 152        [ExpectedException(typeof(DbUpdateException))]
 153        public void InsertDuplicateIntoCompositeKeyTableMethodAudit()
 1154        {
 1155            var repository = LocalIoCContainer.Resolve<ISimpleCompositeKeyEntityRepository>();
 1156            var newItem = new SimpleCompositeKeyEntity { Id = 1, Name = "Composite Test" };
 1157            var actual = repository.Add(newItem);
 1158            var result = repository.Save();
 159
 1160            Assert.AreNotEqual(0, actual.Id);
 161
 1162            var actual2 = repository.Find(actual.Id, actual.Name);
 163
 1164            var saveAgain = repository.Add(new SimpleCompositeKeyEntity { Id = 1, Name = "Composite Test" });
 1165            var result2 = repository.Save();
 0166        }
 167    }
 168}
+
+
+ + \ No newline at end of file diff --git a/CodeCoverageReport/entityframework.auditable.repository6.tests.dll_RepositoryDeleteTests.htm b/CodeCoverageReport/entityframework.auditable.repository6.tests.dll_RepositoryDeleteTests.htm new file mode 100644 index 0000000..8cca252 --- /dev/null +++ b/CodeCoverageReport/entityframework.auditable.repository6.tests.dll_RepositoryDeleteTests.htm @@ -0,0 +1,142 @@ + + + + + +EntityFramework.Auditable.Repository6.Tests.RepositoryDeleteTests - Coverage Report + +
+

Summary

+ ++++ + + + + + + + + + + +
Class:EntityFramework.Auditable.Repository6.Tests.RepositoryDeleteTests
Assembly:entityframework.auditable.repository6.tests.dll
File(s):C:\Development\EntityFrameworkRepository6\EntityFrameworkAuditableRepository6Tests\RepositoryDeleteTests.cs
Covered lines:32
Uncovered lines:0
Coverable lines:32
Total lines:88
Line coverage:100%
+

Metrics

+ + + + + + + +
MethodBlocks covered  Blocks not covered  
Setup()180
DeleteTestMethod()110
DeleteMultipleTestMethod()250
+

File(s)

+

C:\Development\EntityFrameworkRepository6\EntityFrameworkAuditableRepository6Tests\RepositoryDeleteTests.cs

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
#LineLine coverage
 1using Microsoft.Practices.Unity;
 2using Microsoft.VisualStudio.TestTools.UnitTesting;
 3using PersistentLayer.Auditable.Entities;
 4using PersistentLayer.Auditable.Repositories;
 5using System;
 6using System.Collections.Generic;
 7using System.Diagnostics;
 8using System.Linq;
 9using System.Text;
 10using System.Threading.Tasks;
 11using EntityFramework.Repository6;
 12
 13namespace EntityFramework.Auditable.Repository6.Tests
 14{
 15    [TestClass]
 16    public class RepositoryDeleteTests
 17    {
 118        UnityContainer LocalIoCContainer { get; set; }
 19
 20        [TestInitialize]
 21        public void Setup()
 122        {
 123            Action<string> logSetup = message => Debug.WriteLine(message);
 24
 125            LocalIoCContainer = new UnityContainer();
 126            LocalIoCContainer.RegisterType<ISimpleDataEntityRepository, SimpleDataEntityRepository>(new HierarchicalLife
 127            LocalIoCContainer.RegisterType<ISimpleCompositeKeyEntityRepository, SimpleCompositeKeyEntityRepository>(new 
 28
 29            //Use a physical database file
 30            //var connectionString = @"Data Source = (LocalDb)\MSSQLLocalDB; Database = TestDatabase; Integrated Securit
 31            //or
 32            //var connectionString = @"TestDatabase";
 33            //LocalIoCContainer.RegisterType(typeof(IDatabaseFactory<>), typeof(DatabaseFactory<>)
 34            //    , new HierarchicalLifetimeManager()
 35            //    , new InjectionConstructor(connectionString)
 36            //    , new InjectionProperty("Logging", logSetup));
 37
 38            //Use an nmemory database
 139            LocalIoCContainer.RegisterType(typeof(IDatabaseFactory<>), typeof(TestExampleDatabaseFactory)
 140                , new HierarchicalLifetimeManager()
 141                , new InjectionProperty("Logging", logSetup));
 142        }
 43
 44        [TestCategory("AuditRepository")]
 45        [TestMethod]
 46        public void DeleteTestMethod()
 147        {
 148            var repository = LocalIoCContainer.Resolve<ISimpleDataEntityRepository>();
 49
 150            var actual1 = repository.Count();
 51
 152            var itemToDelete = repository.Find(1);
 53
 154            repository.Delete(itemToDelete);
 55
 156            repository.Save();
 57
 158            var actual2 = repository.Count();
 59
 160            Assert.AreEqual(7, actual1);
 161            Assert.AreEqual(6, actual2);
 62
 163            repository.Dispose();
 164        }
 65
 66        [TestCategory("AuditRepository")]
 67        [TestMethod]
 68        public void DeleteMultipleTestMethod()
 169        {
 170            var repository = LocalIoCContainer.Resolve<ISimpleDataEntityRepository>();
 71
 172            var actual1 = repository.Count();
 73
 174            var itemsToDelete = repository.FindBy(x => x.Id == 1 || x.Id == 2);
 75
 176            repository.Delete(itemsToDelete);
 77
 178            repository.Save();
 79
 180            var actual2 = repository.Count();
 81
 182            Assert.AreEqual(7, actual1);
 183            Assert.AreEqual(5, actual2);
 84
 185            repository.Dispose();
 186        }
 87    }
 88}
+
+
+ + \ No newline at end of file diff --git a/CodeCoverageReport/entityframeworkauditablerepository6tests.dll_RepositoryReadTests.htm b/CodeCoverageReport/entityframework.auditable.repository6.tests.dll_RepositoryReadTests.htm similarity index 63% rename from CodeCoverageReport/entityframeworkauditablerepository6tests.dll_RepositoryReadTests.htm rename to CodeCoverageReport/entityframework.auditable.repository6.tests.dll_RepositoryReadTests.htm index 2f22c4d..c950655 100644 --- a/CodeCoverageReport/entityframeworkauditablerepository6tests.dll_RepositoryReadTests.htm +++ b/CodeCoverageReport/entityframework.auditable.repository6.tests.dll_RepositoryReadTests.htm @@ -3,7 +3,7 @@ -EntityFrameworkAuditableRepository6Tests.RepositoryReadTests - Coverage Report +EntityFramework.Auditable.Repository6.Tests.RepositoryReadTests - Coverage Report

Summary

@@ -13,13 +13,13 @@

Summary

-Class:EntityFrameworkAuditableRepository6Tests.RepositoryReadTests -Assembly:entityframeworkauditablerepository6tests.dll +Class:EntityFramework.Auditable.Repository6.Tests.RepositoryReadTests +Assembly:entityframework.auditable.repository6.tests.dll File(s):C:\Development\EntityFrameworkRepository6\EntityFrameworkAuditableRepository6Tests\RepositoryReadTests.cs -Covered lines:46 +Covered lines:78 Uncovered lines:0 -Coverable lines:46 -Total lines:116 +Coverable lines:78 +Total lines:182 Line coverage:100% @@ -34,6 +34,10 @@

Metrics

SelectTestMethodAudit()160 FindAsyncTestAudit()80 FindAsyncMultipleParamsTestAudit()80 +FindByReadOnlyTestAudit()160 +ExistsTestAudit()140 +FindAndReloadAsyncTestAudit()150 +FindAndReloadTestAudit()130

File(s)

@@ -45,13 +49,13 @@

 2using Microsoft.VisualStudio.TestTools.UnitTesting;  3using System.Diagnostics;  4using Microsoft.Practices.Unity;5using PersistentLayerAuditable.Repositories;5using PersistentLayer.Auditable.Repositories;  6using System.Linq;7using EntityFrameworkAuditableRepository6.Base;8using EntityFramework.Auditing;9using PersistentLayerAuditable.Entities;7using EntityFramework.Auditing;8using PersistentLayer.Auditable.Entities;9using EntityFramework.Repository6;  1011namespace EntityFrameworkAuditableRepository6Tests11namespace EntityFramework.Auditable.Repository6.Tests  12{  13    [TestClass]  14    public class RepositoryReadTests @@ -155,11 +159,77 @@

 112  1113            repository.Dispose();  1114        }115    }116}115116        [TestCategory("AuditRepository")]117        [TestMethod]118        public void FindByReadOnlyTestAudit() + 1119        { + 1120            var repository = LocalIoCContainer.Resolve<ISimpleDataEntityRepository>();121 + 1122            var actual = repository.FindByReadOnly(x=>x.Id == 1).SingleOrDefault(); + 1123            Assert.AreEqual("Test 1", actual.Name);124 + 1125            repository.Dispose(); + 1126        }127128        [TestCategory("AuditRepository")]129        [TestMethod]130        public void ExistsTestAudit() + 1131        { + 1132            var repository = LocalIoCContainer.Resolve<ISimpleDataEntityRepository>();133 + 1134            var actual = repository.Exists(x => x.Id == 1); + 1135            Assert.IsTrue(actual);136 + 1137            repository.Dispose(); + 1138        }139140        [TestCategory("AuditRepository")]141        [TestMethod]142        public void FindAndReloadAsyncTestAudit() + 1143        { + 1144            var repository = LocalIoCContainer.Resolve<ISimpleDataEntityRepository>();145146            //Load the entity + 1147            var actualEntity = repository.FindAsync(2).Result; + 1148            Assert.AreEqual("Test 2", actualEntity.Name);149150            //Alter the entity + 1151            actualEntity.Name = "Test 10"; + 1152            Assert.AreEqual("Test 10", actualEntity.Name);153154            //Reload the entity from the database, resetting the data + 1155            repository.ReloadAsync(actualEntity).Wait();156 + 1157            Assert.AreEqual("Test 2", actualEntity.Name); + 1158            repository.Dispose(); + 1159        }160161        [TestCategory("AuditRepository")]162        [TestMethod]163        public void FindAndReloadTestAudit() + 1164        { + 1165            var repository = LocalIoCContainer.Resolve<ISimpleDataEntityRepository>();166167            //Load the entity + 1168            var actualEntity = repository.Find(2); + 1169            Assert.AreEqual("Test 2", actualEntity.Name);170171            //Alter the entity + 1172            actualEntity.Name = "Test 10"; + 1173            Assert.AreEqual("Test 10", actualEntity.Name);174175            //Reload the entity from the database, resetting the data + 1176            repository.Reload(actualEntity);177 + 1178            Assert.AreEqual("Test 2", actualEntity.Name); + 1179            repository.Dispose(); + 1180        }181    }182} -

+
diff --git a/CodeCoverageReport/entityframeworkauditablerepository6tests.dll_RepositoryUpdateTests.htm b/CodeCoverageReport/entityframework.auditable.repository6.tests.dll_RepositoryUpdateTests.htm similarity index 92% rename from CodeCoverageReport/entityframeworkauditablerepository6tests.dll_RepositoryUpdateTests.htm rename to CodeCoverageReport/entityframework.auditable.repository6.tests.dll_RepositoryUpdateTests.htm index 5ea2c0e..c074c97 100644 --- a/CodeCoverageReport/entityframeworkauditablerepository6tests.dll_RepositoryUpdateTests.htm +++ b/CodeCoverageReport/entityframework.auditable.repository6.tests.dll_RepositoryUpdateTests.htm @@ -3,7 +3,7 @@ -EntityFrameworkAuditableRepository6Tests.RepositoryUpdateTests - Coverage Report +EntityFramework.Auditable.Repository6.Tests.RepositoryUpdateTests - Coverage Report

Summary

@@ -13,13 +13,13 @@

Summary

-Class:EntityFrameworkAuditableRepository6Tests.RepositoryUpdateTests -Assembly:entityframeworkauditablerepository6tests.dll +Class:EntityFramework.Auditable.Repository6.Tests.RepositoryUpdateTests +Assembly:entityframework.auditable.repository6.tests.dll File(s):C:\Development\EntityFrameworkRepository6\EntityFrameworkAuditableRepository6Tests\RepositoryUpdateTests.cs -Covered lines:60 +Covered lines:61 Uncovered lines:1 -Coverable lines:61 -Total lines:144 +Coverable lines:62 +Total lines:142 Line coverage:98.3% @@ -31,7 +31,7 @@

Metrics

UpdateTestMethodAudit()120 UpdateTestMethodWithIgnoreFieldFeatureAudit()130 UpdateByTestMethodAudit()190 -UpdateByAuditTestMethod()391 +UpdateByAuditTestMethod()422 UpdateByTestMethodIncorrectIdAudit()131 @@ -41,17 +41,17 @@

 1using EntityFramework.Auditing;2using EntityFrameworkAuditableRepository6.Base;2using EntityFramework.Repository6;  3using Microsoft.Practices.Unity;  4using Microsoft.VisualStudio.TestTools.UnitTesting;5using PersistentLayerAuditable.Entities;6using PersistentLayerAuditable.Repositories;5using PersistentLayer.Auditable.Entities;6using PersistentLayer.Auditable.Repositories;  7using System;  8using System.Data.Entity.Infrastructure;  9using System.Diagnostics;  10using System.Linq;  1112namespace EntityFrameworkAuditableRepository6Tests12namespace EntityFramework.Auditable.Repository6.Tests  13{  14    [TestClass]  15    public class RepositoryUpdateTests @@ -116,7 +116,7 @@

 174            var itemToUpdate = repository.Find(2);  175            itemToUpdate.Name = "Updated Name";  176            repository.Update(itemToUpdate, itemToUpdate.Id); - 177            repository.Save(); + 177            repository.Save("UserName1");  78  179            var actual = repository.Find(2);  80 @@ -156,37 +156,35 @@

 1114            itemToUpdate.Name = "Updated Name 3";  1115            repository.Update(itemToUpdate, x => x.Id == 2);  116117            //repository.Context.SimpleDataEntityAudits.Add(new SimpleDataEntityAudit { AuditSourceId = 2, Name = "Updat - 1118            repository.Save();119 - 1120            var actual = repository.Find(2);121 + 1117            repository.Save("UserName2");118 + 1119            var actual = repository.Find(2);120 + 1121            var auditactual = repository.GetExistingContext().SimpleDataEntityAudits.Where(x => x.AuditSourceId == 2).Fi  122123 - 1124            var auditactual = repository.Context.SimpleDataEntityAudits.Where(x => x.AuditSourceId == 2).FirstOrDefault(125 - 1126            Assert.AreEqual("Updated Name 3", actual.Name); - 1127            Assert.AreEqual("Test 2", auditactual?.Name);128 - 1129            repository.Dispose(); - 1130        }131132        [TestCategory("AuditRepository")]133        [TestMethod]134        [ExpectedException(typeof(System.Exception))]135        public void UpdateByTestMethodIncorrectIdAudit() - 1136        { - 1137            var repository = LocalIoCContainer.Resolve<ISimpleDataEntityRepository>();138 - 1139            var itemToUpdate = repository.Find(2); - 1140            itemToUpdate.Name = "Updated Name 2"; - 1141            repository.Update(itemToUpdate, x => x.Id == 55); - 0142        }143    }144} + 1123            Assert.AreEqual("Updated Name 3", actual.Name); + 1124            Assert.AreEqual("Test 2", auditactual?.Name); + 1125            Assert.AreEqual("UserName2", auditactual?.AuditUser);126 + 1127            repository.Dispose(); + 1128        }129130        [TestCategory("AuditRepository")]131        [TestMethod]132        [ExpectedException(typeof(ArgumentOutOfRangeException))]133        public void UpdateByTestMethodIncorrectIdAudit() + 1134        { + 1135            var repository = LocalIoCContainer.Resolve<ISimpleDataEntityRepository>();136 + 1137            var itemToUpdate = repository.Find(2); + 1138            itemToUpdate.Name = "Updated Name 2"; + 1139            repository.Update(itemToUpdate, x => x.Id == 55); + 0140        }141    }142} -

+
diff --git a/CodeCoverageReport/entityframeworkauditablerepository6tests.dll_TestDbInitializer.htm b/CodeCoverageReport/entityframework.auditable.repository6.tests.dll_TestDbInitializer.htm similarity index 91% rename from CodeCoverageReport/entityframeworkauditablerepository6tests.dll_TestDbInitializer.htm rename to CodeCoverageReport/entityframework.auditable.repository6.tests.dll_TestDbInitializer.htm index 5ab3fe2..53b5dda 100644 --- a/CodeCoverageReport/entityframeworkauditablerepository6tests.dll_TestDbInitializer.htm +++ b/CodeCoverageReport/entityframework.auditable.repository6.tests.dll_TestDbInitializer.htm @@ -3,7 +3,7 @@ -EntityFrameworkAuditableRepository6Tests.TestDbInitializer - Coverage Report +EntityFramework.Auditable.Repository6.Tests.TestDbInitializer - Coverage Report

Summary

@@ -13,8 +13,8 @@

Summary

-Class:EntityFrameworkAuditableRepository6Tests.TestDbInitializer -Assembly:entityframeworkauditablerepository6tests.dll +Class:EntityFramework.Auditable.Repository6.Tests.TestDbInitializer +Assembly:entityframework.auditable.repository6.tests.dll File(s):C:\Development\EntityFrameworkRepository6\EntityFrameworkAuditableRepository6Tests\SampleData\TestDbInitializer.cs Covered lines:7 Uncovered lines:0 @@ -27,7 +27,7 @@

Metrics

- +
MethodBlocks covered  Blocks not covered  
Seed(PersistentLayerAuditable.Contexts.YourCustomDataContext)110
Seed(PersistentLayer.Auditable.Contexts.YourCustomDataContext)110

File(s)

@@ -35,8 +35,8 @@

#LineLine coverage - 1using PersistentLayerAuditable.Contexts;2using PersistentLayerAuditable.Entities;1using PersistentLayer.Auditable.Contexts;2using PersistentLayer.Auditable.Entities;  3using System;  4using System.Collections.Generic;  5using System.Data.Entity; @@ -44,7 +44,7 @@

 7using System.Text;  8using System.Threading.Tasks;  910namespace EntityFrameworkAuditableRepository6Tests10namespace EntityFramework.Auditable.Repository6.Tests  11{  12    public class TestDbInitializer : DropCreateDatabaseAlways<YourCustomDataContext>  13    { @@ -61,11 +61,11 @@

 24} -

+
diff --git a/CodeCoverageReport/entityframeworkauditablerepository6tests.dll_TestExampleDatabaseFactory.htm b/CodeCoverageReport/entityframework.auditable.repository6.tests.dll_TestExampleDatabaseFactory.htm similarity index 93% rename from CodeCoverageReport/entityframeworkauditablerepository6tests.dll_TestExampleDatabaseFactory.htm rename to CodeCoverageReport/entityframework.auditable.repository6.tests.dll_TestExampleDatabaseFactory.htm index 417d9d7..95bd82e 100644 --- a/CodeCoverageReport/entityframeworkauditablerepository6tests.dll_TestExampleDatabaseFactory.htm +++ b/CodeCoverageReport/entityframework.auditable.repository6.tests.dll_TestExampleDatabaseFactory.htm @@ -3,7 +3,7 @@ -EntityFrameworkAuditableRepository6Tests.TestExampleDatabaseFactory - Coverage Report +EntityFramework.Auditable.Repository6.Tests.TestExampleDatabaseFactory - Coverage Report

Summary

@@ -13,8 +13,8 @@

Summary

-Class:EntityFrameworkAuditableRepository6Tests.TestExampleDatabaseFactory -Assembly:entityframeworkauditablerepository6tests.dll +Class:EntityFramework.Auditable.Repository6.Tests.TestExampleDatabaseFactory +Assembly:entityframework.auditable.repository6.tests.dll File(s):C:\Development\EntityFrameworkRepository6\EntityFrameworkAuditableRepository6Tests\SampleData\TestExampleDatabaseFactory.cs Covered lines:17 Uncovered lines:0 @@ -27,7 +27,7 @@

Metrics

- +
MethodBlocks covered  Blocks not covered  
GetNewDbContext()460
GetNewDbContext()710

File(s)

@@ -42,12 +42,12 @@

 5using System.Threading.Tasks;  6using System.Data.Entity;  7using Effort.Extra;8using PersistentLayerAuditable.Entities;9using PersistentLayerAuditable;10using PersistentLayerAuditable.Contexts;11using EntityFrameworkAuditableRepository6.Base;8using PersistentLayer.Auditable.Entities;9using PersistentLayer.Auditable;10using PersistentLayer.Auditable.Contexts;11using EntityFramework.Repository6;  1213namespace EntityFrameworkAuditableRepository6Tests13namespace EntityFramework.Auditable.Repository6.Tests  14{  15    public class TestExampleDatabaseFactory : IDatabaseFactory<YourCustomDataContext>  16    { @@ -57,11 +57,11 @@

 120        {  121            var data = new ObjectData();  22 - 123            data.Table<SimpleDataEntity>("SimpleDataEntities").Add(new SimpleDataEntity { Id = 1, Name = "Test 1" }); - 124            data.Table<SimpleDataEntity>("SimpleDataEntities").Add(new SimpleDataEntity { Id = 2, Name = "Test 2" }); - 125            data.Table<SimpleDataEntity>("SimpleDataEntities").Add(new SimpleDataEntity { Id = 3, Name = "Test 3" }); - 126            data.Table<SimpleDataEntity>("SimpleDataEntities").Add(new SimpleDataEntity { Id = 4, Name = "Test 4" }); - 127            data.Table<SimpleDataEntity>("SimpleDataEntities").Add(new SimpleDataEntity { Id = 5, Name = "Test 5" }); + 123            data.Table<SimpleDataEntity>("SimpleDataEntities").Add(new SimpleDataEntity { Id = 1, Name = "Test 1", Updat + 124            data.Table<SimpleDataEntity>("SimpleDataEntities").Add(new SimpleDataEntity { Id = 2, Name = "Test 2", Updat + 125            data.Table<SimpleDataEntity>("SimpleDataEntities").Add(new SimpleDataEntity { Id = 3, Name = "Test 3", Updat + 126            data.Table<SimpleDataEntity>("SimpleDataEntities").Add(new SimpleDataEntity { Id = 4, Name = "Test 4", Updat + 127            data.Table<SimpleDataEntity>("SimpleDataEntities").Add(new SimpleDataEntity { Id = 5, Name = "Test 5", Updat  28  129            data.Table<SimpleCompositeKeyEntity>("SimpleCompositeKeyEntities").Add(new SimpleCompositeKeyEntity { Id = 1  30 @@ -82,7 +82,7 @@

 45} -

+

Methods/Properties

diff --git a/CodeCoverageReport/entityframework.auditing.dll_AuditConfigurationSection.htm b/CodeCoverageReport/entityframework.auditing.dll_AuditConfigurationSection.htm index 766f88b..f567278 100644 --- a/CodeCoverageReport/entityframework.auditing.dll_AuditConfigurationSection.htm +++ b/CodeCoverageReport/entityframework.auditing.dll_AuditConfigurationSection.htm @@ -72,7 +72,7 @@

 42} -

+

Methods/Properties

diff --git a/CodeCoverageReport/entityframework.auditing.dll_AuditDbContext.htm b/CodeCoverageReport/entityframework.auditing.dll_AuditDbContext.htm index fd2052e..39e6945 100644 --- a/CodeCoverageReport/entityframework.auditing.dll_AuditDbContext.htm +++ b/CodeCoverageReport/entityframework.auditing.dll_AuditDbContext.htm @@ -16,11 +16,11 @@

Summary

Class:EntityFramework.Auditing.AuditDbContext Assembly:entityframework.auditing.dll File(s):C:\Development\EntityFrameworkRepository6\AuditDbContextLocal\AuditDbContext.cs -Covered lines:178 -Uncovered lines:38 -Coverable lines:216 -Total lines:430 -Line coverage:82.4% +Covered lines:157 +Uncovered lines:30 +Coverable lines:187 +Total lines:400 +Line coverage:83.9%

Metrics

@@ -29,16 +29,18 @@

Metrics

AuditDbContext()240 AuditDbContext(string)20 -AuditDbContext(System.Data.Common.DbConnection)20 +AuditDbContext(System.Data.Common.DbConnection)02 +AuditDbContext(System.Data.Common.DbConnection, bool)20 RegisterAuditType(System.Type, System.Type)454 Reload(object)30 Detach(object)02 SaveChanges()50 -SaveChanges(string)842 +SaveChanges(string)182 +CreateAuditRecords(string)700 AuditEntity(System.Data.Entity.Infrastructure.DbEntityEntry, EntityFramework.Auditing.AuditTypeInfo, System.DateTimeOffset, string)407 GetComplexTypes(EntityFramework.Auditing.AuditTypeInfo, System.Data.Entity.Infrastructure.DbEntityEntry)162 SaveChangesAsync()60 -SaveChangesAsync()4543 +SaveChangesAsync()814

File(s)

@@ -132,371 +134,343 @@

 84        /// </summary>  85        /// <param name="connection">DBConnection object that the context will connect to.</param>  86        public AuditDbContext(DbConnection connection) - 187            : base(connection, true) - 188        { + 087            : base(connection, true) + 088        {  89 - 190        } + 090        }  9192        #endregion9394        /// <summary>95        /// Gets a value indicating whether auditing is enabled on this context.96        /// </summary> - 197        public static bool AuditEnabled { get; private set; }9899        /// <summary>100        /// Gets a value indicating whether this context is using proxies.101        /// </summary>102        public bool Proxies103        {104            get - 1105            { - 1106                if (auditTypes.Count > 0) - 1107                { - 1108                    var f = auditTypes.First(); - 1109                    var e = this.Set(f.Value.EntityType).Create(); - 1110                    return e.GetType().Namespace != f.Value.EntityType.Namespace;111                }112 - 0113                return false; - 1114            }115        }116117        /// <summary>118        /// Registers and type for auditing.119        /// </summary>120        /// <param name="auditableEntityType">Type to audit, must implement IAuditableEntity.</param>121        /// <param name="auditEntityType">Type of audit entity, must implement IAuditEntity.</param>122        public static void RegisterAuditType(Type auditableEntityType, Type auditEntityType) - 1123        {124            // Basic parameter validation. - 1125            if (auditableEntityType == null) - 0126            { - 0127                throw new ArgumentNullException("auditableEntityType");128            }129 - 1130            if (auditTypes.ContainsKey(auditableEntityType)) - 1131            { - 1132                throw new ArgumentException("Type already registered for auditing.", "auditableEntityType");133            }134135            // Validate the entity. - 1136            var iface = auditableEntityType.GetInterface("IAuditableEntity"); - 1137            if (iface == null) - 1138            { - 1139                throw new ArgumentException("Entity does implement IAuditableEntity", "auditableEntityType");140            }141 - 1142            AuditTypeInfo info = new AuditTypeInfo { EntityType = auditableEntityType, AuditEntityType = auditEntityType143144            // Validate the auditEntity - 1145            if (auditEntityType != null) - 1146            { - 1147                iface = auditEntityType.GetInterface("IAuditEntity"); - 1148                if (iface == null) - 0149                { - 0150                    throw new ArgumentException("Entity does implement IAuditEntity", "auditEntityType");151                }92        /// <summary>93        ///94        /// </summary>95        /// <param name="connection"></param>96        /// <param name="contextOwnsConnection"></param>97        public AuditDbContext(DbConnection connection, bool contextOwnsConnection) + 198            : base(connection, contextOwnsConnection) + 199        {100 + 1101        }102103        #endregion104105        /// <summary>106        /// Gets a value indicating whether auditing is enabled on this context.107        /// </summary> + 1108        public static bool AuditEnabled { get; private set; }109110        /// <summary>111        /// Gets a value indicating whether this context is using proxies.112        /// </summary>113        public bool Proxies114        {115            get + 1116            { + 1117                if (auditTypes.Count > 0) + 1118                { + 1119                    var f = auditTypes.First(); + 1120                    var e = this.Set(f.Value.EntityType).Create(); + 1121                    return e.GetType().Namespace != f.Value.EntityType.Namespace;122                }123 + 0124                return false; + 1125            }126        }127128        /// <summary>129        /// Registers and type for auditing.130        /// </summary>131        /// <param name="auditableEntityType">Type to audit, must implement IAuditableEntity.</param>132        /// <param name="auditEntityType">Type of audit entity, must implement IAuditEntity.</param>133        public static void RegisterAuditType(Type auditableEntityType, Type auditEntityType) + 1134        {135            // Basic parameter validation. + 1136            if (auditableEntityType == null) + 0137            { + 0138                throw new ArgumentNullException("auditableEntityType");139            }140 + 1141            if (auditTypes.ContainsKey(auditableEntityType)) + 1142            { + 1143                throw new ArgumentException("Type already registered for auditing.", "auditableEntityType");144            }145146            // Validate the entity. + 1147            var iface = auditableEntityType.GetInterface("IAuditableEntity"); + 1148            if (iface == null) + 1149            { + 1150                throw new ArgumentException("Entity does implement IAuditableEntity", "auditableEntityType");151            }  152153                // Extract the list of propeties to audit. - 1154                var properties = auditEntityType.GetProperties(); - 1155                var entityProperties = auditableEntityType.GetProperties().ToDictionary(x => x.Name); - 1156                foreach (var property in properties) - 1157                { - 1158                    if (entityProperties.ContainsKey(property.Name)) - 1159                    { - 1160                        if (property.PropertyType == entityProperties[property.Name].PropertyType) - 1161                        { - 1162                            info.AuditProperties.Add(property.Name); - 1163                        } - 1164                    } - 1165                } - 1166            }167168            // Valid so register. - 1169            auditTypes.Add(auditableEntityType, info); - 1170        }171172        /// <summary>173        /// Reloads the entity from the database overwriting any property values with values from the database.174        /// The entity will be in the Unchanged state after calling this method.175        /// </summary>176        /// <param name="entity">The entity object to reload.</param>177        public void Reload(object entity) - 1178        { - 1179            this.Entry(entity).Reload(); - 1180        }181182        /// <summary>183        /// Detaches the entity from the context.184        /// </summary>185        /// <param name="entity"></param>186        public void Detach(object entity) - 0187        { - 0188            this.Detach(entity); - 0189        }190191        /// <summary>192        /// Saves all changes made in this context to the underlying database193        /// using the current windows user for auditing.194        /// </summary>195        /// <returns>The number of objects written to the underlying database.</returns>196        public override int SaveChanges() - 1197        { - 1198            return this.SaveChanges(WindowsIdentity.GetCurrent().Name); - 1199        }200201        /// <summary>202        /// Saves all changes made in this context to the underlying database203        /// using the current windows user for auditing.204        /// </summary>205        /// <returns>The number of objects written to the underlying database.</returns>206        public override async Task<int> SaveChangesAsync() - 1207        { - 1208            return await this.SaveChangesAsync(WindowsIdentity.GetCurrent().Name); - 1209        }210211        /// <summary>212        /// Saves all changes made in this context to the underlying database213        /// using the user paramater passed for auditing.214        /// </summary>215        /// <param name="user">User name for auditing.</param> + 1153            AuditTypeInfo info = new AuditTypeInfo { EntityType = auditableEntityType, AuditEntityType = auditEntityType154155            // Validate the auditEntity + 1156            if (auditEntityType != null) + 1157            { + 1158                iface = auditEntityType.GetInterface("IAuditEntity"); + 1159                if (iface == null) + 0160                { + 0161                    throw new ArgumentException("Entity does implement IAuditEntity", "auditEntityType");162                }163164                // Extract the list of properties to audit. + 1165                var properties = auditEntityType.GetProperties(); + 1166                var entityProperties = auditableEntityType.GetProperties().ToDictionary(x => x.Name); + 1167                foreach (var property in properties) + 1168                { + 1169                    if (entityProperties.ContainsKey(property.Name)) + 1170                    { + 1171                        if (property.PropertyType == entityProperties[property.Name].PropertyType) + 1172                        { + 1173                            info.AuditProperties.Add(property.Name); + 1174                        } + 1175                    } + 1176                } + 1177            }178179            // Valid so register. + 1180            auditTypes.Add(auditableEntityType, info); + 1181        }182183        /// <summary>184        /// Reloads the entity from the database overwriting any property values with values from the database.185        /// The entity will be in the Unchanged state after calling this method.186        /// </summary>187        /// <param name="entity">The entity object to reload.</param>188        public void Reload(object entity) + 1189        { + 1190            this.Entry(entity).Reload(); + 1191        }192193        /// <summary>194        /// Detaches the entity from the context.195        /// </summary>196        /// <param name="entity"></param>197        public void Detach(object entity) + 0198        { + 0199            this.Detach(entity); + 0200        }201202        /// <summary>203        /// Saves all changes made in this context to the underlying database204        /// using the current windows user for auditing.205        /// </summary>206        /// <returns>The number of objects written to the underlying database.</returns>207        public override int SaveChanges() + 1208        { + 1209            return this.SaveChanges(WindowsIdentity.GetCurrent().Name); + 1210        }211212        /// <summary>213        /// Saves all changes made in this context to the underlying database214        /// using the current windows user for auditing.215        /// </summary>  216        /// <returns>The number of objects written to the underlying database.</returns>217        public int SaveChanges(string user)217        public override async Task<int> SaveChangesAsync()  1218        { - 1219            if (AuditEnabled) - 1220            {221                // Track all audit entities created in this transaction, will be removed from context on exception. - 1222                List<IAuditEntity> audits = new List<IAuditEntity>();223224                // Use the same datetime for all updates in this transaction, retrieved from server when first used. - 1225                DateTimeOffset? updateDateTime = null;226227                // Process any auditable objects. - 1228                foreach (DbEntityEntry<IAuditableEntity> auditable in this.ChangeTracker.Entries<IAuditableEntity>()) - 1229                { - 1230                    if (auditable.State == EntityState.Added - 1231                        || auditable.State == EntityState.Modified - 1232                        || auditable.State == EntityState.Deleted) - 1233                    {234                        // Need datetime for the audits. - 1235                        if (updateDateTime.HasValue == false) - 1236                        {237                            try - 1238                            { - 1239                                updateDateTime = this.Database.SqlQuery<DateTimeOffset>("select SYSDATETIMEOFFSET()", ne - 1240                            } - 1241                            catch (Exception) - 1242                            { - 1243                                updateDateTime = DateTimeOffset.Now; - 1244                            } - 1245                        } + 1219            return await this.SaveChangesAsync(WindowsIdentity.GetCurrent().Name); + 1220        }221222        /// <summary>223        /// Saves all changes made in this context to the underlying database224        /// using the user parameter passed for auditing.225        /// </summary>226        /// <param name="user">User name for auditing.</param>227        /// <returns>The number of objects written to the underlying database.</returns>228        public virtual int SaveChanges(string user) + 1229        { + 1230            if (AuditEnabled) + 1231            { + 1232                var audits = CreateAuditRecords(user);233234                // Perform the updates.235                try + 1236                { + 1237                    return base.SaveChanges();238                } + 1239                catch (Exception) + 1240                {241                    // Updated failed so remove the audit entities. + 1242                    foreach (var item in audits) + 1243                    { + 1244                        this.Set(item.GetType()).Remove(item); + 1245                    }  246247                        // Create an audit entity. - 1248                        if (auditable.State == EntityState.Modified - 1249                            || auditable.State == EntityState.Deleted) - 1250                        {251                            // TODO: Find a better way of doing this proxy check. - 1252                            Type entityType = auditable.Entity.GetType(); - 1253                            if (entityType.Namespace == "System.Data.Entity.DynamicProxies") - 1254                            { - 1255                                entityType = entityType.BaseType; - 1256                            }257 - 1258                            if (auditTypes.ContainsKey(entityType) && auditTypes[entityType].AuditEntityType != null) - 1259                            { - 1260                                audits.Add(this.AuditEntity(auditable, auditTypes[entityType], updateDateTime.Value, use - 1261                            } - 1262                        }263264                        // Update the auditable entity. - 1265                        if (auditable.State != EntityState.Deleted) - 1266                        { - 1267                            auditable.Entity.Updated = updateDateTime.Value; - 1268                            auditable.Entity.UpdateUser = user; - 1269                        } - 1270                    } - 1271                }272273                // Perform the updates.274                try - 1275                { - 1276                    return base.SaveChanges();277                } - 1278                catch (Exception) - 1279                {280                    // Updated failed so remove the audit entities. - 1281                    foreach (var item in audits) - 1282                    { - 1283                        this.Set(item.GetType()).Remove(item); - 1284                    }247 + 1248                    throw;249                }250            }251            else + 0252            { + 0253                return base.SaveChanges();254            } + 1255        }256257        public virtual async Task<int> SaveChangesAsync(string user) + 1258        { + 1259            if (AuditEnabled) + 1260            { + 1261                var audits = CreateAuditRecords(user);262263                // Perform the updates.264                try + 1265                { + 1266                    return await base.SaveChangesAsync();267                } + 0268                catch (Exception) + 0269                {270                    // Updated failed so remove the audit entities. + 0271                    foreach (var item in audits) + 0272                    { + 0273                        this.Set(item.GetType()).Remove(item); + 0274                    }275276 + 0277                    throw;278                }279            }280            else + 0281            { + 0282                return await base.SaveChangesAsync();283            } + 1284        }  285286 - 1287                    throw;288                }289            }290            else - 0291            { - 0292                return base.SaveChanges();293            } - 1294        }295296        public async Task<int> SaveChangesAsync(string user) - 1297        { - 1298            if (AuditEnabled) - 1299            {300                // Track all audit entities created in this transaction, will be removed from context on exception. - 1301                List<IAuditEntity> audits = new List<IAuditEntity>();302303                // Use the same datetime for all updates in this transaction, retrieved from server when first used. - 1304                DateTimeOffset? updateDateTime = null;305306                // Process any auditable objects. - 1307                foreach (DbEntityEntry<IAuditableEntity> auditable in this.ChangeTracker.Entries<IAuditableEntity>()) - 1308                { - 1309                    if (auditable.State == EntityState.Added - 1310                        || auditable.State == EntityState.Modified - 1311                        || auditable.State == EntityState.Deleted) - 1312                    {313                        // Need datetime for the audits. - 1314                        if (updateDateTime.HasValue == false) - 1315                        { - 1316                            try { - 1317                                updateDateTime = this.Database.SqlQuery<DateTimeOffset>("select SYSDATETIMEOFFSET()", ne - 1318                            } catch (Exception) - 1319                            { - 1320                                updateDateTime = DateTimeOffset.Now; - 1321                            } - 1322                        }323324                        // Create an audit entity. - 1325                        if (auditable.State == EntityState.Modified - 1326                            || auditable.State == EntityState.Deleted) - 0327                        {328                            // TODO: Find a better way of doing this proxy check. - 0329                            Type entityType = auditable.Entity.GetType(); - 0330                            if (entityType.Namespace == "System.Data.Entity.DynamicProxies") - 0331                            { - 0332                                entityType = entityType.BaseType; - 0333                            }334 - 0335                            if (auditTypes.ContainsKey(entityType) && auditTypes[entityType].AuditEntityType != null) - 0336                            { - 0337                                audits.Add(this.AuditEntity(auditable, auditTypes[entityType], updateDateTime.Value, use - 0338                            } - 0339                        }340341                        // Update the auditable entity. - 1342                        if (auditable.State != EntityState.Deleted) - 1343                        { - 1344                            auditable.Entity.Updated = updateDateTime.Value; - 1345                            auditable.Entity.UpdateUser = user; - 1346                        } - 1347                    } - 1348                }349350                // Perform the updates.351                try - 1352                { - 1353                    return await base.SaveChangesAsync();354                } - 0355                catch (Exception) - 0356                {357                    // Updated failed so remove the audit entities. - 0358                    foreach (var item in audits) - 0359                    { - 0360                        this.Set(item.GetType()).Remove(item); - 0361                    }286        private List<IAuditEntity> CreateAuditRecords(string user) + 1287        {288            // Track all audit entities created in this transaction, will be removed from context on exception. + 1289            List<IAuditEntity> audits = new List<IAuditEntity>();290291            // Use the same datetime for all updates in this transaction, retrieved from server when first used. + 1292            DateTimeOffset? updateDateTime = null;293294            // Process any auditable objects. + 1295            foreach (DbEntityEntry<IAuditableEntity> auditable in this.ChangeTracker.Entries<IAuditableEntity>()) + 1296            { + 1297                if (auditable.State == EntityState.Added + 1298                    || auditable.State == EntityState.Modified + 1299                    || auditable.State == EntityState.Deleted) + 1300                {301                    // Need datetime for the audits. + 1302                    if (updateDateTime.HasValue == false) + 1303                    {304                        try + 1305                        { + 1306                            updateDateTime = this.Database.SqlQuery<DateTimeOffset>("select SYSDATETIMEOFFSET()", new ob + 1307                        } + 1308                        catch (Exception) + 1309                        { + 1310                            updateDateTime = DateTimeOffset.Now; + 1311                        } + 1312                    }313314                    // Create an audit entity. + 1315                    if (auditable.State == EntityState.Modified + 1316                        || auditable.State == EntityState.Deleted) + 1317                    {318                        // TODO: Find a better way of doing this proxy check. + 1319                        Type entityType = auditable.Entity.GetType(); + 1320                        if (entityType.Namespace == "System.Data.Entity.DynamicProxies") + 1321                        { + 1322                            entityType = entityType.BaseType; + 1323                        }324 + 1325                        if (auditTypes.ContainsKey(entityType) && auditTypes[entityType].AuditEntityType != null) + 1326                        { + 1327                            audits.Add(this.AuditEntity(auditable, auditTypes[entityType], updateDateTime.Value, user)); + 1328                        } + 1329                    }330331                    // Update the auditable entity. + 1332                    if (auditable.State != EntityState.Deleted) + 1333                    { + 1334                        auditable.Entity.Updated = updateDateTime.Value; + 1335                        auditable.Entity.UpdateUser = user; + 1336                    } + 1337                } + 1338            }339 + 1340            return audits; + 1341        }342343        private IAuditEntity AuditEntity(DbEntityEntry entityEntry, AuditTypeInfo auditTypeInfo, DateTimeOffset auditDat + 1344        {345            // Create audit entity. + 1346            DbSet set = this.Set(auditTypeInfo.AuditEntityType); + 1347            IAuditEntity auditEntity = set.Create() as IAuditEntity;348349            // Check audit entity for complex types. + 1350            var complexTypes = GetComplexTypes(auditTypeInfo, entityEntry);351352            //Instantiate complex types. + 1353            foreach (var field in complexTypes) + 0354            { + 0355                var property = auditEntity.GetType().GetProperty(field); + 0356                var entityType = property.PropertyType; + 0357                property.SetValue(auditEntity, Activator.CreateInstance(entityType)); + 0358            }359360            //Attach audit Entity to the context. + 1361            set.Add(auditEntity);  362363 - 0364                    throw;365                }366            }367            else - 0368            { - 0369                return await base.SaveChangesAsync();370            } - 1371        }372373        private IAuditEntity AuditEntity(DbEntityEntry entityEntry, AuditTypeInfo auditTypeInfo, DateTimeOffset auditDat - 1374        {375            // Create audit entity. - 1376            DbSet set = this.Set(auditTypeInfo.AuditEntityType); - 1377            IAuditEntity auditEntity = set.Create() as IAuditEntity;363            // Copy the properties. + 1364            DbEntityEntry auditEntityEntry = this.Entry(auditEntity); + 1365            foreach (string propertyName in auditTypeInfo.AuditProperties) + 1366            { + 1367                auditEntityEntry.Property(propertyName).CurrentValue = entityEntry.Property(propertyName).OriginalValue; + 1368            }369370            // Set the audit columns. + 1371            auditEntityEntry.Property(AuditUpdatedColumnName).CurrentValue = auditDateTime; + 1372            auditEntityEntry.Property(AuditUserColumnName).CurrentValue = user; + 1373            auditEntityEntry.Property(AuditTypeColumnName).CurrentValue = entityEntry.State == EntityState.Modified ? "u + 1374            auditEntityEntry.Property(AuditSourceIdColumnName).CurrentValue = entityEntry.OriginalValues.GetValue<int>("375 + 1376            return auditEntity; + 1377        }  378379            // Check audit entity for complex types. - 1380            var complexTypes = GetComplexTypes(auditTypeInfo, entityEntry);381382            //Instantiate complex types. - 1383            foreach (var field in complexTypes) - 0384            { - 0385                var property = auditEntity.GetType().GetProperty(field); - 0386                var entityType = property.PropertyType; - 0387                property.SetValue(auditEntity, Activator.CreateInstance(entityType)); - 0388            }389390            //Attach audit Entity to the context. - 1391            set.Add(auditEntity);392393            // Copy the properties. - 1394            DbEntityEntry auditEntityEntry = this.Entry(auditEntity); - 1395            foreach (string propertyName in auditTypeInfo.AuditProperties) - 1396            { - 1397                auditEntityEntry.Property(propertyName).CurrentValue = entityEntry.Property(propertyName).OriginalValue; - 1398            }399400            // Set the audit columns. - 1401            auditEntityEntry.Property(AuditUpdatedColumnName).CurrentValue = auditDateTime; - 1402            auditEntityEntry.Property(AuditUserColumnName).CurrentValue = user; - 1403            auditEntityEntry.Property(AuditTypeColumnName).CurrentValue = entityEntry.State == EntityState.Modified ? "u - 1404            auditEntityEntry.Property(AuditSourceIdColumnName).CurrentValue = entityEntry.OriginalValues.GetValue<int>("405 - 1406            return auditEntity; - 1407        }408409        /// <summary>410        /// Checks the destination object for complex types. Returns a list of fields that are complex types.411        /// </summary>412        /// <param name="auditTypeInfo"></param>413        /// <param name="entityEntry"></param>414        /// <returns></returns>415        private ICollection<string> GetComplexTypes(AuditTypeInfo auditTypeInfo, DbEntityEntry entityEntry) - 1416        { - 1417            var returnValue = new List<string>();418 - 1419            foreach (string propertyName in auditTypeInfo.AuditProperties) - 1420            { - 1421                if (entityEntry.Property(propertyName).GetType().Name.Contains("DbComplexPropertyEntry")) - 0422                { - 0423                    returnValue.Add(propertyName); - 0424                } - 1425            }426 - 1427            return returnValue; - 1428        }429    }430}379        /// <summary>380        /// Checks the destination object for complex types. Returns a list of fields that are complex types.381        /// </summary>382        /// <param name="auditTypeInfo"></param>383        /// <param name="entityEntry"></param>384        /// <returns></returns>385        private ICollection<string> GetComplexTypes(AuditTypeInfo auditTypeInfo, DbEntityEntry entityEntry) + 1386        { + 1387            var returnValue = new List<string>();388 + 1389            foreach (string propertyName in auditTypeInfo.AuditProperties) + 1390            { + 1391                if (entityEntry.Property(propertyName).GetType().Name.Contains("DbComplexPropertyEntry")) + 0392                { + 0393                    returnValue.Add(propertyName); + 0394                } + 1395            }396 + 1397            return returnValue; + 1398        }399    }400} -

+
diff --git a/CodeCoverageReport/entityframework.auditing.dll_AuditEntity.htm b/CodeCoverageReport/entityframework.auditing.dll_AuditEntity.htm index ec6342f..f7a101a 100644 --- a/CodeCoverageReport/entityframework.auditing.dll_AuditEntity.htm +++ b/CodeCoverageReport/entityframework.auditing.dll_AuditEntity.htm @@ -85,7 +85,7 @@

 55} - +

Methods/Properties

diff --git a/CodeCoverageReport/entityframework.auditing.dll_AuditTypeInfo.htm b/CodeCoverageReport/entityframework.auditing.dll_AuditTypeInfo.htm index eae6328..7d7a833 100644 --- a/CodeCoverageReport/entityframework.auditing.dll_AuditTypeInfo.htm +++ b/CodeCoverageReport/entityframework.auditing.dll_AuditTypeInfo.htm @@ -70,7 +70,7 @@

 33} -

+

Methods/Properties

diff --git a/CodeCoverageReport/entityframework.auditing.dll_AuditableEntity.htm b/CodeCoverageReport/entityframework.auditing.dll_AuditableEntity.htm index 75c9545..5d975d8 100644 --- a/CodeCoverageReport/entityframework.auditing.dll_AuditableEntity.htm +++ b/CodeCoverageReport/entityframework.auditing.dll_AuditableEntity.htm @@ -65,7 +65,7 @@

 35} -

+

Methods/Properties

diff --git a/CodeCoverageReport/entityframework.auditing.dll_EntityElement.htm b/CodeCoverageReport/entityframework.auditing.dll_EntityElement.htm index dbed9a4..d859161 100644 --- a/CodeCoverageReport/entityframework.auditing.dll_EntityElement.htm +++ b/CodeCoverageReport/entityframework.auditing.dll_EntityElement.htm @@ -75,7 +75,7 @@

 45} -

+

Methods/Properties

diff --git a/CodeCoverageReport/entityframework.auditing.dll_EntityElementCollection.htm b/CodeCoverageReport/entityframework.auditing.dll_EntityElementCollection.htm index 9af39a4..6a5a8de 100644 --- a/CodeCoverageReport/entityframework.auditing.dll_EntityElementCollection.htm +++ b/CodeCoverageReport/entityframework.auditing.dll_EntityElementCollection.htm @@ -83,7 +83,7 @@

 45} -

+

Methods/Properties

diff --git a/CodeCoverageReport/entityframework.auditing.test.dll_AuditDbTest.htm b/CodeCoverageReport/entityframework.auditing.test.dll_AuditDbTest.htm index afefcc6..ed96c4f 100644 --- a/CodeCoverageReport/entityframework.auditing.test.dll_AuditDbTest.htm +++ b/CodeCoverageReport/entityframework.auditing.test.dll_AuditDbTest.htm @@ -543,7 +543,7 @@

 483} -

+

Methods/Properties

diff --git a/CodeCoverageReport/entityframework.auditing.test.dll_Context.htm b/CodeCoverageReport/entityframework.auditing.test.dll_Context.htm index 6471788..d9420ae 100644 --- a/CodeCoverageReport/entityframework.auditing.test.dll_Context.htm +++ b/CodeCoverageReport/entityframework.auditing.test.dll_Context.htm @@ -70,7 +70,7 @@

C:\D  33} -

+

Methods/Properties

diff --git a/CodeCoverageReport/entityframework.auditing.test.dll_Customer.htm b/CodeCoverageReport/entityframework.auditing.test.dll_Customer.htm index 6389546..ae712a7 100644 --- a/CodeCoverageReport/entityframework.auditing.test.dll_Customer.htm +++ b/CodeCoverageReport/entityframework.auditing.test.dll_Customer.htm @@ -57,7 +57,7 @@

C:\  27} -

+

Methods/Properties

diff --git a/CodeCoverageReport/entityframework.auditing.test.dll_CustomerAudit.htm b/CodeCoverageReport/entityframework.auditing.test.dll_CustomerAudit.htm index 2ca3778..b4dbe9e 100644 --- a/CodeCoverageReport/entityframework.auditing.test.dll_CustomerAudit.htm +++ b/CodeCoverageReport/entityframework.auditing.test.dll_CustomerAudit.htm @@ -55,7 +55,7 @@

 25} -

+

Methods/Properties

diff --git a/CodeCoverageReport/entityframeworkrepository6.dll_BaseContext_TContext_.htm b/CodeCoverageReport/entityframework.repository6.dll_BaseContext_TContext_.htm similarity index 63% rename from CodeCoverageReport/entityframeworkrepository6.dll_BaseContext_TContext_.htm rename to CodeCoverageReport/entityframework.repository6.dll_BaseContext_TContext_.htm index cb63e40..c715d64 100644 --- a/CodeCoverageReport/entityframeworkrepository6.dll_BaseContext_TContext_.htm +++ b/CodeCoverageReport/entityframework.repository6.dll_BaseContext_TContext_.htm @@ -3,7 +3,7 @@ -EntityFrameworkRepository6.Base.BaseContext<TContext> - Coverage Report +EntityFramework.Repository6.BaseContext<TContext> - Coverage Report

Summary

@@ -13,14 +13,14 @@

Summary

-Class:EntityFrameworkRepository6.Base.BaseContext<TContext> -Assembly:entityframeworkrepository6.dll +Class:EntityFramework.Repository6.BaseContext<TContext> +Assembly:entityframework.repository6.dll File(s):C:\Development\EntityFrameworkRepository6\EntityFrameworkRepository6\BaseContext.cs -Covered lines:3 -Uncovered lines:9 -Coverable lines:12 -Total lines:28 -Line coverage:25% +Covered lines:2 +Uncovered lines:5 +Coverable lines:7 +Total lines:23 +Line coverage:28.5%

Metrics

@@ -29,9 +29,11 @@

Metrics

BaseContext()10 BaseContext(System.Data.Common.DbConnection)30 +BaseContext(System.Data.Common.DbConnection, bool)03 BaseContext(string)03 BaseContext(string, System.Data.Entity.IDatabaseInitializer<TContext>)03 BaseContext(System.Data.Common.DbConnection, System.Data.Entity.IDatabaseInitializer<TContext>)03 +BaseContext(System.Data.Common.DbConnection, System.Data.Entity.IDatabaseInitializer<TContext>, bool)03

File(s)

@@ -42,42 +44,39 @@

 1using System.Data.Common;  2using System.Data.Entity;  34namespace EntityFrameworkRepository6.Base4namespace EntityFramework.Repository6  5{  6    public class BaseContext<TContext> : DbContext  7            where TContext : DbContext  8    {9        static BaseContext() - 110        {11            //Database.SetInitializer<TContext>(null); - 112        }13 - 114        protected BaseContext(DbConnection dbConnection) : base(dbConnection, true) { Database.SetInitializer<TContext>(15 - 016        protected BaseContext(string connectionString) : base(connectionString) { Database.SetInitializer<TContext>(null17 - 018        protected BaseContext(string connectionString, IDatabaseInitializer<TContext> initializerStrategy) : base(connec - 019        { - 020            Database.SetInitializer<TContext>(initializerStrategy); - 021        }22 - 023        protected BaseContext(DbConnection dbConnection, IDatabaseInitializer<TContext> initializerStrategy) : base(dbCo - 024        { - 025            Database.SetInitializer<TContext>(initializerStrategy); - 026        }27    }28} + 19        static BaseContext() { }10 + 111        protected BaseContext(DbConnection dbConnection) : base(dbConnection, true) { Database.SetInitializer<TContext>(12 + 013        protected BaseContext(DbConnection dbConnection, bool contextOwnsConnection) : base(dbConnection, contextOwnsCon14 + 015        protected BaseContext(string connectionString) : base(connectionString) { Database.SetInitializer<TContext>(null16 + 017        protected BaseContext(string connectionString, IDatabaseInitializer<TContext> initializerStrategy) : base(connec18 + 019        protected BaseContext(DbConnection dbConnection, IDatabaseInitializer<TContext> initializerStrategy) : base(dbCo20 + 021        protected BaseContext(DbConnection dbConnection, IDatabaseInitializer<TContext> initializerStrategy, bool contex22    }23} -

+
diff --git a/CodeCoverageReport/entityframeworkrepository6.dll_BaseRepository.htm b/CodeCoverageReport/entityframework.repository6.dll_BaseRepository.htm similarity index 80% rename from CodeCoverageReport/entityframeworkrepository6.dll_BaseRepository.htm rename to CodeCoverageReport/entityframework.repository6.dll_BaseRepository.htm index 151f194..2ed7a04 100644 --- a/CodeCoverageReport/entityframeworkrepository6.dll_BaseRepository.htm +++ b/CodeCoverageReport/entityframework.repository6.dll_BaseRepository.htm @@ -3,7 +3,7 @@ -EntityFrameworkRepository6.Base.BaseRepository - Coverage Report +EntityFramework.Repository6.BaseRepository - Coverage Report

Summary

@@ -13,14 +13,14 @@

Summary

-Class:EntityFrameworkRepository6.Base.BaseRepository -Assembly:entityframeworkrepository6.dll +Class:EntityFramework.Repository6.BaseRepository +Assembly:entityframework.repository6.dll File(s):C:\Development\EntityFrameworkRepository6\EntityFrameworkRepository6\BaseRepository.cs -Covered lines:8 -Uncovered lines:9 -Coverable lines:17 -Total lines:236 -Line coverage:47% +Covered lines:12 +Uncovered lines:7 +Coverable lines:19 +Total lines:241 +Line coverage:63.1%

Metrics

@@ -29,7 +29,7 @@

Metrics

FindAsync()60 FindAsync()60 -ReloadAsync()06 +ReloadAsync()60 SaveAsync()05 CountAsync()06 @@ -39,253 +39,258 @@

#LineLine coverage - 1using System;2using System.Collections.Generic;3using System.Data.Entity;4using System.Linq;5using System.Linq.Expressions;6using System.Threading.Tasks;78namespace EntityFrameworkRepository6.Base9{10    public interface IBaseRepository<C, T> : IDisposable11            where T : class12            where C : DbContext13    {14        IQueryable<T> GetAll();15        IQueryable<T> FindBy(Expression<Func<T, bool>> predicate);16        IQueryable<T> FindByReadOnly(Expression<Func<T, bool>> predicate);17        T Add(T entity);18        IEnumerable<T> Add(IEnumerable<T> entities);19        void Delete(T entity);20        void Delete(IEnumerable<T> entities);21        void Reload(T entity);22        void ReloadAsync(T entity);23        void Update(T entity, int id);24        void Update(T entity, Expression<Func<T, bool>> predicate);25        void Update(Delta<T> delta, params object[] ids);26        Task<int> SaveAsync();27        int Save();28        T Find(int id);29        T Find(params object[] ids);30        Task<T> FindAsync(int id);31        Task<T> FindAsync(params object[] ids);32        bool Exists(Expression<Func<T, bool>> predicate);33        void AddUpdateIgnoreField(string fieldName);34        int Count();35        Task<int> CountAsync();36    }3738    public abstract class BaseRepository<C, T> : IBaseRepository<C, T>,39            IDisposable40        where T : class41        where C : DbContext42    {43        public C Context { get; set; }44        public Lazy<List<string>> IgnoreFieldsOnUpdate = new Lazy<List<string>>();4546        public void AddUpdateIgnoreField(string fieldName)47        {48            IgnoreFieldsOnUpdate.Value.Add(fieldName);49        }5051        public virtual T Find(int id)52        {53            T entity = Context.Set<T>().Find(id);5455            return entity;56        }5758        public virtual T Find(params object[] ids)59        {60            T entity = Context.Set<T>().Find(ids);1using EntityFramework.Repository6.Interfaces;2using System;3using System.Collections.Generic;4using System.Data.Entity;5using System.Linq;6using System.Linq.Expressions;7using System.Threading.Tasks;89namespace EntityFramework.Repository610{11    public abstract class BaseRepository<C, T> :12            IBaseRepository<C, T>13            , IDisposable14        where T : class15        where C : DbContext16    {17        protected C Context { get; set; }18        protected Lazy<List<string>> IgnoreFieldsOnUpdate = new Lazy<List<string>>();19        protected Lazy<List<Expression<Func<T, bool>>>> IgnoreFieldsOnUpdate2 = new Lazy<List<Expression<Func<T, bool>>>2021        protected BaseRepository(C context)22        {23            Context = context;24        }2526        public virtual void AddUpdateIgnoreField(string fieldName)27        {28            IgnoreFieldsOnUpdate.Value.Add(fieldName);29        }3031        public virtual void AddUpdateIgnoreField(Expression<Func<T, bool>> fieldName)32        {33            IgnoreFieldsOnUpdate2.Value.Add(fieldName);34        }3536        public virtual T Find(int id)37        {38            T entity = Context.Set<T>().Find(id);3940            return entity;41        }4243        public virtual T Find(params object[] ids)44        {45            T entity = Context.Set<T>().Find(ids);4647            return entity;48        }4950        public virtual async Task<T> FindAsync(int id) + 151        { + 152            var query = Context.Set<T>().FindAsync(id); + 153            return await query; + 154        }5556        public virtual async Task<T> FindAsync(params object[] ids) + 157        { + 158            var query = Context.Set<T>().FindAsync(ids); + 159            return await query; + 160        }  6162            return entity;63        }6465        public virtual async Task<T> FindAsync(int id) - 166        { - 167            var query = Context.Set<T>().FindAsync(id); - 168            return await query; - 169        }7071        public virtual async Task<T> FindAsync(params object[] ids) - 172        { - 173            var query = Context.Set<T>().FindAsync(ids); - 174            return await query; - 175        }7677        public virtual IQueryable<T> FindBy(Expression<Func<T, bool>> predicate)78        {79            IQueryable<T> query = Context.Set<T>().Where(predicate);80            return query;81        }8283        public virtual bool Exists(Expression<Func<T, bool>> predicate)84        {85            return Context.Set<T>().AsNoTracking().Any(predicate);86        }8788        public virtual void Delete(T entity)89        {90            Context.Set<T>().Remove(entity);91        }9293        public virtual void Delete(IEnumerable<T> entities)94        {95            foreach (T entity in entities)96            {97                Delete(entity);98            }99        }100101        public virtual void Reload(T entity)102        {103            Context.Entry<T>(entity).Reload();104        }62        public virtual IQueryable<T> FindBy(Expression<Func<T, bool>> predicate)63        {64            IQueryable<T> query = Context.Set<T>().Where(predicate);65            return query;66        }6768        public virtual bool Exists(Expression<Func<T, bool>> predicate)69        {70            return Context.Set<T>().AsNoTracking().Any(predicate);71        }7273        public virtual void Delete(T entity)74        {75            Context.Set<T>().Remove(entity);76        }7778        public virtual void Delete(IEnumerable<T> entities)79        {80            foreach (T entity in entities)81            {82                Delete(entity);83            }84        }8586        public virtual void Reload(T entity)87        {88            Context.Entry<T>(entity).Reload();89        }9091        public async virtual Task ReloadAsync(T entity) + 192        { + 193            await Context.Entry<T>(entity).ReloadAsync(); + 194        }9596        public virtual IQueryable<T> FindByReadOnly(Expression<Func<T, bool>> predicate)97        {98            IQueryable<T> query = Context.Set<T>().AsNoTracking().Where(predicate);99            return query;100        }101102        public virtual IQueryable<T> GetAll()103        {104            IQueryable<T> query = Context.Set<T>().AsNoTracking();  105106        public async virtual void ReloadAsync(T entity) - 0107        { - 0108            await Context.Entry<T>(entity).ReloadAsync(); - 0109        }110111        public virtual IQueryable<T> FindByReadOnly(Expression<Func<T, bool>> predicate)112        {113            IQueryable<T> query = Context.Set<T>().AsNoTracking().Where(predicate);114            return query;115        }116117        public virtual IQueryable<T> GetAll()118        {119            IQueryable<T> query = Context.Set<T>().AsNoTracking();120121            return query;122        }123124        public virtual T Add(T entity)125        {126            Context.Set<T>().Add(entity);127128            return entity;129        }106            return query;107        }108109        public virtual T Add(T entity)110        {111            Context.Set<T>().Add(entity);112113            return entity;114        }115116        public virtual IEnumerable<T> Add(IEnumerable<T> entities)117        {118            Context.Set<T>().AddRange(entities);119120            return entities;121        }122123        public virtual void Update(T entity, int id)124        {125            var entityToUpdate = Context.Set<T>().Find(id);126127            if (entityToUpdate == null) throw CreateEntityNotFoundException<ArgumentOutOfRangeException>(id.ToString(), 128129            Context.Entry(entityToUpdate).CurrentValues.SetValues(entity);  130131        public virtual IEnumerable<T> Add(IEnumerable<T> entities)132        {133            Context.Set<T>().AddRange(entities);134135            return entities;136        }131            MarkIgnoreFields(entityToUpdate);132        }133134        public virtual void Update(T entity, Expression<Func<T, bool>> predicate)135        {136            var entityToUpdate = Context.Set<T>().Where(predicate).SingleOrDefault();  137138        public virtual void Update(T entity, int id)139        {140            var entityToUpdate = Context.Set<T>().Find(id);138            if (entityToUpdate == null) throw CreateEntityNotFoundException<ArgumentOutOfRangeException>(predicate.ToStr139140            Context.Entry(entityToUpdate).CurrentValues.SetValues(entity);  141142            if (entityToUpdate == null) throw new Exception(string.Format("{0} is not a valid identity key for {1}.", id143144            Context.Entry(entityToUpdate).CurrentValues.SetValues(entity);145146            MarkIgnoreFields(entityToUpdate);147        }142            MarkIgnoreFields(entityToUpdate);143        }144145        public virtual void Update(Delta<T> delta, params object[] ids)146        {147            var entityToUpdate = Context.Set<T>().Find(ids);  148149        public virtual void Update(T entity, Expression<Func<T, bool>> predicate)150        {151            var entityToUpdate = Context.Set<T>().Where(predicate).SingleOrDefault();152153            if (entityToUpdate == null) throw new Exception(string.Format("{0} is not a valid identity key for {1}.", pr154155            Context.Entry(entityToUpdate).CurrentValues.SetValues(entity);156157            MarkIgnoreFields(entityToUpdate);158        }159160        public virtual void Update(Delta<T> delta, params object[] ids)161        {162            var entityToUpdate = Context.Set<T>().Find(ids);163164            if (entityToUpdate == null) throw new Exception(string.Format("{0} is not a valid identity keys for {1}.", i149            if (entityToUpdate == null) throw CreateEntityNotFoundException<ArgumentOutOfRangeException>(ids.ToString(),150151            foreach (string field in delta.UpdatedFields())152            {153                var fieldToSet = typeof(T).GetProperty(field);154                var dataOrigion = delta.Internal.GetType().GetProperty(field);155156                fieldToSet.SetValue(entityToUpdate, dataOrigion.GetValue(delta.Internal));157            }158159            MarkIgnoreFields(entityToUpdate);160        }161162        public void Update(Delta<T> delta, Expression<Func<T, bool>> predicate)163        {164            var entityToUpdate = Context.Set<T>().Where(predicate).SingleOrDefault();  165166            foreach (string field in delta.UpdatedFields())167            {168                var fieldToSet = typeof(T).GetProperty(field);169                var dataOrigion = delta.Internal.GetType().GetProperty(field);170171                fieldToSet.SetValue(entityToUpdate, dataOrigion.GetValue(delta.Internal));172            }173174            MarkIgnoreFields(entityToUpdate);175        }176177        protected virtual void MarkIgnoreFields(T entityToUpdate)178        {179            if(IgnoreFieldsOnUpdate.IsValueCreated)180            {181                foreach(var item in IgnoreFieldsOnUpdate.Value)182                {183                    Context.Entry(entityToUpdate).Property(item).IsModified = false;184                }185            }186187        }166            if (entityToUpdate == null) throw CreateEntityNotFoundException<ArgumentOutOfRangeException>(predicate.ToStr167168            foreach (string field in delta.UpdatedFields())169            {170                var fieldToSet = typeof(T).GetProperty(field);171                var dataOrigion = delta.Internal.GetType().GetProperty(field);172173                fieldToSet.SetValue(entityToUpdate, dataOrigion.GetValue(delta.Internal));174            }175176            MarkIgnoreFields(entityToUpdate);177        }178179        protected virtual E CreateEntityNotFoundException<E>(string entityId, string entityType)180        {181            return (E)Activator.CreateInstance(typeof(E), string.Format("{0} is not a valid identity key(s) for {1}.", e182        }183184        protected virtual void MarkIgnoreFields(T entityToUpdate)185        {186            if(IgnoreFieldsOnUpdate.IsValueCreated) + 1187            { IgnoreFieldsOnUpdate.Value.ForEach(ignoreField => Context.Entry(entityToUpdate).Property(ignoreField).IsMo  188189        public async virtual Task<int> SaveAsync() - 0190        { - 0191            return await Context.SaveChangesAsync(); - 0192        }189190            if(IgnoreFieldsOnUpdate2.IsValueCreated) + 0191            { IgnoreFieldsOnUpdate2.Value.ForEach(ignoreField => Context.Entry(entityToUpdate).Property(ignoreField).IsM192        }  193194        public virtual int Save()195        {196            return Context.SaveChanges();197        }194        public async virtual Task<int> SaveAsync() + 0195        { + 0196            return await Context.SaveChangesAsync(); + 0197        }  198199        public virtual int Count()199        public virtual int Save()  200        {201            return Context.Set<T>().Count();201            return Context.SaveChanges();  202        }  203204        public async virtual Task<int> CountAsync() - 0205        { - 0206            return await Context.Set<T>().CountAsync(); - 0207        }204        public virtual int Count()205        {206            return Context.Set<T>().Count();207        }  208209        #region IDisposable Support210        private bool disposedValue = false; // To detect redundant calls211212        protected virtual void Dispose(bool disposing)213        {214            if (!disposedValue)215            {216                if (disposing)217                {218                    if (Context != null)219                    {220                        Context.Dispose();221                        Context = null;222                    }223                }224225                disposedValue = true;226            }227        }228229        public void Dispose()230        {231            Dispose(true);209        public async virtual Task<int> CountAsync() + 0210        { + 0211            return await Context.Set<T>().CountAsync(); + 0212        }213214        #region IDisposable Support215        private bool disposedValue = false; // To detect redundant calls216217        protected virtual void Dispose(bool disposing)218        {219            if (!disposedValue)220            {221                if (disposing)222                {223                    if (Context != null)224                    {225                        Context.Dispose();226                        Context = null;227                    }228                }229230                disposedValue = true;231            }  232        }233        #endregion234235    }236}233234        public void Dispose()235        {236            Dispose(true);237        }238        #endregion239240    }241} -

+
diff --git a/CodeCoverageReport/entityframeworkrepository6.dll_BaseRepository_C__T_.htm b/CodeCoverageReport/entityframework.repository6.dll_BaseRepository_C__T_.htm similarity index 63% rename from CodeCoverageReport/entityframeworkrepository6.dll_BaseRepository_C__T_.htm rename to CodeCoverageReport/entityframework.repository6.dll_BaseRepository_C__T_.htm index 69e703f..9df1162 100644 --- a/CodeCoverageReport/entityframeworkrepository6.dll_BaseRepository_C__T_.htm +++ b/CodeCoverageReport/entityframework.repository6.dll_BaseRepository_C__T_.htm @@ -3,7 +3,7 @@ -EntityFrameworkRepository6.Base.BaseRepository<C, T> - Coverage Report +EntityFramework.Repository6.BaseRepository<C, T> - Coverage Report

Summary

@@ -13,41 +13,44 @@

Summary

-Class:EntityFrameworkRepository6.Base.BaseRepository<C, T> -Assembly:entityframeworkrepository6.dll +Class:EntityFramework.Repository6.BaseRepository<C, T> +Assembly:entityframework.repository6.dll File(s):C:\Development\EntityFrameworkRepository6\EntityFrameworkRepository6\BaseRepository.cs -Covered lines:81 -Uncovered lines:23 -Coverable lines:104 -Total lines:236 -Line coverage:77.8% +Covered lines:119 +Uncovered lines:4 +Coverable lines:123 +Total lines:241 +Line coverage:96.7%

Metrics

+ + - - - - - + + + + + - + - - - + + + + + -
MethodBlocks covered  Blocks not covered  
BaseRepository(C)50
AddUpdateIgnoreField(string)30
AddUpdateIgnoreField(System.Linq.Expressions.Expression<System.Func<T, bool>>)03
Find(int)50
Find(object[])50
FindBy(System.Linq.Expressions.Expression<System.Func<T, bool>>)50
Exists(System.Linq.Expressions.Expression<System.Func<T, bool>>)06
Delete(T)04
Delete(System.Collections.Generic.IEnumerable<T>)09
Reload(T)04
FindByReadOnly(System.Linq.Expressions.Expression<System.Func<T, bool>>)06
Exists(System.Linq.Expressions.Expression<System.Func<T, bool>>)60
Delete(T)40
Delete(System.Collections.Generic.IEnumerable<T>)90
Reload(T)40
FindByReadOnly(System.Linq.Expressions.Expression<System.Func<T, bool>>)60
GetAll()50
Add(T)50
Add(System.Collections.Generic.IEnumerable<T>)05
Add(System.Collections.Generic.IEnumerable<T>)50
Update(T, int)105
Update(T, System.Linq.Expressions.Expression<System.Func<T, bool>>)170
Update(EntityFrameworkRepository6.Base.Delta<T>, object[])226
MarkIgnoreFields(T)160
Update(T, System.Linq.Expressions.Expression<System.Func<T, bool>>)160
Update(EntityFramework.Repository6.Delta<T>, object[])225
Update(EntityFramework.Repository6.Delta<T>, System.Linq.Expressions.Expression<System.Func<T, bool>>)235
CreateEntityNotFoundException<E>(string, string)50
MarkIgnoreFields(T)94
Save()40
Count()50
Dispose(bool)110
Dispose()20
BaseRepository()30

File(s)

@@ -55,271 +58,279 @@

#LineLine coverage - 1using System;2using System.Collections.Generic;3using System.Data.Entity;4using System.Linq;5using System.Linq.Expressions;6using System.Threading.Tasks;78namespace EntityFrameworkRepository6.Base9{10    public interface IBaseRepository<C, T> : IDisposable11            where T : class12            where C : DbContext13    {14        IQueryable<T> GetAll();15        IQueryable<T> FindBy(Expression<Func<T, bool>> predicate);16        IQueryable<T> FindByReadOnly(Expression<Func<T, bool>> predicate);17        T Add(T entity);18        IEnumerable<T> Add(IEnumerable<T> entities);19        void Delete(T entity);20        void Delete(IEnumerable<T> entities);21        void Reload(T entity);22        void ReloadAsync(T entity);23        void Update(T entity, int id);24        void Update(T entity, Expression<Func<T, bool>> predicate);25        void Update(Delta<T> delta, params object[] ids);26        Task<int> SaveAsync();27        int Save();28        T Find(int id);29        T Find(params object[] ids);30        Task<T> FindAsync(int id);31        Task<T> FindAsync(params object[] ids);32        bool Exists(Expression<Func<T, bool>> predicate);33        void AddUpdateIgnoreField(string fieldName);34        int Count();35        Task<int> CountAsync();36    }3738    public abstract class BaseRepository<C, T> : IBaseRepository<C, T>,39            IDisposable40        where T : class41        where C : DbContext42    { - 143        public C Context { get; set; } - 144        public Lazy<List<string>> IgnoreFieldsOnUpdate = new Lazy<List<string>>();4546        public void AddUpdateIgnoreField(string fieldName) - 147        { - 148            IgnoreFieldsOnUpdate.Value.Add(fieldName); - 149        }5051        public virtual T Find(int id) - 152        { - 153            T entity = Context.Set<T>().Find(id);54 - 155            return entity; - 156        }5758        public virtual T Find(params object[] ids) - 159        { - 160            T entity = Context.Set<T>().Find(ids);1using EntityFramework.Repository6.Interfaces;2using System;3using System.Collections.Generic;4using System.Data.Entity;5using System.Linq;6using System.Linq.Expressions;7using System.Threading.Tasks;89namespace EntityFramework.Repository610{11    public abstract class BaseRepository<C, T> :12            IBaseRepository<C, T>13            , IDisposable14        where T : class15        where C : DbContext16    { + 117        protected C Context { get; set; } + 118        protected Lazy<List<string>> IgnoreFieldsOnUpdate = new Lazy<List<string>>(); + 119        protected Lazy<List<Expression<Func<T, bool>>>> IgnoreFieldsOnUpdate2 = new Lazy<List<Expression<Func<T, bool>>>20 + 121        protected BaseRepository(C context) + 122        { + 123            Context = context; + 124        }2526        public virtual void AddUpdateIgnoreField(string fieldName) + 127        { + 128            IgnoreFieldsOnUpdate.Value.Add(fieldName); + 129        }3031        public virtual void AddUpdateIgnoreField(Expression<Func<T, bool>> fieldName) + 032        { + 033            IgnoreFieldsOnUpdate2.Value.Add(fieldName); + 034        }3536        public virtual T Find(int id) + 137        { + 138            T entity = Context.Set<T>().Find(id);39 + 140            return entity; + 141        }4243        public virtual T Find(params object[] ids) + 144        { + 145            T entity = Context.Set<T>().Find(ids);46 + 147            return entity; + 148        }4950        public virtual async Task<T> FindAsync(int id)51        {52            var query = Context.Set<T>().FindAsync(id);53            return await query;54        }5556        public virtual async Task<T> FindAsync(params object[] ids)57        {58            var query = Context.Set<T>().FindAsync(ids);59            return await query;60        }  61 - 162            return entity; - 163        }6465        public virtual async Task<T> FindAsync(int id)66        {67            var query = Context.Set<T>().FindAsync(id);68            return await query;69        }7071        public virtual async Task<T> FindAsync(params object[] ids)72        {73            var query = Context.Set<T>().FindAsync(ids);74            return await query;75        }7677        public virtual IQueryable<T> FindBy(Expression<Func<T, bool>> predicate) - 178        { - 179            IQueryable<T> query = Context.Set<T>().Where(predicate); - 180            return query; - 181        }8283        public virtual bool Exists(Expression<Func<T, bool>> predicate) - 084        { - 085            return Context.Set<T>().AsNoTracking().Any(predicate); - 086        }8788        public virtual void Delete(T entity) - 089        { - 090            Context.Set<T>().Remove(entity); - 091        }9293        public virtual void Delete(IEnumerable<T> entities) - 094        { - 095            foreach (T entity in entities) - 096            { - 097                Delete(entity); - 098            } - 099        }100101        public virtual void Reload(T entity) - 0102        { - 0103            Context.Entry<T>(entity).Reload(); - 0104        }62        public virtual IQueryable<T> FindBy(Expression<Func<T, bool>> predicate) + 163        { + 164            IQueryable<T> query = Context.Set<T>().Where(predicate); + 165            return query; + 166        }6768        public virtual bool Exists(Expression<Func<T, bool>> predicate) + 169        { + 170            return Context.Set<T>().AsNoTracking().Any(predicate); + 171        }7273        public virtual void Delete(T entity) + 174        { + 175            Context.Set<T>().Remove(entity); + 176        }7778        public virtual void Delete(IEnumerable<T> entities) + 179        { + 180            foreach (T entity in entities) + 181            { + 182                Delete(entity); + 183            } + 184        }8586        public virtual void Reload(T entity) + 187        { + 188            Context.Entry<T>(entity).Reload(); + 189        }9091        public async virtual Task ReloadAsync(T entity)92        {93            await Context.Entry<T>(entity).ReloadAsync();94        }9596        public virtual IQueryable<T> FindByReadOnly(Expression<Func<T, bool>> predicate) + 197        { + 198            IQueryable<T> query = Context.Set<T>().AsNoTracking().Where(predicate); + 199            return query; + 1100        }101102        public virtual IQueryable<T> GetAll() + 1103        { + 1104            IQueryable<T> query = Context.Set<T>().AsNoTracking();  105106        public async virtual void ReloadAsync(T entity)107        {108            await Context.Entry<T>(entity).ReloadAsync();109        }110111        public virtual IQueryable<T> FindByReadOnly(Expression<Func<T, bool>> predicate) - 0112        { - 0113            IQueryable<T> query = Context.Set<T>().AsNoTracking().Where(predicate); - 0114            return query; - 0115        }116117        public virtual IQueryable<T> GetAll() - 1118        { - 1119            IQueryable<T> query = Context.Set<T>().AsNoTracking();120 - 1121            return query; - 1122        }123124        public virtual T Add(T entity) - 1125        { - 1126            Context.Set<T>().Add(entity);127 - 1128            return entity; - 1129        } + 1106            return query; + 1107        }108109        public virtual T Add(T entity) + 1110        { + 1111            Context.Set<T>().Add(entity);112 + 1113            return entity; + 1114        }115116        public virtual IEnumerable<T> Add(IEnumerable<T> entities) + 1117        { + 1118            Context.Set<T>().AddRange(entities);119 + 1120            return entities; + 1121        }122123        public virtual void Update(T entity, int id) + 1124        { + 1125            var entityToUpdate = Context.Set<T>().Find(id);126 + 1127            if (entityToUpdate == null) throw CreateEntityNotFoundException<ArgumentOutOfRangeException>(id.ToString(), 128 + 1129            Context.Entry(entityToUpdate).CurrentValues.SetValues(entity);  130131        public virtual IEnumerable<T> Add(IEnumerable<T> entities) - 0132        { - 0133            Context.Set<T>().AddRange(entities);134 - 0135            return entities; - 0136        } + 1131            MarkIgnoreFields(entityToUpdate); + 1132        }133134        public virtual void Update(T entity, Expression<Func<T, bool>> predicate) + 1135        { + 1136            var entityToUpdate = Context.Set<T>().Where(predicate).SingleOrDefault();  137138        public virtual void Update(T entity, int id) - 1139        { - 1140            var entityToUpdate = Context.Set<T>().Find(id); + 1138            if (entityToUpdate == null) throw CreateEntityNotFoundException<ArgumentOutOfRangeException>(predicate.ToStr139 + 1140            Context.Entry(entityToUpdate).CurrentValues.SetValues(entity);  141 - 1142            if (entityToUpdate == null) throw new Exception(string.Format("{0} is not a valid identity key for {1}.", id143 - 1144            Context.Entry(entityToUpdate).CurrentValues.SetValues(entity);145 - 1146            MarkIgnoreFields(entityToUpdate); - 1147        } + 1142            MarkIgnoreFields(entityToUpdate); + 1143        }144145        public virtual void Update(Delta<T> delta, params object[] ids) + 1146        { + 1147            var entityToUpdate = Context.Set<T>().Find(ids);  148149        public virtual void Update(T entity, Expression<Func<T, bool>> predicate) - 1150        { - 1151            var entityToUpdate = Context.Set<T>().Where(predicate).SingleOrDefault();152 - 1153            if (entityToUpdate == null) throw new Exception(string.Format("{0} is not a valid identity key for {1}.", pr154 - 1155            Context.Entry(entityToUpdate).CurrentValues.SetValues(entity);156 - 1157            MarkIgnoreFields(entityToUpdate); - 1158        }159160        public virtual void Update(Delta<T> delta, params object[] ids) - 1161        { - 1162            var entityToUpdate = Context.Set<T>().Find(ids);163 - 1164            if (entityToUpdate == null) throw new Exception(string.Format("{0} is not a valid identity keys for {1}.", i + 1149            if (entityToUpdate == null) throw CreateEntityNotFoundException<ArgumentOutOfRangeException>(ids.ToString(),150 + 1151            foreach (string field in delta.UpdatedFields()) + 1152            { + 1153                var fieldToSet = typeof(T).GetProperty(field); + 1154                var dataOrigion = delta.Internal.GetType().GetProperty(field);155 + 1156                fieldToSet.SetValue(entityToUpdate, dataOrigion.GetValue(delta.Internal)); + 1157            }158 + 1159            MarkIgnoreFields(entityToUpdate); + 1160        }161162        public void Update(Delta<T> delta, Expression<Func<T, bool>> predicate) + 1163        { + 1164            var entityToUpdate = Context.Set<T>().Where(predicate).SingleOrDefault();  165 - 1166            foreach (string field in delta.UpdatedFields()) - 1167            { - 1168                var fieldToSet = typeof(T).GetProperty(field); - 1169                var dataOrigion = delta.Internal.GetType().GetProperty(field);170 - 1171                fieldToSet.SetValue(entityToUpdate, dataOrigion.GetValue(delta.Internal)); - 1172            }173 - 1174            MarkIgnoreFields(entityToUpdate); - 1175        }176177        protected virtual void MarkIgnoreFields(T entityToUpdate) - 1178        { - 1179            if(IgnoreFieldsOnUpdate.IsValueCreated) - 1180            { - 1181                foreach(var item in IgnoreFieldsOnUpdate.Value) - 1182                { - 1183                    Context.Entry(entityToUpdate).Property(item).IsModified = false; - 1184                } - 1185            }186 - 1187        } + 1166            if (entityToUpdate == null) throw CreateEntityNotFoundException<ArgumentOutOfRangeException>(predicate.ToStr167 + 1168            foreach (string field in delta.UpdatedFields()) + 1169            { + 1170                var fieldToSet = typeof(T).GetProperty(field); + 1171                var dataOrigion = delta.Internal.GetType().GetProperty(field);172 + 1173                fieldToSet.SetValue(entityToUpdate, dataOrigion.GetValue(delta.Internal)); + 1174            }175 + 1176            MarkIgnoreFields(entityToUpdate); + 1177        }178179        protected virtual E CreateEntityNotFoundException<E>(string entityId, string entityType) + 1180        { + 1181            return (E)Activator.CreateInstance(typeof(E), string.Format("{0} is not a valid identity key(s) for {1}.", e + 1182        }183184        protected virtual void MarkIgnoreFields(T entityToUpdate) + 1185        { + 1186            if(IgnoreFieldsOnUpdate.IsValueCreated) + 1187            { IgnoreFieldsOnUpdate.Value.ForEach(ignoreField => Context.Entry(entityToUpdate).Property(ignoreField).IsMo  188189        public async virtual Task<int> SaveAsync()190        {191            return await Context.SaveChangesAsync();192        }189 + 1190            if(IgnoreFieldsOnUpdate2.IsValueCreated) + 0191            { IgnoreFieldsOnUpdate2.Value.ForEach(ignoreField => Context.Entry(entityToUpdate).Property(ignoreField).IsM + 1192        }  193194        public virtual int Save() - 1195        { - 1196            return Context.SaveChanges(); - 1197        }194        public async virtual Task<int> SaveAsync()195        {196            return await Context.SaveChangesAsync();197        }  198199        public virtual int Count()199        public virtual int Save()  1200        { - 1201            return Context.Set<T>().Count(); + 1201            return Context.SaveChanges();  1202        }  203204        public async virtual Task<int> CountAsync()205        {206            return await Context.Set<T>().CountAsync();207        }204        public virtual int Count() + 1205        { + 1206            return Context.Set<T>().Count(); + 1207        }  208209        #region IDisposable Support - 1210        private bool disposedValue = false; // To detect redundant calls211212        protected virtual void Dispose(bool disposing) - 1213        { - 1214            if (!disposedValue) - 1215            { - 1216                if (disposing) - 1217                { - 1218                    if (Context != null) - 1219                    { - 1220                        Context.Dispose(); - 1221                        Context = null; - 1222                    } - 1223                }224 - 1225                disposedValue = true; - 1226            } - 1227        }228229        public void Dispose() - 1230        { - 1231            Dispose(true);209        public async virtual Task<int> CountAsync()210        {211            return await Context.Set<T>().CountAsync();212        }213214        #region IDisposable Support + 1215        private bool disposedValue = false; // To detect redundant calls216217        protected virtual void Dispose(bool disposing) + 1218        { + 1219            if (!disposedValue) + 1220            { + 1221                if (disposing) + 1222                { + 1223                    if (Context != null) + 1224                    { + 1225                        Context.Dispose(); + 1226                        Context = null; + 1227                    } + 1228                }229 + 1230                disposedValue = true; + 1231            }  1232        }233        #endregion234235    }236}233234        public void Dispose() + 1235        { + 1236            Dispose(true); + 1237        }238        #endregion239240    }241} -

+

Methods/Properties

-Context()
-Context(C)
-BaseRepository()
-AddUpdateIgnoreField(string)
-Find(int)
-Find(object[])
-FindBy(System.Linq.Expressions.Expression<System.Func<T, bool>>)
-Exists(System.Linq.Expressions.Expression<System.Func<T, bool>>)
-Delete(T)
-Delete(System.Collections.Generic.IEnumerable<T>)
-Reload(T)
-FindByReadOnly(System.Linq.Expressions.Expression<System.Func<T, bool>>)
-GetAll()
-Add(T)
-Add(System.Collections.Generic.IEnumerable<T>)
-Update(T, int)
-Update(T, System.Linq.Expressions.Expression<System.Func<T, bool>>)
-Update(EntityFrameworkRepository6.Base.Delta<T>, object[])
-MarkIgnoreFields(T)
-Save()
-Count()
-Dispose(bool)
-Dispose()
+Context()
+Context(C)
+BaseRepository(C)
+AddUpdateIgnoreField(string)
+AddUpdateIgnoreField(System.Linq.Expressions.Expression<System.Func<T, bool>>)
+Find(int)
+Find(object[])
+FindBy(System.Linq.Expressions.Expression<System.Func<T, bool>>)
+Exists(System.Linq.Expressions.Expression<System.Func<T, bool>>)
+Delete(T)
+Delete(System.Collections.Generic.IEnumerable<T>)
+Reload(T)
+FindByReadOnly(System.Linq.Expressions.Expression<System.Func<T, bool>>)
+GetAll()
+Add(T)
+Add(System.Collections.Generic.IEnumerable<T>)
+Update(T, int)
+Update(T, System.Linq.Expressions.Expression<System.Func<T, bool>>)
+Update(EntityFramework.Repository6.Delta<T>, object[])
+Update(EntityFramework.Repository6.Delta<T>, System.Linq.Expressions.Expression<System.Func<T, bool>>)
+CreateEntityNotFoundException<E>(string, string)
+MarkIgnoreFields(T)
+Save()
+Count()
+Dispose(bool)
+Dispose()

diff --git a/CodeCoverageReport/entityframeworkauditablerepository6.dll_DatabaseFactory_C_.htm b/CodeCoverageReport/entityframework.repository6.dll_DatabaseFactory_C_.htm similarity index 70% rename from CodeCoverageReport/entityframeworkauditablerepository6.dll_DatabaseFactory_C_.htm rename to CodeCoverageReport/entityframework.repository6.dll_DatabaseFactory_C_.htm index 18d699a..068abea 100644 --- a/CodeCoverageReport/entityframeworkauditablerepository6.dll_DatabaseFactory_C_.htm +++ b/CodeCoverageReport/entityframework.repository6.dll_DatabaseFactory_C_.htm @@ -3,7 +3,7 @@ -EntityFrameworkAuditableRepository6.Base.DatabaseFactory<C> - Coverage Report +EntityFramework.Repository6.DatabaseFactory<C> - Coverage Report

Summary

@@ -13,13 +13,13 @@

Summary

-Class:EntityFrameworkAuditableRepository6.Base.DatabaseFactory<C> -Assembly:entityframeworkauditablerepository6.dll -File(s):C:\Development\EntityFrameworkRepository6\EntityFrameworkAuditableRepository6\DatabaseFactory.cs +Class:EntityFramework.Repository6.DatabaseFactory<C> +Assembly:entityframework.repository6.dll +File(s):C:\Development\EntityFrameworkRepository6\EntityFrameworkRepository6\DatabaseFactory.cs Covered lines:0 Uncovered lines:11 Coverable lines:11 -Total lines:34 +Total lines:33 Line coverage:0% @@ -32,56 +32,55 @@

Metrics

File(s)

-

C:\Development\EntityFrameworkRepository6\EntityFrameworkAuditableRepository6\DatabaseFactory.cs

+

C:\Development\EntityFrameworkRepository6\EntityFrameworkRepository6\DatabaseFactory.cs

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
#LineLine coverage
 1using EntityFramework.Auditing;
 2using System;
 3using System.Data.Entity;
 4
 5namespace EntityFrameworkAuditableRepository6.Base
 6{
 7    public interface IDatabaseFactory<C>
 8    {
 9        C GetNewDbContext();
 10        Action<string> Logging { get; set; }
 11    }
 12
 13    public class DatabaseFactory<C> : IDatabaseFactory<C>
 14        where C : AuditDbContext
 15    {
 016        public Action<string> Logging { get; set; }
 17
 018        protected string dbConnectionString { get; set; }
 19
 020        public DatabaseFactory(string connectionString)
 021        {
 022            dbConnectionString = connectionString;
 023        }
 24
 25        public virtual C GetNewDbContext()
 026        {
 027            var newContext = (C)Activator.CreateInstance(typeof(C), dbConnectionString);
 28
 029            if (Logging != null) { newContext.Database.Log = Logging; }
 30
 031            return newContext;
 032        }
 33    }
 34}
 1using System;
 2using System.Data.Entity;
 3
 4namespace EntityFramework.Repository6
 5{
 6    public interface IDatabaseFactory<C>
 7    {
 8        C GetNewDbContext();
 9        Action<string> Logging { get; set; }
 10    }
 11
 12    public class DatabaseFactory<C> : IDatabaseFactory<C>
 13        where C : DbContext
 14    {
 015        public Action<string> Logging { get; set; }
 16
 017        protected string dbConnectionString { get; set; }
 18
 019        public DatabaseFactory(string connectionString)
 020        {
 021            dbConnectionString = connectionString;
 022        }
 23
 24        public virtual C GetNewDbContext()
 025        {
 026            var newContext = (C)Activator.CreateInstance(typeof(C), dbConnectionString);
 27
 028            if (Logging != null) { newContext.Database.Log = Logging; }
 29
 030            return newContext;
 031        }
 32    }
 33}
-
+
diff --git a/CodeCoverageReport/entityframeworkrepository6.dll_Delta_T_.htm b/CodeCoverageReport/entityframework.repository6.dll_Delta_T_.htm similarity index 77% rename from CodeCoverageReport/entityframeworkrepository6.dll_Delta_T_.htm rename to CodeCoverageReport/entityframework.repository6.dll_Delta_T_.htm index 4b795b5..f139d19 100644 --- a/CodeCoverageReport/entityframeworkrepository6.dll_Delta_T_.htm +++ b/CodeCoverageReport/entityframework.repository6.dll_Delta_T_.htm @@ -3,7 +3,7 @@ -EntityFrameworkRepository6.Base.Delta<T> - Coverage Report +EntityFramework.Repository6.Delta<T> - Coverage Report

Summary

@@ -13,13 +13,13 @@

Summary

-Class:EntityFrameworkRepository6.Base.Delta<T> -Assembly:entityframeworkrepository6.dll -File(s):C:\Development\EntityFrameworkRepository6\EntityFrameworkRepository6\Delta.cs -Covered lines:22 +Class:EntityFramework.Repository6.Delta<T> +Assembly:entityframework.repository6.dll +File(s):C:\Development\EntityFrameworkRepository6\EntityFramework.SharedRepository\Delta.cs +Covered lines:23 Uncovered lines:0 -Coverable lines:22 -Total lines:41 +Coverable lines:23 +Total lines:43 Line coverage:100% @@ -33,64 +33,66 @@

Metrics

File(s)

-

C:\Development\EntityFrameworkRepository6\EntityFrameworkRepository6\Delta.cs

+

C:\Development\EntityFrameworkRepository6\EntityFramework.SharedRepository\Delta.cs

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
#LineLine coverage
 1using System;
 2using System.Collections;
 3using System.Collections.Generic;
 4using System.Reflection;
 5
 6namespace EntityFrameworkRepository6.Base
 7{
 8    public class Delta<T> where T : class
 9    {
 110        List<string> Fields { get; set; }
 111        public T Internal { get; set; }
 12
 13        public List<string> UpdatedFields()
 114        {
 115            return Fields;
 116        }
 17
 118        public Delta()
 119        {
 120            Internal = (T)Activator.CreateInstance(typeof(T));
 121            Fields = new List<string>();
 122        }
 23
 24        public void SetValue(string fieldName, object data)
 125        {
 126            var prop1 = typeof(T).GetProperty(fieldName);
 127            if(prop1 == null)
 128            {
 129                throw new ArgumentException($"{fieldName} was not a property found on the object.");
 30            }
 31            try
 132            {
 133                prop1.SetValue(Internal, data);
 134                Fields.Add(fieldName);
 135            }catch(ArgumentException ex)
 136            {
 137                throw ex;
 38            }
 139        }
 40    }
 41}
 2using System.Collections.Generic;
 3using System.Linq;
 4using System.Text;
 5using System.Threading.Tasks;
 6
 7namespace EntityFramework.Repository6
 8{
 9    public class Delta<T> where T : class
 10    {
 111        List<string> Fields { get; set; }
 112        public T Internal { get; set; }
 13
 14        public List<string> UpdatedFields()
 115        {
 116            return Fields;
 117        }
 18
 119        public Delta()
 120        {
 121            Internal = (T)Activator.CreateInstance(typeof(T));
 122            Fields = new List<string>();
 123        }
 24
 25        public void SetValue(string fieldName, object data)
 126        {
 127            var prop1 = typeof(T).GetProperty(fieldName);
 128            if (prop1 == null)
 129            {
 130                throw new ArgumentException($"{fieldName} was not a property found on the object.");
 31            }
 32            try
 133            {
 134                prop1.SetValue(Internal, data);
 135                Fields.Add(fieldName);
 136            }
 137            catch (ArgumentException ex)
 138            {
 139                throw ex;
 40            }
 141        }
 42    }
 43}
-
+
diff --git a/CodeCoverageReport/entityframeworkauditablerepository6tests.dll_DeltaTests.htm b/CodeCoverageReport/entityframework.repository6.tests.dll_DeltaTests.htm similarity index 77% rename from CodeCoverageReport/entityframeworkauditablerepository6tests.dll_DeltaTests.htm rename to CodeCoverageReport/entityframework.repository6.tests.dll_DeltaTests.htm index 3dee7be..b470715 100644 --- a/CodeCoverageReport/entityframeworkauditablerepository6tests.dll_DeltaTests.htm +++ b/CodeCoverageReport/entityframework.repository6.tests.dll_DeltaTests.htm @@ -3,7 +3,7 @@ -EntityFrameworkRepository6Tests.DeltaTests - Coverage Report +EntityFramework.Repository6.Tests.DeltaTests - Coverage Report

Summary

@@ -13,14 +13,14 @@

Summary

-Class:EntityFrameworkRepository6Tests.DeltaTests -Assembly:entityframeworkauditablerepository6tests.dll -File(s):C:\Development\EntityFrameworkRepository6\EntityFrameworkAuditableRepository6Tests\DeltaTests.cs -Covered lines:36 +Class:EntityFramework.Repository6.Tests.DeltaTests +Assembly:entityframework.repository6.tests.dll +File(s):C:\Development\EntityFrameworkRepository6\EntityFrameworkRepository6Tests\DeltaTests.cs +Covered lines:48 Uncovered lines:2 -Coverable lines:38 -Total lines:91 -Line coverage:94.7% +Coverable lines:50 +Total lines:111 +Line coverage:96%

Metrics

@@ -28,13 +28,14 @@

Metrics

MethodBlocks covered  Blocks not covered   Setup()180 -DeltaTest1Audit()160 -DeltaTestWrongDataType1Audit()81 -DeltaTestInvalidFieldName1Audit()81 +DeltaTest1()160 +DeltaTestWrongDataType1()81 +DeltaTestInvalidFieldName1()81 +DeltaTestWithPredicate()270

File(s)

-

C:\Development\EntityFrameworkRepository6\EntityFrameworkAuditableRepository6Tests\DeltaTests.cs

+

C:\Development\EntityFrameworkRepository6\EntityFrameworkRepository6Tests\DeltaTests.cs

@@ -42,14 +43,14 @@

- - - - - - + + + + + + - + @@ -80,9 +81,9 @@

- + - + @@ -100,10 +101,10 @@

- + - + @@ -114,10 +115,10 @@

- + - + @@ -127,20 +128,41 @@

- - + + + + + + + + + + + + + + + + + + + + + +
#LineLine coverage
 2using Microsoft.VisualStudio.TestTools.UnitTesting;
 3using System.Diagnostics;
 4using Microsoft.Practices.Unity;
 5using System.Linq;
 6using System.Data.Entity.Infrastructure;
 7using PersistentLayerAuditable.Repositories;
 8using EntityFrameworkAuditableRepository6.Base;
 9using EntityFrameworkAuditableRepository6Tests;
 10using PersistentLayerAuditable.Entities;
 5using PersistentLayer.Repositories;
 6using System.Linq;
 7using PersistentLayer.Entities;
 8using System.Data.Entity.Infrastructure;
 9using EntityFramework.Repository6.Interfaces;
 10using EntityFramework.Repository6;
 11
 12namespace EntityFrameworkRepository6Tests
 12namespace EntityFramework.Repository6.Tests
 13{
 14    [TestClass]
 15    public class DeltaTests
 140                , new InjectionProperty("Logging", logSetup));
 141        }
 42
 43        [TestCategory("AuditRepository")]
 43        [TestCategory("StandardRepository")]
 44        [TestMethod]
 45        public void DeltaTest1Audit()
 45        public void DeltaTest1()
 146        {
 147            var repository = LocalIoCContainer.Resolve<ISimpleDataEntityRepository>();
 148            var newItem = new SimpleDataEntity { Name = "Delta Test" };
 160            Assert.AreEqual("Delta Change Test", updatedValue.Name);
 161        }
 62
 63        [TestCategory("AuditRepository")]
 63        [TestCategory("StandardRepository")]
 64        [TestMethod]
 65        [ExpectedException(typeof(ArgumentException))]
 66        public void DeltaTestWrongDataType1Audit()
 66        public void DeltaTestWrongDataType1()
 167        {
 168            var repository = LocalIoCContainer.Resolve<ISimpleDataEntityRepository>();
 169            var newItem = new SimpleDataEntity { Name = "Delta Test" };
 174            delta1.SetValue("Name", 1);
 075        }
 76
 77        [TestCategory("AuditRepository")]
 77        [TestCategory("StandardRepository")]
 78        [TestMethod]
 79        [ExpectedException(typeof(ArgumentException))]
 80        public void DeltaTestInvalidFieldName1Audit()
 80        public void DeltaTestInvalidFieldName1()
 181        {
 182            var repository = LocalIoCContainer.Resolve<ISimpleDataEntityRepository>();
 183            var newItem = new SimpleDataEntity { Name = "Delta Test" };
 187            var delta1 = new Delta<SimpleDataEntity>();
 188            delta1.SetValue("NameNotRight", "Right data type");
 089        }
 90    }
 91}
 90
 91        [TestCategory("StandardRepository")]
 92        [TestMethod]
 93        public void DeltaTestWithPredicate()
 194        {
 195            var repository = LocalIoCContainer.Resolve<ISimpleDataEntityRepository>();
 196            var newItem = new SimpleDataEntity { Name = "Delta Test" };
 197            var actual = repository.Add(newItem);
 198            var result = repository.Save();
 99
 1100            var delta1 = new Delta<SimpleDataEntity>();
 1101            delta1.SetValue("Name", "Delta Change Test");
 102
 1103            repository.Update(delta1, x=>x.Id == newItem.Id);
 104
 1105            repository.Save();
 106
 1107            var updatedValue = repository.Find(actual.Id);
 1108            Assert.AreEqual("Delta Change Test", updatedValue.Name);
 1109        }
 110    }
 111}
-
+
diff --git a/CodeCoverageReport/entityframeworkrepository6tests.dll_RepositoryCreateTests.htm b/CodeCoverageReport/entityframework.repository6.tests.dll_RepositoryCreateTests.htm similarity index 69% rename from CodeCoverageReport/entityframeworkrepository6tests.dll_RepositoryCreateTests.htm rename to CodeCoverageReport/entityframework.repository6.tests.dll_RepositoryCreateTests.htm index 55e185e..d5f490e 100644 --- a/CodeCoverageReport/entityframeworkrepository6tests.dll_RepositoryCreateTests.htm +++ b/CodeCoverageReport/entityframework.repository6.tests.dll_RepositoryCreateTests.htm @@ -3,7 +3,7 @@ -EntityFrameworkRepository6Tests.RepositoryCreateTests - Coverage Report +EntityFramework.Repository6.Tests.RepositoryCreateTests - Coverage Report

Summary

@@ -13,14 +13,14 @@

Summary

-Class:EntityFrameworkRepository6Tests.RepositoryCreateTests -Assembly:entityframeworkrepository6tests.dll +Class:EntityFramework.Repository6.Tests.RepositoryCreateTests +Assembly:entityframework.repository6.tests.dll File(s):C:\Development\EntityFrameworkRepository6\EntityFrameworkRepository6Tests\RepositoryCreateTests.cs -Covered lines:62 +Covered lines:80 Uncovered lines:1 -Coverable lines:63 -Total lines:137 -Line coverage:98.4% +Coverable lines:81 +Total lines:165 +Line coverage:98.7%

Metrics

@@ -31,6 +31,7 @@

Metrics

InsertTestMethod()140 InsertTestMethod2()140 InsertTestMethod3()140 +InsertMultipleTest()200 InsertIntoCompositeKeyTableMethod()240 InsertDuplicateIntoCompositeKeyTableMethod()171 @@ -45,152 +46,181 @@

 3using System.Diagnostics;  4using Microsoft.Practices.Unity;  5using PersistentLayer.Repositories;6using EntityFrameworkRepository6.Base;7using System.Linq;8using PersistentLayer.Entities;9using System.Data.Entity.Infrastructure;1011namespace EntityFrameworkRepository6Tests12{13    [TestClass]14    public class RepositoryCreateTests15    { - 116        UnityContainer LocalIoCContainer { get; set; }1718        [TestInitialize]19        public void Setup() - 120        { - 121            Action<string> logSetup = message => Debug.WriteLine(message);22 - 123            LocalIoCContainer = new UnityContainer(); - 124            LocalIoCContainer.RegisterType<ISimpleDataEntityRepository, SimpleDataEntityRepository>(new HierarchicalLife - 125            LocalIoCContainer.RegisterType<ISimpleCompositeKeyEntityRepository, SimpleCompositeKeyEntityRepository>(new 2627            //Use a physical database file28            //var connectionString = @"Data Source = (LocalDb)\MSSQLLocalDB; Database = TestDatabase; Integrated Securit29            //or30            //var connectionString = @"TestDatabase";31            //LocalIoCContainer.RegisterType(typeof(IDatabaseFactory<>), typeof(DatabaseFactory<>)32            //    , new HierarchicalLifetimeManager()33            //    , new InjectionConstructor(connectionString)34            //    , new InjectionProperty("Logging", logSetup));3536            //Use an nmemory database - 137            LocalIoCContainer.RegisterType(typeof(IDatabaseFactory<>), typeof(TestExampleDatabaseFactory) - 138                , new HierarchicalLifetimeManager() - 139                , new InjectionProperty("Logging", logSetup)); - 140        }4142        [TestCategory("StandardRepository")]43        [TestMethod]44        public void InsertTestMethod() - 145        { - 146            var repository = LocalIoCContainer.Resolve<ISimpleDataEntityRepository>(); - 147            var newItem = new SimpleDataEntity { Name = "My Test" }; - 148            var actual = repository.Add(newItem); - 149            var result = repository.Save();50 - 151            Assert.AreNotEqual(0, actual.Id);52 - 153            var actual2 = repository.Find(actual.Id);54 - 155            Assert.AreEqual("My Test", actual2.Name);56 - 157            repository.Dispose(); - 158        }5960        [TestCategory("StandardRepository")]61        [TestMethod]62        public void InsertTestMethod2() - 163        { - 164            var repository = LocalIoCContainer.Resolve<ISimpleDataEntityRepository>(); - 165            var newItem = new SimpleDataEntity { Name = "My Test 200" }; - 166            var actual = repository.Add(newItem); - 167            var result = repository.Save();68 - 169            Assert.AreNotEqual(0, actual.Id);70 - 171            var actual2 = repository.Find(actual.Id);72 - 173            Assert.AreEqual("My Test 200", actual2.Name);74 - 175            repository.Dispose(); - 176        }7778        [TestCategory("StandardRepository")]79        [TestMethod]80        public void InsertTestMethod3() - 181        { - 182            var repository = LocalIoCContainer.Resolve<ISimpleDataEntityRepository>(); - 183            var newItem = new SimpleDataEntity { Name = "My Test 300" }; - 184            var actual = repository.Add(newItem); - 185            var result = repository.Save();86 - 187            Assert.AreNotEqual(0, actual.Id);88 - 189            var actual2 = repository.Find(actual.Id);90 - 191            Assert.AreEqual("My Test 300", actual2.Name);92 - 193            repository.Dispose(); - 194        }9596        [TestCategory("StandardRepository")]97        [TestMethod]98        public void InsertIntoCompositeKeyTableMethod() - 199        { - 1100            var repository = LocalIoCContainer.Resolve<ISimpleCompositeKeyEntityRepository>(); - 1101            var newItem = new SimpleCompositeKeyEntity { Id = 1, Name = "Composite Test" }; - 1102            var actual = repository.Add(newItem); - 1103            var result = repository.Save();6using System.Linq;7using PersistentLayer.Entities;8using System.Data.Entity.Infrastructure;9using EntityFramework.Repository6;10using System.Collections.Generic;1112namespace EntityFramework.Repository6.Tests13{14    [TestClass]15    public class RepositoryCreateTests16    { + 117        UnityContainer LocalIoCContainer { get; set; }1819        [TestInitialize]20        public void Setup() + 121        { + 122            Action<string> logSetup = message => Debug.WriteLine(message);23 + 124            LocalIoCContainer = new UnityContainer(); + 125            LocalIoCContainer.RegisterType<ISimpleDataEntityRepository, SimpleDataEntityRepository>(new HierarchicalLife + 126            LocalIoCContainer.RegisterType<ISimpleCompositeKeyEntityRepository, SimpleCompositeKeyEntityRepository>(new 2728            //Use a physical database file29            //var connectionString = @"Data Source = (LocalDb)\MSSQLLocalDB; Database = TestDatabase; Integrated Securit30            //or31            //var connectionString = @"TestDatabase";32            //LocalIoCContainer.RegisterType(typeof(IDatabaseFactory<>), typeof(DatabaseFactory<>)33            //    , new HierarchicalLifetimeManager()34            //    , new InjectionConstructor(connectionString)35            //    , new InjectionProperty("Logging", logSetup));3637            //Use an nmemory database + 138            LocalIoCContainer.RegisterType(typeof(IDatabaseFactory<>), typeof(TestExampleDatabaseFactory) + 139                , new HierarchicalLifetimeManager() + 140                , new InjectionProperty("Logging", logSetup)); + 141        }4243        [TestCategory("StandardRepository")]44        [TestMethod]45        public void InsertTestMethod() + 146        { + 147            var repository = LocalIoCContainer.Resolve<ISimpleDataEntityRepository>(); + 148            var newItem = new SimpleDataEntity { Name = "My Test" }; + 149            var actual = repository.Add(newItem); + 150            var result = repository.Save();51 + 152            Assert.AreNotEqual(0, actual.Id);53 + 154            var actual2 = repository.Find(actual.Id);55 + 156            Assert.AreEqual("My Test", actual2.Name);57 + 158            repository.Dispose(); + 159        }6061        [TestCategory("StandardRepository")]62        [TestMethod]63        public void InsertTestMethod2() + 164        { + 165            var repository = LocalIoCContainer.Resolve<ISimpleDataEntityRepository>(); + 166            var newItem = new SimpleDataEntity { Name = "My Test 200" }; + 167            var actual = repository.Add(newItem); + 168            var result = repository.Save();69 + 170            Assert.AreNotEqual(0, actual.Id);71 + 172            var actual2 = repository.Find(actual.Id);73 + 174            Assert.AreEqual("My Test 200", actual2.Name);75 + 176            repository.Dispose(); + 177        }7879        [TestCategory("StandardRepository")]80        [TestMethod]81        public void InsertTestMethod3() + 182        { + 183            var repository = LocalIoCContainer.Resolve<ISimpleDataEntityRepository>(); + 184            var newItem = new SimpleDataEntity { Name = "My Test 300" }; + 185            var actual = repository.Add(newItem); + 186            var result = repository.Save();87 + 188            Assert.AreNotEqual(0, actual.Id);89 + 190            var actual2 = repository.Find(actual.Id);91 + 192            Assert.AreEqual("My Test 300", actual2.Name);93 + 194            repository.Dispose(); + 195        }9697        [TestCategory("StandardRepository")]98        [TestMethod]99        public void InsertMultipleTest() + 1100        { + 1101            var repository = LocalIoCContainer.Resolve<ISimpleDataEntityRepository>();102 + 1103            var actual1 = repository.Count();  104 - 1105            Assert.AreNotEqual(0, actual.Id);106 - 1107            var actual2 = repository.Find(actual.Id, actual.Name);108 - 1109            var saveAgain = repository.Add(new SimpleCompositeKeyEntity { Id = 2, Name = "Composite Test" }); - 1110            var result2 = repository.Save();111 - 1112            Assert.AreNotEqual(actual.Id, saveAgain.Id);113 - 1114            Assert.AreEqual("Composite Test", actual2.Name); + 1105            var newItem1 = new SimpleDataEntity { Name = "Multiple Item 1" }; + 1106            var newItem2 = new SimpleDataEntity { Name = "Multiple Item 2" }; + 1107            var newItem3 = new SimpleDataEntity { Name = "Multiple Item 3" }; + 1108            var actual = repository.Add(new List<SimpleDataEntity> + 1109            { + 1110                newItem1 + 1111                , newItem2 + 1112                , newItem3 + 1113            }); + 1114            var result = repository.Save();  115 - 1116            repository.Dispose(); - 1117        }118119        [TestCategory("StandardRepository")]120        [TestMethod]121        [ExpectedException(typeof(DbUpdateException))]122        public void InsertDuplicateIntoCompositeKeyTableMethod() - 1123        { - 1124            var repository = LocalIoCContainer.Resolve<ISimpleCompositeKeyEntityRepository>(); - 1125            var newItem = new SimpleCompositeKeyEntity { Id = 1, Name = "Composite Test" }; - 1126            var actual = repository.Add(newItem); - 1127            var result = repository.Save();128 - 1129            Assert.AreNotEqual(0, actual.Id);130 - 1131            var actual2 = repository.Find(actual.Id, actual.Name); + 1116            var actual2 = repository.Count();117 + 1118            Assert.AreEqual(7, actual1); + 1119            Assert.AreEqual(10, actual2);120 + 1121            repository.Dispose(); + 1122        }123124        [TestCategory("StandardRepository")]125        [TestMethod]126        public void InsertIntoCompositeKeyTableMethod() + 1127        { + 1128            var repository = LocalIoCContainer.Resolve<ISimpleCompositeKeyEntityRepository>(); + 1129            var newItem = new SimpleCompositeKeyEntity { Id = 1, Name = "Composite Test" }; + 1130            var actual = repository.Add(newItem); + 1131            var result = repository.Save();  132 - 1133            var saveAgain = repository.Add(new SimpleCompositeKeyEntity { Id = 1, Name = "Composite Test" }); - 1134            var result2 = repository.Save(); - 0135        }136    }137} + 1133            Assert.AreNotEqual(0, actual.Id);134 + 1135            var actual2 = repository.Find(actual.Id, actual.Name);136 + 1137            var saveAgain = repository.Add(new SimpleCompositeKeyEntity { Id = 2, Name = "Composite Test" }); + 1138            var result2 = repository.Save();139 + 1140            Assert.AreNotEqual(actual.Id, saveAgain.Id);141 + 1142            Assert.AreEqual("Composite Test", actual2.Name);143 + 1144            repository.Dispose(); + 1145        }146147        [TestCategory("StandardRepository")]148        [TestMethod]149        [ExpectedException(typeof(DbUpdateException))]150        public void InsertDuplicateIntoCompositeKeyTableMethod() + 1151        { + 1152            var repository = LocalIoCContainer.Resolve<ISimpleCompositeKeyEntityRepository>(); + 1153            var newItem = new SimpleCompositeKeyEntity { Id = 1, Name = "Composite Test" }; + 1154            var actual = repository.Add(newItem); + 1155            var result = repository.Save();156 + 1157            Assert.AreNotEqual(0, actual.Id);158 + 1159            var actual2 = repository.Find(actual.Id, actual.Name);160 + 1161            var saveAgain = repository.Add(new SimpleCompositeKeyEntity { Id = 1, Name = "Composite Test" }); + 1162            var result2 = repository.Save(); + 0163        }164    }165} -

+
diff --git a/CodeCoverageReport/entityframeworkrepository6tests.dll_DeltaTests.htm b/CodeCoverageReport/entityframework.repository6.tests.dll_RepositoryDeleteTests.htm similarity index 70% rename from CodeCoverageReport/entityframeworkrepository6tests.dll_DeltaTests.htm rename to CodeCoverageReport/entityframework.repository6.tests.dll_RepositoryDeleteTests.htm index 6c3c0d0..31be7a0 100644 --- a/CodeCoverageReport/entityframeworkrepository6tests.dll_DeltaTests.htm +++ b/CodeCoverageReport/entityframework.repository6.tests.dll_RepositoryDeleteTests.htm @@ -3,7 +3,7 @@ -EntityFrameworkRepository6Tests.DeltaTests - Coverage Report +EntityFramework.Repository6.Tests.RepositoryDeleteTests - Coverage Report

Summary

@@ -13,14 +13,14 @@

Summary

-Class:EntityFrameworkRepository6Tests.DeltaTests -Assembly:entityframeworkrepository6tests.dll -File(s):C:\Development\EntityFrameworkRepository6\EntityFrameworkRepository6Tests\DeltaTests.cs -Covered lines:36 -Uncovered lines:2 -Coverable lines:38 -Total lines:90 -Line coverage:94.7% +Class:EntityFramework.Repository6.Tests.RepositoryDeleteTests +Assembly:entityframework.repository6.tests.dll +File(s):C:\Development\EntityFrameworkRepository6\EntityFrameworkRepository6Tests\RepositoryDeleteTests.cs +Covered lines:32 +Uncovered lines:0 +Coverable lines:32 +Total lines:87 +Line coverage:100%

Metrics

@@ -28,118 +28,113 @@

Metrics

MethodBlocks covered  Blocks not covered   Setup()180 -DeltaTest1()160 -DeltaTestWrongDataType1()81 -DeltaTestInvalidFieldName1()81 +DeleteTestMethod()110 +DeleteMultipleTestMethod()250

File(s)

-

C:\Development\EntityFrameworkRepository6\EntityFrameworkRepository6Tests\DeltaTests.cs

+

C:\Development\EntityFrameworkRepository6\EntityFrameworkRepository6Tests\RepositoryDeleteTests.cs

- + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - - - - - - - + + + + + + + + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + +
#LineLine coverage
 1using System;
 1using Microsoft.Practices.Unity;
 2using Microsoft.VisualStudio.TestTools.UnitTesting;
 3using System.Diagnostics;
 4using Microsoft.Practices.Unity;
 5using PersistentLayer.Repositories;
 6using EntityFrameworkRepository6.Base;
 7using System.Linq;
 8using PersistentLayer.Entities;
 9using System.Data.Entity.Infrastructure;
 10
 11namespace EntityFrameworkRepository6Tests
 12{
 13    [TestClass]
 14    public class DeltaTests
 15    {
 116        UnityContainer LocalIoCContainer { get; set; }
 17
 18        [TestInitialize]
 19        public void Setup()
 120        {
 121            Action<string> logSetup = message => Debug.WriteLine(message);
 22
 123            LocalIoCContainer = new UnityContainer();
 124            LocalIoCContainer.RegisterType<ISimpleDataEntityRepository, SimpleDataEntityRepository>(new HierarchicalLife
 125            LocalIoCContainer.RegisterType<ISimpleCompositeKeyEntityRepository, SimpleCompositeKeyEntityRepository>(new 
 26
 27            //Use a physical database file
 28            //var connectionString = @"Data Source = (LocalDb)\MSSQLLocalDB; Database = TestDatabase; Integrated Securit
 29            //or
 30            //var connectionString = @"TestDatabase";
 31            //LocalIoCContainer.RegisterType(typeof(IDatabaseFactory<>), typeof(DatabaseFactory<>)
 32            //    , new HierarchicalLifetimeManager()
 33            //    , new InjectionConstructor(connectionString)
 34            //    , new InjectionProperty("Logging", logSetup));
 35
 36            //Use an nmemory database
 137            LocalIoCContainer.RegisterType(typeof(IDatabaseFactory<>), typeof(TestExampleDatabaseFactory)
 138                , new HierarchicalLifetimeManager()
 139                , new InjectionProperty("Logging", logSetup));
 140        }
 41
 42        [TestCategory("StandardRepository")]
 43        [TestMethod]
 44        public void DeltaTest1()
 145        {
 146            var repository = LocalIoCContainer.Resolve<ISimpleDataEntityRepository>();
 147            var newItem = new SimpleDataEntity { Name = "Delta Test" };
 148            var actual = repository.Add(newItem);
 149            var result = repository.Save();
 3using PersistentLayer.Entities;
 4using PersistentLayer.Repositories;
 5using System;
 6using System.Collections.Generic;
 7using System.Diagnostics;
 8using System.Linq;
 9using System.Text;
 10using System.Threading.Tasks;
 11
 12namespace EntityFramework.Repository6.Tests
 13{
 14    [TestClass]
 15    public class RepositoryDeleteTests
 16    {
 117        UnityContainer LocalIoCContainer { get; set; }
 18
 19        [TestInitialize]
 20        public void Setup()
 121        {
 122            Action<string> logSetup = message => Debug.WriteLine(message);
 23
 124            LocalIoCContainer = new UnityContainer();
 125            LocalIoCContainer.RegisterType<ISimpleDataEntityRepository, SimpleDataEntityRepository>(new HierarchicalLife
 126            LocalIoCContainer.RegisterType<ISimpleCompositeKeyEntityRepository, SimpleCompositeKeyEntityRepository>(new 
 27
 28            //Use a physical database file
 29            //var connectionString = @"Data Source = (LocalDb)\MSSQLLocalDB; Database = TestDatabase; Integrated Securit
 30            //or
 31            //var connectionString = @"TestDatabase";
 32            //LocalIoCContainer.RegisterType(typeof(IDatabaseFactory<>), typeof(DatabaseFactory<>)
 33            //    , new HierarchicalLifetimeManager()
 34            //    , new InjectionConstructor(connectionString)
 35            //    , new InjectionProperty("Logging", logSetup));
 36
 37            //Use an nmemory database
 138            LocalIoCContainer.RegisterType(typeof(IDatabaseFactory<>), typeof(TestExampleDatabaseFactory)
 139                , new HierarchicalLifetimeManager()
 140                , new InjectionProperty("Logging", logSetup));
 141        }
 42
 43        [TestCategory("StandardRepository")]
 44        [TestMethod]
 45        public void DeleteTestMethod()
 146        {
 147            var repository = LocalIoCContainer.Resolve<ISimpleDataEntityRepository>();
 48
 149            var actual1 = repository.Count();
 50
 151            var delta1 = new Delta<SimpleDataEntity>();
 152            delta1.SetValue("Name", "Delta Change Test");
 53
 154            repository.Update(delta1, newItem.Id);
 55
 156            repository.Save();
 57
 158            var updatedValue = repository.Find(actual.Id);
 159            Assert.AreEqual("Delta Change Test", updatedValue.Name);
 160        }
 151            var itemToDelete = repository.Find(1);
 52
 153            repository.Delete(itemToDelete);
 54
 155            repository.Save();
 56
 157            var actual2 = repository.Count();
 58
 159            Assert.AreEqual(7, actual1);
 160            Assert.AreEqual(6, actual2);
 61
 62        [TestCategory("StandardRepository")]
 63        [TestMethod]
 64        [ExpectedException(typeof(ArgumentException))]
 65        public void DeltaTestWrongDataType1()
 166        {
 167            var repository = LocalIoCContainer.Resolve<ISimpleDataEntityRepository>();
 168            var newItem = new SimpleDataEntity { Name = "Delta Test" };
 169            var actual = repository.Add(newItem);
 170            var result = repository.Save();
 71
 172            var delta1 = new Delta<SimpleDataEntity>();
 173            delta1.SetValue("Name", 1);
 074        }
 75
 76        [TestCategory("StandardRepository")]
 77        [TestMethod]
 78        [ExpectedException(typeof(ArgumentException))]
 79        public void DeltaTestInvalidFieldName1()
 180        {
 181            var repository = LocalIoCContainer.Resolve<ISimpleDataEntityRepository>();
 182            var newItem = new SimpleDataEntity { Name = "Delta Test" };
 183            var actual = repository.Add(newItem);
 184            var result = repository.Save();
 85
 186            var delta1 = new Delta<SimpleDataEntity>();
 187            delta1.SetValue("NameNotRight", "Right data type");
 088        }
 89    }
 90}
 162            repository.Dispose();
 163        }
 64
 65        [TestCategory("StandardRepository")]
 66        [TestMethod]
 67        public void DeleteMultipleTestMethod()
 168        {
 169            var repository = LocalIoCContainer.Resolve<ISimpleDataEntityRepository>();
 70
 171            var actual1 = repository.Count();
 72
 173            var itemsToDelete = repository.FindBy(x => x.Id == 1 || x.Id == 2);
 74
 175            repository.Delete(itemsToDelete);
 76
 177            repository.Save();
 78
 179            var actual2 = repository.Count();
 80
 181            Assert.AreEqual(7, actual1);
 182            Assert.AreEqual(5, actual2);
 83
 184            repository.Dispose();
 185        }
 86    }
 87}
-
+
diff --git a/CodeCoverageReport/entityframeworkrepository6tests.dll_RepositoryReadTests.htm b/CodeCoverageReport/entityframework.repository6.tests.dll_RepositoryReadTests.htm similarity index 62% rename from CodeCoverageReport/entityframeworkrepository6tests.dll_RepositoryReadTests.htm rename to CodeCoverageReport/entityframework.repository6.tests.dll_RepositoryReadTests.htm index 6db7e5b..a446b82 100644 --- a/CodeCoverageReport/entityframeworkrepository6tests.dll_RepositoryReadTests.htm +++ b/CodeCoverageReport/entityframework.repository6.tests.dll_RepositoryReadTests.htm @@ -3,7 +3,7 @@ -EntityFrameworkRepository6Tests.RepositoryReadTests - Coverage Report +EntityFramework.Repository6.Tests.RepositoryReadTests - Coverage Report

Summary

@@ -13,13 +13,13 @@

Summary

-Class:EntityFrameworkRepository6Tests.RepositoryReadTests -Assembly:entityframeworkrepository6tests.dll +Class:EntityFramework.Repository6.Tests.RepositoryReadTests +Assembly:entityframework.repository6.tests.dll File(s):C:\Development\EntityFrameworkRepository6\EntityFrameworkRepository6Tests\RepositoryReadTests.cs -Covered lines:46 +Covered lines:78 Uncovered lines:0 -Coverable lines:46 -Total lines:112 +Coverable lines:78 +Total lines:178 Line coverage:100% @@ -34,6 +34,10 @@

Metrics

SelectTestMethod()160 FindAsyncTest()80 FindAsyncMultipleParamsTest()80 +FindByReadOnlyTestAudit()160 +ExistsTestAudit()140 +FindAndReloadAsyncTestAudit()150 +FindAndReloadTestAudit()130

File(s)

@@ -46,10 +50,10 @@

 3using System.Diagnostics;  4using Microsoft.Practices.Unity;  5using PersistentLayer.Repositories;6using EntityFrameworkRepository6.Base;7using System.Linq;6using System.Linq;7using EntityFramework.Repository6;  89namespace EntityFrameworkRepository6Tests9namespace EntityFramework.Repository6.Tests  10{  11    [TestClass]  12    public class RepositoryReadTests @@ -151,11 +155,77 @@

 108  1109            repository.Dispose();  1110        }111    }112}111112        [TestCategory("StandardRepository")]113        [TestMethod]114        public void FindByReadOnlyTestAudit() + 1115        { + 1116            var repository = LocalIoCContainer.Resolve<ISimpleDataEntityRepository>();117 + 1118            var actual = repository.FindByReadOnly(x => x.Id == 1).SingleOrDefault(); + 1119            Assert.AreEqual("Test 1", actual.Name);120 + 1121            repository.Dispose(); + 1122        }123124        [TestCategory("StandardRepository")]125        [TestMethod]126        public void ExistsTestAudit() + 1127        { + 1128            var repository = LocalIoCContainer.Resolve<ISimpleDataEntityRepository>();129 + 1130            var actual = repository.Exists(x => x.Id == 1); + 1131            Assert.IsTrue(actual);132 + 1133            repository.Dispose(); + 1134        }135136        [TestCategory("StandardRepository")]137        [TestMethod]138        public void FindAndReloadAsyncTestAudit() + 1139        { + 1140            var repository = LocalIoCContainer.Resolve<ISimpleDataEntityRepository>();141142            //Load the entity + 1143            var actualEntity = repository.FindAsync(2).Result; + 1144            Assert.AreEqual("Test 2", actualEntity.Name);145146            //Alter the entity + 1147            actualEntity.Name = "Test 10"; + 1148            Assert.AreEqual("Test 10", actualEntity.Name);149150            //Reload the entity from the database, resetting the data + 1151            repository.ReloadAsync(actualEntity).Wait();152 + 1153            Assert.AreEqual("Test 2", actualEntity.Name); + 1154            repository.Dispose(); + 1155        }156157        [TestCategory("StandardRepository")]158        [TestMethod]159        public void FindAndReloadTestAudit() + 1160        { + 1161            var repository = LocalIoCContainer.Resolve<ISimpleDataEntityRepository>();162163            //Load the entity + 1164            var actualEntity = repository.Find(2); + 1165            Assert.AreEqual("Test 2", actualEntity.Name);166167            //Alter the entity + 1168            actualEntity.Name = "Test 10"; + 1169            Assert.AreEqual("Test 10", actualEntity.Name);170171            //Reload the entity from the database, resetting the data + 1172            repository.Reload(actualEntity);173 + 1174            Assert.AreEqual("Test 2", actualEntity.Name); + 1175            repository.Dispose(); + 1176        }177    }178} -

+
diff --git a/CodeCoverageReport/entityframeworkrepository6tests.dll_RepositoryUpdateTests.htm b/CodeCoverageReport/entityframework.repository6.tests.dll_RepositoryUpdateTests.htm similarity index 83% rename from CodeCoverageReport/entityframeworkrepository6tests.dll_RepositoryUpdateTests.htm rename to CodeCoverageReport/entityframework.repository6.tests.dll_RepositoryUpdateTests.htm index c941cfd..ec15874 100644 --- a/CodeCoverageReport/entityframeworkrepository6tests.dll_RepositoryUpdateTests.htm +++ b/CodeCoverageReport/entityframework.repository6.tests.dll_RepositoryUpdateTests.htm @@ -3,7 +3,7 @@ -EntityFrameworkRepository6Tests.RepositoryUpdateTests - Coverage Report +EntityFramework.Repository6.Tests.RepositoryUpdateTests - Coverage Report

Summary

@@ -13,13 +13,13 @@

Summary

-Class:EntityFrameworkRepository6Tests.RepositoryUpdateTests -Assembly:entityframeworkrepository6tests.dll +Class:EntityFramework.Repository6.Tests.RepositoryUpdateTests +Assembly:entityframework.repository6.tests.dll File(s):C:\Development\EntityFrameworkRepository6\EntityFrameworkRepository6Tests\RepositoryUpdateTests.cs Covered lines:46 Uncovered lines:1 Coverable lines:47 -Total lines:111 +Total lines:112 Line coverage:97.8% @@ -39,130 +39,131 @@

#LineLine coverage - 1using EntityFrameworkRepository6.Base;2using Microsoft.Practices.Unity;3using Microsoft.VisualStudio.TestTools.UnitTesting;4using PersistentLayer.Entities;5using PersistentLayer.Repositories;6using System;7using System.Data.Entity.Infrastructure;8using System.Diagnostics;9using System.Linq;1011namespace EntityFrameworkRepository6Tests12{13    [TestClass]14    public class RepositoryUpdateTests15    { - 116        UnityContainer LocalIoCContainer { get; set; }1718        [TestInitialize]19        public void Setup() - 120        { - 121            Action<string> logSetup = message => Debug.WriteLine(message);22 - 123            LocalIoCContainer = new UnityContainer(); - 124            LocalIoCContainer.RegisterType<ISimpleDataEntityRepository, SimpleDataEntityRepository>(new HierarchicalLife - 125            LocalIoCContainer.RegisterType<ISimpleCompositeKeyEntityRepository, SimpleCompositeKeyEntityRepository>(new 2627            //Use a physical database file28            //Direct connection string29            //var connectionString = @"Data Source = (LocalDb)\MSSQLLocalDB; Database = TestDatabase; Integrated Securit30            //or31            //Computed connection32            //var connectionString = @"TestDatabase";33            //LocalIoCContainer.RegisterType(typeof(IDatabaseFactory<>), typeof(DatabaseFactory<>)34            //    , new HierarchicalLifetimeManager()35            //    , new InjectionConstructor(connectionString)36            //    , new InjectionProperty("Logging", logSetup));3738            //Use an nmemory database - 139            LocalIoCContainer.RegisterType(typeof(IDatabaseFactory<>), typeof(TestExampleDatabaseFactory) - 140                , new HierarchicalLifetimeManager() - 141                , new InjectionProperty("Logging", logSetup)); - 142        }4344        [TestCategory("StandardRepository")]45        [TestMethod]46        public void UpdateTestMethod() - 147        { - 148            var repository = LocalIoCContainer.Resolve<ISimpleDataEntityRepository>();49 - 150            var itemToUpdate = repository.Find(2); - 151            itemToUpdate.Name = "Updated Name"; - 152            repository.Update(itemToUpdate, itemToUpdate.Id); - 153            repository.Save();54 - 155            var actual = repository.Find(2);56 - 157            Assert.AreEqual("Updated Name", actual.Name);58 - 159            repository.Dispose(); - 160        }6162        [TestCategory("StandardRepository")]63        [TestMethod]64        public void UpdateTestMethodWithIgnoreFieldFeature() - 165        { - 166            var repository = LocalIoCContainer.Resolve<ISimpleDataEntityRepository>(); - 167            repository.AddUpdateIgnoreField("Name");68 - 169            var itemToUpdate = repository.Find(2); - 170            itemToUpdate.Name = "Updated Name"; - 171            repository.Update(itemToUpdate, itemToUpdate.Id); - 172            repository.Save();73 - 174            var actual = repository.Find(2);75 - 176            Assert.AreNotEqual("Updated Name", actual.Name);77 - 178            repository.Dispose(); - 179        }8081        [TestCategory("StandardRepository")]82        [TestMethod]83        public void UpdateByTestMethod() - 184        { - 185            var repository = LocalIoCContainer.Resolve<ISimpleDataEntityRepository>();86 - 187            var itemToUpdate = repository.Find(2); - 188            itemToUpdate.Name = "Updated Name 2"; - 189            repository.Update(itemToUpdate, x => x.Id == 2); - 190            repository.Save();91 - 192            var actual = repository.Find(2);93 - 194            Assert.AreEqual("Updated Name 2", actual.Name);95 - 196            repository.Dispose(); - 197        }9899        [TestCategory("StandardRepository")]100        [TestMethod]101        [ExpectedException(typeof(System.Exception))]102        public void UpdateByTestMethodIncorrectId() - 1103        { - 1104            var repository = LocalIoCContainer.Resolve<ISimpleDataEntityRepository>();105 - 1106            var itemToUpdate = repository.Find(2); - 1107            itemToUpdate.Name = "Updated Name 2"; - 1108            repository.Update(itemToUpdate, x => x.Id == 55); - 0109        }110    }111}1using Microsoft.Practices.Unity;2using Microsoft.VisualStudio.TestTools.UnitTesting;3using PersistentLayer.Entities;4using PersistentLayer.Repositories;5using System;6using System.Data.Entity.Infrastructure;7using System.Diagnostics;8using System.Linq;9using EntityFramework.Repository6.Interfaces;10using EntityFramework.Repository6;1112namespace EntityFramework.Repository6.Tests13{14    [TestClass]15    public class RepositoryUpdateTests16    { + 117        UnityContainer LocalIoCContainer { get; set; }1819        [TestInitialize]20        public void Setup() + 121        { + 122            Action<string> logSetup = message => Debug.WriteLine(message);23 + 124            LocalIoCContainer = new UnityContainer(); + 125            LocalIoCContainer.RegisterType<ISimpleDataEntityRepository, SimpleDataEntityRepository>(new HierarchicalLife + 126            LocalIoCContainer.RegisterType<ISimpleCompositeKeyEntityRepository, SimpleCompositeKeyEntityRepository>(new 2728            //Use a physical database file29            //Direct connection string30            //var connectionString = @"Data Source = (LocalDb)\MSSQLLocalDB; Database = TestDatabase; Integrated Securit31            //or32            //Computed connection33            //var connectionString = @"TestDatabase";34            //LocalIoCContainer.RegisterType(typeof(IDatabaseFactory<>), typeof(DatabaseFactory<>)35            //    , new HierarchicalLifetimeManager()36            //    , new InjectionConstructor(connectionString)37            //    , new InjectionProperty("Logging", logSetup));3839            //Use an nmemory database + 140            LocalIoCContainer.RegisterType(typeof(IDatabaseFactory<>), typeof(TestExampleDatabaseFactory) + 141                , new HierarchicalLifetimeManager() + 142                , new InjectionProperty("Logging", logSetup)); + 143        }4445        [TestCategory("StandardRepository")]46        [TestMethod]47        public void UpdateTestMethod() + 148        { + 149            var repository = LocalIoCContainer.Resolve<ISimpleDataEntityRepository>();50 + 151            var itemToUpdate = repository.Find(2); + 152            itemToUpdate.Name = "Updated Name"; + 153            repository.Update(itemToUpdate, itemToUpdate.Id); + 154            repository.Save();55 + 156            var actual = repository.Find(2);57 + 158            Assert.AreEqual("Updated Name", actual.Name);59 + 160            repository.Dispose(); + 161        }6263        [TestCategory("StandardRepository")]64        [TestMethod]65        public void UpdateTestMethodWithIgnoreFieldFeature() + 166        { + 167            var repository = LocalIoCContainer.Resolve<ISimpleDataEntityRepository>(); + 168            repository.AddUpdateIgnoreField("Name");69 + 170            var itemToUpdate = repository.Find(2); + 171            itemToUpdate.Name = "Updated Name"; + 172            repository.Update(itemToUpdate, itemToUpdate.Id); + 173            repository.Save();74 + 175            var actual = repository.Find(2);76 + 177            Assert.AreNotEqual("Updated Name", actual.Name);78 + 179            repository.Dispose(); + 180        }8182        [TestCategory("StandardRepository")]83        [TestMethod]84        public void UpdateByTestMethod() + 185        { + 186            var repository = LocalIoCContainer.Resolve<ISimpleDataEntityRepository>();87 + 188            var itemToUpdate = repository.Find(2); + 189            itemToUpdate.Name = "Updated Name 2"; + 190            repository.Update(itemToUpdate, x => x.Id == 2); + 191            repository.Save();92 + 193            var actual = repository.Find(2);94 + 195            Assert.AreEqual("Updated Name 2", actual.Name);96 + 197            repository.Dispose(); + 198        }99100        [TestCategory("StandardRepository")]101        [TestMethod]102        [ExpectedException(typeof(ArgumentOutOfRangeException))]103        public void UpdateByTestMethodIncorrectId() + 1104        { + 1105            var repository = LocalIoCContainer.Resolve<ISimpleDataEntityRepository>();106 + 1107            var itemToUpdate = repository.Find(2); + 1108            itemToUpdate.Name = "Updated Name 2"; + 1109            repository.Update(itemToUpdate, x => x.Id == 55); + 0110        }111    }112} -

+
diff --git a/CodeCoverageReport/entityframeworkrepository6tests.dll_TestDbInitializer.htm b/CodeCoverageReport/entityframework.repository6.tests.dll_TestDbInitializer.htm similarity index 95% rename from CodeCoverageReport/entityframeworkrepository6tests.dll_TestDbInitializer.htm rename to CodeCoverageReport/entityframework.repository6.tests.dll_TestDbInitializer.htm index c2a497a..18e4d5f 100644 --- a/CodeCoverageReport/entityframeworkrepository6tests.dll_TestDbInitializer.htm +++ b/CodeCoverageReport/entityframework.repository6.tests.dll_TestDbInitializer.htm @@ -3,7 +3,7 @@ -EntityFrameworkRepository6Tests.TestDbInitializer - Coverage Report +EntityFramework.Repository6.Tests.TestDbInitializer - Coverage Report

Summary

@@ -13,8 +13,8 @@

Summary

-Class:EntityFrameworkRepository6Tests.TestDbInitializer -Assembly:entityframeworkrepository6tests.dll +Class:EntityFramework.Repository6.Tests.TestDbInitializer +Assembly:entityframework.repository6.tests.dll File(s):C:\Development\EntityFrameworkRepository6\EntityFrameworkRepository6Tests\SampleData\TestDbInitializer.cs Covered lines:7 Uncovered lines:0 @@ -44,7 +44,7 @@

 7using System.Text;  8using System.Threading.Tasks;  910namespace EntityFrameworkRepository6Tests10namespace EntityFramework.Repository6.Tests  11{  12    public class TestDbInitializer : DropCreateDatabaseAlways<YourCustomDataContext>  13    { @@ -61,7 +61,7 @@

 24} -

+

Methods/Properties

diff --git a/CodeCoverageReport/entityframeworkrepository6tests.dll_TestExampleDatabaseFactory.htm b/CodeCoverageReport/entityframework.repository6.tests.dll_TestExampleDatabaseFactory.htm similarity index 97% rename from CodeCoverageReport/entityframeworkrepository6tests.dll_TestExampleDatabaseFactory.htm rename to CodeCoverageReport/entityframework.repository6.tests.dll_TestExampleDatabaseFactory.htm index fb737c3..1974c80 100644 --- a/CodeCoverageReport/entityframeworkrepository6tests.dll_TestExampleDatabaseFactory.htm +++ b/CodeCoverageReport/entityframework.repository6.tests.dll_TestExampleDatabaseFactory.htm @@ -3,7 +3,7 @@ -EntityFrameworkRepository6Tests.TestExampleDatabaseFactory - Coverage Report +EntityFramework.Repository6.Tests.TestExampleDatabaseFactory - Coverage Report

Summary

@@ -13,8 +13,8 @@

Summary

-Class:EntityFrameworkRepository6Tests.TestExampleDatabaseFactory -Assembly:entityframeworkrepository6tests.dll +Class:EntityFramework.Repository6.Tests.TestExampleDatabaseFactory +Assembly:entityframework.repository6.tests.dll File(s):C:\Development\EntityFrameworkRepository6\EntityFrameworkRepository6Tests\SampleData\TestExampleDatabaseFactory.cs Covered lines:17 Uncovered lines:0 @@ -45,9 +45,9 @@

 8using PersistentLayer.Entities;  9using PersistentLayer;  10using PersistentLayer.Contexts;11using EntityFrameworkRepository6.Base;11using EntityFramework.Repository6;  1213namespace EntityFrameworkRepository6Tests13namespace EntityFramework.Repository6.Tests  14{  15    public class TestExampleDatabaseFactory : IDatabaseFactory<YourCustomDataContext>  16    { @@ -82,7 +82,7 @@

 45} -

+

Methods/Properties

diff --git a/CodeCoverageReport/index.htm b/CodeCoverageReport/index.htm index 7fd93e3..edb03e3 100644 --- a/CodeCoverageReport/index.htm +++ b/CodeCoverageReport/index.htm @@ -13,16 +13,16 @@

Summary

-Generated on:2/2/2017 - 4:02:32 PM +Generated on:3/3/2017 - 8:40:29 AM Parser:VisualStudioParser Assemblies:8 -Classes:48 +Classes:53 Files:46 -Covered lines:1172 -Uncovered lines:227 -Coverable lines:1399 -Total lines:3815 -Line coverage:83.7% +Covered lines:1445 +Uncovered lines:175 +Coverable lines:1620 +Total lines:4298 +Line coverage:89.1%

Assemblies

@@ -42,10 +42,27 @@

Assemblies

NameCoveredUncoveredCoverableTotalLine coverage -entityframework.auditing.dll2115726868578.7%
  
+entityframework.auditable.repository6.dll1623719966781.4%
  
+EntityFramework.Auditable.Repository6.AuditableBaseContext<TContext>2572428.5%
  
+EntityFramework.Auditable.Repository6.AuditableBaseRepository033310%
 
+EntityFramework.Auditable.Repository6.AuditableBaseRepository<C, T>60631100%
 
+EntityFramework.Repository6.BaseContext<TContext>077230%
 
+EntityFramework.Repository6.BaseRepository1271924163.1%
  
+EntityFramework.Repository6.BaseRepository<C, T>119412324196.7%
  
+EntityFramework.Repository6.DatabaseFactory<C>01111330%
 
+EntityFramework.Repository6.Delta<T>2302343100%
 
+entityframework.auditable.repository6.tests.dll339634579398.2%
  
+EntityFramework.Auditable.Repository6.Tests.RepositoryCreateTests8018116898.7%
  
+EntityFramework.Auditable.Repository6.Tests.RepositoryDeleteTests3203288100%
 
+EntityFramework.Auditable.Repository6.Tests.RepositoryReadTests78078182100%
 
+EntityFramework.Auditable.Repository6.Tests.RepositoryUpdateTests6116214298.3%
  
+EntityFramework.Auditable.Repository6.Tests.TestDbInitializer70724100%
 
+EntityFramework.Auditable.Repository6.Tests.TestExampleDatabaseFactory1701745100%
 
+EntityFramework.Repository6.Tests.DeltaTests6446814494.1%
  
+entityframework.auditing.dll1904923965579.4%
  
EntityFramework.Auditing.AuditableEntity20235100%
 
EntityFramework.Auditing.AuditConfigurationSection6394266.6%
  
-EntityFramework.Auditing.AuditDbContext1783821643082.4%
  
+EntityFramework.Auditing.AuditDbContext1573018740083.9%
  
EntityFramework.Auditing.AuditEntity60655100%
 
EntityFramework.Auditing.AuditTypeInfo70733100%
 
EntityFramework.Auditing.EntityElement66124550%
  
@@ -55,51 +72,39 @@

Assemblies

EntityFramework.Auditing.Test.Context60633100%
 
EntityFramework.Auditing.Test.Customer30327100%
 
EntityFramework.Auditing.Test.CustomerAudit20225100%
 
-entityframeworkauditablerepository6.dll1145817260466.2%
  
-EntityFrameworkAuditableRepository6.Base.BaseContext<TContext>39122925%
  
-EntityFrameworkAuditableRepository6.Base.BaseRepository8122025040%
  
-EntityFrameworkAuditableRepository6.Base.BaseRepository<C, T>812610725075.7%
  
-EntityFrameworkAuditableRepository6.Base.DatabaseFactory<C>01111340%
 
-EntityFrameworkAuditableRepository6.Base.Delta<T>2202241100%
 
-entityframeworkauditablerepository6tests.dll228423256098.2%
  
-EntityFrameworkAuditableRepository6Tests.RepositoryCreateTests6216314098.4%
  
-EntityFrameworkAuditableRepository6Tests.RepositoryReadTests46046116100%
 
-EntityFrameworkAuditableRepository6Tests.RepositoryUpdateTests6016114498.3%
  
-EntityFrameworkAuditableRepository6Tests.TestDbInitializer70724100%
 
-EntityFrameworkAuditableRepository6Tests.TestExampleDatabaseFactory1701745100%
 
-EntityFrameworkRepository6Tests.DeltaTests362389194.7%
  
-entityframeworkrepository6.dll1145216657468.6%
  
-EntityFrameworkRepository6.Base.BaseContext<TContext>39122825%
  
-EntityFrameworkRepository6.Base.BaseRepository891723647%
  
-EntityFrameworkRepository6.Base.BaseRepository<C, T>812310423677.8%
  
-EntityFrameworkRepository6.Base.DatabaseFactory<C>01111330%
 
-EntityFrameworkRepository6.Base.Delta<T>2202241100%
 
-entityframeworkrepository6tests.dll214421851998.1%
  
-EntityFrameworkRepository6Tests.DeltaTests362389094.7%
  
-EntityFrameworkRepository6Tests.RepositoryCreateTests6216313798.4%
  
-EntityFrameworkRepository6Tests.RepositoryReadTests46046112100%
 
-EntityFrameworkRepository6Tests.RepositoryUpdateTests4614711197.8%
  
-EntityFrameworkRepository6Tests.TestDbInitializer70724100%
 
-EntityFrameworkRepository6Tests.TestExampleDatabaseFactory1701745100%
 
-persistentlayer.dll1582314165.2%
  
+entityframework.repository6.dll1562718358185.2%
  
+EntityFramework.Repository6.BaseContext<TContext>2572328.5%
  
+EntityFramework.Repository6.BaseRepository1271924163.1%
  
+EntityFramework.Repository6.BaseRepository<C, T>119412324196.7%
  
+EntityFramework.Repository6.DatabaseFactory<C>01111330%
 
+EntityFramework.Repository6.Delta<T>2302343100%
 
+entityframework.repository6.tests.dll308431272298.7%
  
+EntityFramework.Repository6.Tests.DeltaTests4825011196%
  
+EntityFramework.Repository6.Tests.RepositoryCreateTests8018116598.7%
  
+EntityFramework.Repository6.Tests.RepositoryDeleteTests3203287100%
 
+EntityFramework.Repository6.Tests.RepositoryReadTests78078178100%
 
+EntityFramework.Repository6.Tests.RepositoryUpdateTests4614711297.8%
  
+EntityFramework.Repository6.Tests.TestDbInitializer70724100%
 
+EntityFramework.Repository6.Tests.TestExampleDatabaseFactory1701745100%
 
+persistentlayer.auditable.dll2092916968.9%
  
+PersistentLayer.Auditable.Contexts.YourCustomDataContext4153080%
  
+PersistentLayer.Auditable.Entities.PersistentEntity011130%
 
+PersistentLayer.Auditable.Entities.SimpleCompositeKeyEntity20220100%
 
+PersistentLayer.Auditable.Entities.SimpleDataEntity20213100%
 
+PersistentLayer.Auditable.Entities.SimpleDataEntityAudit30316100%
 
+PersistentLayer.Auditable.Initializers.MyDbInitializer077240%
 
+PersistentLayer.Auditable.Repositories.SimpleCompositeKeyEntityRepository30326100%
 
+PersistentLayer.Auditable.Repositories.SimpleDataEntityRepository60627100%
 
+persistentlayer.dll1382114361.9%
  
PersistentLayer.Contexts.YourCustomDataContext3142975%
  
PersistentLayer.Entities.PersistentEntity10113100%
 
PersistentLayer.Entities.SimpleCompositeKeyEntity20220100%
 
PersistentLayer.Entities.SimpleDataEntity1017100%
 
PersistentLayer.Initializers.MyDbInitializer077240%
 
-PersistentLayer.Repositories.SimpleCompositeKeyEntityRepository40424100%
 
-PersistentLayer.Repositories.SimpleDataEntityRepository40424100%
 
-persistentlayerauditable.dll1992816467.8%
  
-PersistentLayerAuditable.Contexts.YourCustomDataContext4153080%
  
-PersistentLayerAuditable.Entities.PersistentEntity011130%
 
-PersistentLayerAuditable.Entities.SimpleCompositeKeyEntity20220100%
 
-PersistentLayerAuditable.Entities.SimpleDataEntity20213100%
 
-PersistentLayerAuditable.Entities.SimpleDataEntityAudit30316100%
 
-PersistentLayerAuditable.Initializers.MyDbInitializer077240%
 
-PersistentLayerAuditable.Repositories.SimpleCompositeKeyEntityRepository40424100%
 
-PersistentLayerAuditable.Repositories.SimpleDataEntityRepository40424100%
 
+PersistentLayer.Repositories.SimpleCompositeKeyEntityRepository30325100%
 
+PersistentLayer.Repositories.SimpleDataEntityRepository30325100%
 
-
+
\ No newline at end of file diff --git a/CodeCoverageReport/persistentlayerauditable.dll_MyDbInitializer.htm b/CodeCoverageReport/persistentlayer.auditable.dll_MyDbInitializer.htm similarity index 91% rename from CodeCoverageReport/persistentlayerauditable.dll_MyDbInitializer.htm rename to CodeCoverageReport/persistentlayer.auditable.dll_MyDbInitializer.htm index c8b3240..8a4b27c 100644 --- a/CodeCoverageReport/persistentlayerauditable.dll_MyDbInitializer.htm +++ b/CodeCoverageReport/persistentlayer.auditable.dll_MyDbInitializer.htm @@ -3,7 +3,7 @@ -PersistentLayerAuditable.Initializers.MyDbInitializer - Coverage Report +PersistentLayer.Auditable.Initializers.MyDbInitializer - Coverage Report

Summary

@@ -13,8 +13,8 @@

Summary

-Class:PersistentLayerAuditable.Initializers.MyDbInitializer -Assembly:persistentlayerauditable.dll +Class:PersistentLayer.Auditable.Initializers.MyDbInitializer +Assembly:persistentlayer.auditable.dll File(s):C:\Development\EntityFrameworkRepository6\PersistentLayerAuditable\Initializers\MyDbInitializer.cs Covered lines:0 Uncovered lines:7 @@ -27,7 +27,7 @@

Metrics

- +
MethodBlocks covered  Blocks not covered  
Seed(PersistentLayerAuditable.Contexts.YourCustomDataContext)010
Seed(PersistentLayer.Auditable.Contexts.YourCustomDataContext)010

File(s)

@@ -35,8 +35,8 @@

#LineLine coverage - 1using PersistentLayerAuditable.Contexts;2using PersistentLayerAuditable.Entities;1using PersistentLayer.Auditable.Contexts;2using PersistentLayer.Auditable.Entities;  3using System;  4using System.Collections.Generic;  5using System.Data.Entity; @@ -44,7 +44,7 @@

 7using System.Text;  8using System.Threading.Tasks;  910namespace PersistentLayerAuditable.Initializers10namespace PersistentLayer.Auditable.Initializers  11{  12    public class MyDbInitializer : DropCreateDatabaseIfModelChanges<YourCustomDataContext>  13    { @@ -61,11 +61,11 @@

 24} -

+
diff --git a/CodeCoverageReport/persistentlayerauditable.dll_PersistentEntity.htm b/CodeCoverageReport/persistentlayer.auditable.dll_PersistentEntity.htm similarity index 93% rename from CodeCoverageReport/persistentlayerauditable.dll_PersistentEntity.htm rename to CodeCoverageReport/persistentlayer.auditable.dll_PersistentEntity.htm index 182783b..e4df842 100644 --- a/CodeCoverageReport/persistentlayerauditable.dll_PersistentEntity.htm +++ b/CodeCoverageReport/persistentlayer.auditable.dll_PersistentEntity.htm @@ -3,7 +3,7 @@ -PersistentLayerAuditable.Entities.PersistentEntity - Coverage Report +PersistentLayer.Auditable.Entities.PersistentEntity - Coverage Report

Summary

@@ -13,8 +13,8 @@

Summary

-Class:PersistentLayerAuditable.Entities.PersistentEntity -Assembly:persistentlayerauditable.dll +Class:PersistentLayer.Auditable.Entities.PersistentEntity +Assembly:persistentlayer.auditable.dll File(s):C:\Development\EntityFrameworkRepository6\PersistentLayerAuditable\Entities\PersistentEntity.cs Covered lines:0 Uncovered lines:1 @@ -34,7 +34,7 @@

 4using System.Text;  5using System.Threading.Tasks;  67namespace PersistentLayerAuditable.Entities7namespace PersistentLayer.Auditable.Entities  8{  9    public abstract class PersistentEntity  10    { @@ -43,7 +43,7 @@

 13} -

+

Methods/Properties

diff --git a/CodeCoverageReport/persistentlayerauditable.dll_SimpleCompositeKeyEntity.htm b/CodeCoverageReport/persistentlayer.auditable.dll_SimpleCompositeKeyEntity.htm similarity index 95% rename from CodeCoverageReport/persistentlayerauditable.dll_SimpleCompositeKeyEntity.htm rename to CodeCoverageReport/persistentlayer.auditable.dll_SimpleCompositeKeyEntity.htm index 221d55d..2231646 100644 --- a/CodeCoverageReport/persistentlayerauditable.dll_SimpleCompositeKeyEntity.htm +++ b/CodeCoverageReport/persistentlayer.auditable.dll_SimpleCompositeKeyEntity.htm @@ -3,7 +3,7 @@ -PersistentLayerAuditable.Entities.SimpleCompositeKeyEntity - Coverage Report +PersistentLayer.Auditable.Entities.SimpleCompositeKeyEntity - Coverage Report

Summary

@@ -13,8 +13,8 @@

Summary

-Class:PersistentLayerAuditable.Entities.SimpleCompositeKeyEntity -Assembly:persistentlayerauditable.dll +Class:PersistentLayer.Auditable.Entities.SimpleCompositeKeyEntity +Assembly:persistentlayer.auditable.dll File(s):C:\Development\EntityFrameworkRepository6\PersistentLayerAuditable\Entities\SimpleCompositeKeyEntity.cs Covered lines:2 Uncovered lines:0 @@ -36,7 +36,7 @@

 6using System.Text;  7using System.Threading.Tasks;  89namespace PersistentLayerAuditable.Entities9namespace PersistentLayer.Auditable.Entities  10{  11    public class SimpleCompositeKeyEntity  12    { @@ -50,7 +50,7 @@

 20} -

+

Methods/Properties

diff --git a/CodeCoverageReport/persistentlayerauditable.dll_SimpleCompositeKeyEntityRepository.htm b/CodeCoverageReport/persistentlayer.auditable.dll_SimpleCompositeKeyEntityRepository.htm similarity index 71% rename from CodeCoverageReport/persistentlayerauditable.dll_SimpleCompositeKeyEntityRepository.htm rename to CodeCoverageReport/persistentlayer.auditable.dll_SimpleCompositeKeyEntityRepository.htm index 01e8bd9..9aa8244 100644 --- a/CodeCoverageReport/persistentlayerauditable.dll_SimpleCompositeKeyEntityRepository.htm +++ b/CodeCoverageReport/persistentlayer.auditable.dll_SimpleCompositeKeyEntityRepository.htm @@ -3,7 +3,7 @@ -PersistentLayerAuditable.Repositories.SimpleCompositeKeyEntityRepository - Coverage Report +PersistentLayer.Auditable.Repositories.SimpleCompositeKeyEntityRepository - Coverage Report

Summary

@@ -13,13 +13,13 @@

Summary

-Class:PersistentLayerAuditable.Repositories.SimpleCompositeKeyEntityRepository -Assembly:persistentlayerauditable.dll +Class:PersistentLayer.Auditable.Repositories.SimpleCompositeKeyEntityRepository +Assembly:persistentlayer.auditable.dll File(s):C:\Development\EntityFrameworkRepository6\PersistentLayerAuditable\Repositories\SimpleCompositeKeyEntityRepository.cs -Covered lines:4 +Covered lines:3 Uncovered lines:0 -Coverable lines:4 -Total lines:24 +Coverable lines:3 +Total lines:26 Line coverage:100% @@ -27,7 +27,7 @@

Metrics

- +
MethodBlocks covered  Blocks not covered  
SimpleCompositeKeyEntityRepository(EntityFrameworkAuditableRepository6.Base.IDatabaseFactory<PersistentLayerAuditable.Contexts.YourCustomDataContext>)40
SimpleCompositeKeyEntityRepository(EntityFramework.Repository6.IDatabaseFactory<PersistentLayer.Auditable.Contexts.YourCustomDataContext>)30

File(s)

@@ -35,37 +35,39 @@

#LineLine coverage - 1using EntityFrameworkAuditableRepository6.Base;2using PersistentLayerAuditable.Contexts;3using PersistentLayerAuditable.Entities;4using System;5using System.Collections.Generic;6using System.Linq;7using System.Text;8using System.Threading.Tasks;910namespace PersistentLayerAuditable.Repositories11{12    public interface ISimpleCompositeKeyEntityRepository : IBaseRepository<YourCustomDataContext, SimpleCompositeKeyEnti13    {1415    }1using EntityFramework.Auditable.Repository6;2using EntityFramework.Repository6;3using EntityFramework.Repository6.Interfaces;4using PersistentLayer.Auditable.Contexts;5using PersistentLayer.Auditable.Entities;6using System;7using System.Collections.Generic;8using System.Linq;9using System.Text;10using System.Threading.Tasks;1112namespace PersistentLayer.Auditable.Repositories13{14    public interface ISimpleCompositeKeyEntityRepository : IBaseRepository<YourCustomDataContext, SimpleCompositeKeyEnti15    {  1617    public class SimpleCompositeKeyEntityRepository : BaseRepository<YourCustomDataContext, SimpleCompositeKeyEntity>, I18    { - 119        public SimpleCompositeKeyEntityRepository(IDatabaseFactory<YourCustomDataContext> dbFactory) - 120        { - 121            Context = dbFactory.GetNewDbContext(); - 122        }23    }24}17    }1819    public class SimpleCompositeKeyEntityRepository : AuditableBaseRepository<YourCustomDataContext, SimpleCompositeKeyE20    { + 121        public SimpleCompositeKeyEntityRepository(IDatabaseFactory<YourCustomDataContext> dbFactory) : base(dbFactory.Ge + 122        {23 + 124        }25    }26} -

+
diff --git a/CodeCoverageReport/persistentlayerauditable.dll_SimpleDataEntity.htm b/CodeCoverageReport/persistentlayer.auditable.dll_SimpleDataEntity.htm similarity index 93% rename from CodeCoverageReport/persistentlayerauditable.dll_SimpleDataEntity.htm rename to CodeCoverageReport/persistentlayer.auditable.dll_SimpleDataEntity.htm index e6bcace..6eac697 100644 --- a/CodeCoverageReport/persistentlayerauditable.dll_SimpleDataEntity.htm +++ b/CodeCoverageReport/persistentlayer.auditable.dll_SimpleDataEntity.htm @@ -3,7 +3,7 @@ -PersistentLayerAuditable.Entities.SimpleDataEntity - Coverage Report +PersistentLayer.Auditable.Entities.SimpleDataEntity - Coverage Report

Summary

@@ -13,8 +13,8 @@

Summary

-Class:PersistentLayerAuditable.Entities.SimpleDataEntity -Assembly:persistentlayerauditable.dll +Class:PersistentLayer.Auditable.Entities.SimpleDataEntity +Assembly:persistentlayer.auditable.dll File(s):C:\Development\EntityFrameworkRepository6\PersistentLayerAuditable\Entities\SimpleDataEntity.cs Covered lines:2 Uncovered lines:0 @@ -32,7 +32,7 @@

 2using System.ComponentModel.DataAnnotations;  3using System.ComponentModel.DataAnnotations.Schema;  45namespace PersistentLayerAuditable.Entities5namespace PersistentLayer.Auditable.Entities  6{  7    public class SimpleDataEntity : AuditableEntity  8    { @@ -43,7 +43,7 @@

 13} -

+

Methods/Properties

diff --git a/CodeCoverageReport/persistentlayerauditable.dll_SimpleDataEntityAudit.htm b/CodeCoverageReport/persistentlayer.auditable.dll_SimpleDataEntityAudit.htm similarity index 94% rename from CodeCoverageReport/persistentlayerauditable.dll_SimpleDataEntityAudit.htm rename to CodeCoverageReport/persistentlayer.auditable.dll_SimpleDataEntityAudit.htm index 1165044..0859fa3 100644 --- a/CodeCoverageReport/persistentlayerauditable.dll_SimpleDataEntityAudit.htm +++ b/CodeCoverageReport/persistentlayer.auditable.dll_SimpleDataEntityAudit.htm @@ -3,7 +3,7 @@ -PersistentLayerAuditable.Entities.SimpleDataEntityAudit - Coverage Report +PersistentLayer.Auditable.Entities.SimpleDataEntityAudit - Coverage Report

Summary

@@ -13,8 +13,8 @@

Summary

-Class:PersistentLayerAuditable.Entities.SimpleDataEntityAudit -Assembly:persistentlayerauditable.dll +Class:PersistentLayer.Auditable.Entities.SimpleDataEntityAudit +Assembly:persistentlayer.auditable.dll File(s):C:\Development\EntityFrameworkRepository6\PersistentLayerAuditable\Entities\SimpleDataAuditEntity.cs Covered lines:3 Uncovered lines:0 @@ -32,7 +32,7 @@

 2using System.ComponentModel.DataAnnotations;  3using System.ComponentModel.DataAnnotations.Schema;  45namespace PersistentLayerAuditable.Entities5namespace PersistentLayer.Auditable.Entities  6{  7    public class SimpleDataEntityAudit : AuditEntity  8    { @@ -46,7 +46,7 @@

 16} -

+

Methods/Properties

diff --git a/CodeCoverageReport/persistentlayerauditable.dll_SimpleDataEntityRepository.htm b/CodeCoverageReport/persistentlayer.auditable.dll_SimpleDataEntityRepository.htm similarity index 63% rename from CodeCoverageReport/persistentlayerauditable.dll_SimpleDataEntityRepository.htm rename to CodeCoverageReport/persistentlayer.auditable.dll_SimpleDataEntityRepository.htm index 5b631ed..c655d1b 100644 --- a/CodeCoverageReport/persistentlayerauditable.dll_SimpleDataEntityRepository.htm +++ b/CodeCoverageReport/persistentlayer.auditable.dll_SimpleDataEntityRepository.htm @@ -3,7 +3,7 @@ -PersistentLayerAuditable.Repositories.SimpleDataEntityRepository - Coverage Report +PersistentLayer.Auditable.Repositories.SimpleDataEntityRepository - Coverage Report

Summary

@@ -13,13 +13,13 @@

Summary

-Class:PersistentLayerAuditable.Repositories.SimpleDataEntityRepository -Assembly:persistentlayerauditable.dll +Class:PersistentLayer.Auditable.Repositories.SimpleDataEntityRepository +Assembly:persistentlayer.auditable.dll File(s):C:\Development\EntityFrameworkRepository6\PersistentLayerAuditable\Repositories\SimpleDataEntityRepository.cs -Covered lines:4 +Covered lines:6 Uncovered lines:0 -Coverable lines:4 -Total lines:24 +Coverable lines:6 +Total lines:27 Line coverage:100% @@ -27,7 +27,8 @@

Metrics

- + +
MethodBlocks covered  Blocks not covered  
SimpleDataEntityRepository(EntityFrameworkAuditableRepository6.Base.IDatabaseFactory<PersistentLayerAuditable.Contexts.YourCustomDataContext>)40
SimpleDataEntityRepository(EntityFramework.Repository6.IDatabaseFactory<PersistentLayer.Auditable.Contexts.YourCustomDataContext>)30
GetExistingContext()30

File(s)

@@ -35,37 +36,41 @@

#LineLine coverage - 1using EntityFrameworkAuditableRepository6.Base;2using PersistentLayerAuditable.Contexts;3using PersistentLayerAuditable.Entities;4using System;5using System.Collections.Generic;6using System.Data.Entity;7using System.Linq;8using System.Text;9using System.Threading.Tasks;1011namespace PersistentLayerAuditable.Repositories12{13    public interface ISimpleDataEntityRepository : IBaseRepository<YourCustomDataContext, SimpleDataEntity>14    {15    }1617    public class SimpleDataEntityRepository : BaseRepository<YourCustomDataContext, SimpleDataEntity>, ISimpleDataEntity18    { - 119        public SimpleDataEntityRepository(IDatabaseFactory<YourCustomDataContext> dbFactory) - 120        { - 121            Context = dbFactory.GetNewDbContext(); - 122        }23    }24}1using System;2using PersistentLayer.Auditable.Contexts;3using PersistentLayer.Auditable.Entities;4using EntityFramework.Repository6.Interfaces;5using EntityFramework.Auditable.Repository6;6using EntityFramework.Repository6;78namespace PersistentLayer.Auditable.Repositories9{10    public interface ISimpleDataEntityRepository : IBaseRepository<YourCustomDataContext, SimpleDataEntity>, IAuditSaveF11    {12        YourCustomDataContext GetExistingContext();13    }1415    public class SimpleDataEntityRepository : AuditableBaseRepository<YourCustomDataContext, SimpleDataEntity>, ISimpleD16    { + 117        public SimpleDataEntityRepository(IDatabaseFactory<YourCustomDataContext> dbFactory) : base( dbFactory.GetNewDbC + 118        {19 + 120        }2122        public YourCustomDataContext GetExistingContext() + 123        { + 124            return Context; + 125        }26    }27} -

+
diff --git a/CodeCoverageReport/persistentlayerauditable.dll_YourCustomDataContext.htm b/CodeCoverageReport/persistentlayer.auditable.dll_YourCustomDataContext.htm similarity index 90% rename from CodeCoverageReport/persistentlayerauditable.dll_YourCustomDataContext.htm rename to CodeCoverageReport/persistentlayer.auditable.dll_YourCustomDataContext.htm index e57db08..902c6d6 100644 --- a/CodeCoverageReport/persistentlayerauditable.dll_YourCustomDataContext.htm +++ b/CodeCoverageReport/persistentlayer.auditable.dll_YourCustomDataContext.htm @@ -3,7 +3,7 @@ -PersistentLayerAuditable.Contexts.YourCustomDataContext - Coverage Report +PersistentLayer.Auditable.Contexts.YourCustomDataContext - Coverage Report

Summary

@@ -13,8 +13,8 @@

Summary

-Class:PersistentLayerAuditable.Contexts.YourCustomDataContext -Assembly:persistentlayerauditable.dll +Class:PersistentLayer.Auditable.Contexts.YourCustomDataContext +Assembly:persistentlayer.auditable.dll File(s):C:\Development\EntityFrameworkRepository6\PersistentLayerAuditable\Contexts\YourCustomDataContext.cs Covered lines:4 Uncovered lines:1 @@ -36,7 +36,7 @@

#LineLine coverage - 1using PersistentLayerAuditable.Entities;1using PersistentLayer.Auditable.Entities;  2using System;  3using System.Collections.Generic;  4using System.Data.Entity; @@ -45,12 +45,12 @@

 7using System.Threading.Tasks;  8using System.Data.Common;  9using System.Data.Entity.ModelConfiguration.Conventions;10using PersistentLayerAuditable.Initializers;11using EntityFrameworkAuditableRepository6.Base;10using PersistentLayer.Auditable.Initializers;11using EntityFramework.Auditable.Repository6;  1213namespace PersistentLayerAuditable.Contexts13namespace PersistentLayer.Auditable.Contexts  14{15    public class YourCustomDataContext : BaseContext<YourCustomDataContext>15    public class YourCustomDataContext : AuditableBaseContext<YourCustomDataContext>  16    {  117        public DbSet<SimpleDataEntity> SimpleDataEntities { get; set; }  118        public DbSet<SimpleCompositeKeyEntity> SimpleCompositeKeyEntities { get; set; } @@ -68,16 +68,16 @@

 30} -

+
+

Methods/Properties

diff --git a/CodeCoverageReport/persistentlayer.dll_PersistentEntity.htm b/CodeCoverageReport/persistentlayer.dll_PersistentEntity.htm index c4ed6ad..a61f546 100644 --- a/CodeCoverageReport/persistentlayer.dll_PersistentEntity.htm +++ b/CodeCoverageReport/persistentlayer.dll_PersistentEntity.htm @@ -43,7 +43,7 @@

 13} -

+

Methods/Properties

diff --git a/CodeCoverageReport/persistentlayer.dll_SimpleCompositeKeyEntity.htm b/CodeCoverageReport/persistentlayer.dll_SimpleCompositeKeyEntity.htm index 247cc1a..552321a 100644 --- a/CodeCoverageReport/persistentlayer.dll_SimpleCompositeKeyEntity.htm +++ b/CodeCoverageReport/persistentlayer.dll_SimpleCompositeKeyEntity.htm @@ -50,7 +50,7 @@

 20} -

+

Methods/Properties

diff --git a/CodeCoverageReport/persistentlayer.dll_SimpleCompositeKeyEntityRepository.htm b/CodeCoverageReport/persistentlayer.dll_SimpleCompositeKeyEntityRepository.htm index 4d39a91..931b2c1 100644 --- a/CodeCoverageReport/persistentlayer.dll_SimpleCompositeKeyEntityRepository.htm +++ b/CodeCoverageReport/persistentlayer.dll_SimpleCompositeKeyEntityRepository.htm @@ -16,10 +16,10 @@

Summary

Class:PersistentLayer.Repositories.SimpleCompositeKeyEntityRepository Assembly:persistentlayer.dll File(s):C:\Development\EntityFrameworkRepository6\PersistentLayer\Repositories\SimpleCompositeKeyEntityRepository.cs -Covered lines:4 +Covered lines:3 Uncovered lines:0 -Coverable lines:4 -Total lines:24 +Coverable lines:3 +Total lines:25 Line coverage:100% @@ -27,7 +27,7 @@

Metrics

- +
MethodBlocks covered  Blocks not covered  
SimpleCompositeKeyEntityRepository(EntityFrameworkRepository6.Base.IDatabaseFactory<PersistentLayer.Contexts.YourCustomDataContext>)40
SimpleCompositeKeyEntityRepository(EntityFramework.Repository6.IDatabaseFactory<PersistentLayer.Contexts.YourCustomDataContext>)30

File(s)

@@ -35,37 +35,38 @@

#LineLine coverage - 1using EntityFrameworkRepository6.Base;2using PersistentLayer.Contexts;3using PersistentLayer.Entities;4using System;5using System.Collections.Generic;6using System.Linq;7using System.Text;8using System.Threading.Tasks;910namespace PersistentLayer.Repositories11{12    public interface ISimpleCompositeKeyEntityRepository : IBaseRepository<YourCustomDataContext, SimpleCompositeKeyEnti13    {1415    }1617    public class SimpleCompositeKeyEntityRepository : BaseRepository<YourCustomDataContext, SimpleCompositeKeyEntity>, I18    { - 119        public SimpleCompositeKeyEntityRepository(IDatabaseFactory<YourCustomDataContext> dbFactory) - 120        { - 121            Context = dbFactory.GetNewDbContext(); - 122        }23    }24}1using EntityFramework.Repository6;2using EntityFramework.Repository6.Interfaces;3using PersistentLayer.Contexts;4using PersistentLayer.Entities;5using System;6using System.Collections.Generic;7using System.Linq;8using System.Text;9using System.Threading.Tasks;1011namespace PersistentLayer.Repositories12{13    public interface ISimpleCompositeKeyEntityRepository : IBaseRepository<YourCustomDataContext, SimpleCompositeKeyEnti14    {1516    }1718    public class SimpleCompositeKeyEntityRepository : BaseRepository<YourCustomDataContext, SimpleCompositeKeyEntity>, I19    { + 120        public SimpleCompositeKeyEntityRepository(IDatabaseFactory<YourCustomDataContext> dbFactory) : base(dbFactory.Ge + 121        {22 + 123        }24    }25} -

+
diff --git a/CodeCoverageReport/persistentlayer.dll_SimpleDataEntity.htm b/CodeCoverageReport/persistentlayer.dll_SimpleDataEntity.htm index 2e5b819..9abc37f 100644 --- a/CodeCoverageReport/persistentlayer.dll_SimpleDataEntity.htm +++ b/CodeCoverageReport/persistentlayer.dll_SimpleDataEntity.htm @@ -37,7 +37,7 @@

 7} -

+

Methods/Properties

diff --git a/CodeCoverageReport/persistentlayer.dll_SimpleDataEntityRepository.htm b/CodeCoverageReport/persistentlayer.dll_SimpleDataEntityRepository.htm index 01416ab..0695936 100644 --- a/CodeCoverageReport/persistentlayer.dll_SimpleDataEntityRepository.htm +++ b/CodeCoverageReport/persistentlayer.dll_SimpleDataEntityRepository.htm @@ -16,10 +16,10 @@

Summary

Class:PersistentLayer.Repositories.SimpleDataEntityRepository Assembly:persistentlayer.dll File(s):C:\Development\EntityFrameworkRepository6\PersistentLayer\Repositories\SimpleDataEntityRepository.cs -Covered lines:4 +Covered lines:3 Uncovered lines:0 -Coverable lines:4 -Total lines:24 +Coverable lines:3 +Total lines:25 Line coverage:100% @@ -27,7 +27,7 @@

Metrics

- +
MethodBlocks covered  Blocks not covered  
SimpleDataEntityRepository(EntityFrameworkRepository6.Base.IDatabaseFactory<PersistentLayer.Contexts.YourCustomDataContext>)40
SimpleDataEntityRepository(EntityFramework.Repository6.IDatabaseFactory<PersistentLayer.Contexts.YourCustomDataContext>)30

File(s)

@@ -35,37 +35,38 @@

#LineLine coverage - 1using EntityFrameworkRepository6.Base;2using PersistentLayer.Contexts;3using PersistentLayer.Entities;4using System;5using System.Collections.Generic;6using System.Data.Entity;7using System.Linq;8using System.Text;9using System.Threading.Tasks;1011namespace PersistentLayer.Repositories12{13    public interface ISimpleDataEntityRepository : IBaseRepository<YourCustomDataContext, SimpleDataEntity>14    {15    }1617    public class SimpleDataEntityRepository : BaseRepository<YourCustomDataContext, SimpleDataEntity>, ISimpleDataEntity18    { - 119        public SimpleDataEntityRepository(IDatabaseFactory<YourCustomDataContext> dbFactory) - 120        { - 121            Context = dbFactory.GetNewDbContext(); - 122        }23    }24}1using EntityFramework.Repository6;2using EntityFramework.Repository6.Interfaces;3using PersistentLayer.Contexts;4using PersistentLayer.Entities;5using System;6using System.Collections.Generic;7using System.Data.Entity;8using System.Linq;9using System.Text;10using System.Threading.Tasks;1112namespace PersistentLayer.Repositories13{14    public interface ISimpleDataEntityRepository : IBaseRepository<YourCustomDataContext, SimpleDataEntity>15    {16    }1718    public class SimpleDataEntityRepository : BaseRepository<YourCustomDataContext, SimpleDataEntity>, ISimpleDataEntity19    { + 120        public SimpleDataEntityRepository(IDatabaseFactory<YourCustomDataContext> dbFactory) : base(dbFactory.GetNewDbCo + 121        {22 + 123        }24    }25} -

+
diff --git a/CodeCoverageReport/persistentlayer.dll_YourCustomDataContext.htm b/CodeCoverageReport/persistentlayer.dll_YourCustomDataContext.htm index 27e1ddd..3c1592b 100644 --- a/CodeCoverageReport/persistentlayer.dll_YourCustomDataContext.htm +++ b/CodeCoverageReport/persistentlayer.dll_YourCustomDataContext.htm @@ -46,7 +46,7 @@

 8using System.Data.Common;  9using System.Data.Entity.ModelConfiguration.Conventions;  10using PersistentLayer.Initializers;11using EntityFrameworkRepository6.Base;11using EntityFramework.Repository6;  12  13namespace PersistentLayer.Contexts  14{ @@ -67,7 +67,7 @@

 29} -

+

Methods/Properties

diff --git a/badge_linecoverage.svg b/badge_linecoverage.svg index 5512b3c..add85dc 100644 --- a/badge_linecoverage.svg +++ b/badge_linecoverage.svg @@ -71,13 +71,13 @@ - Generated by: ReportGenerator 2.5.2.0 + Generated by: ReportGenerator 2.5.5.0 Coverage Coverage - 83.7%83.7% + 89.1%89.1%