File tree Expand file tree Collapse file tree 4 files changed +15
-4
lines changed
UnitTestingUsingNUnitWithMoq Expand file tree Collapse file tree 4 files changed +15
-4
lines changed Original file line number Diff line number Diff line change @@ -4,10 +4,11 @@ namespace UnitTestingUsingNUnitWithMoq
4
4
{
5
5
public class CreditDecision
6
6
{
7
- readonly CreditDecisionService creditDecisionService ;
7
+ readonly ICreditDecisionService creditDecisionService ;
8
8
9
- // We have made this loosely coupled but can not inject Moq instance instead of CreditDecisionService
10
- public CreditDecision ( CreditDecisionService creditDecisionService )
9
+ // This assumes that there is an existing ICreditDecisionService interface
10
+ // and that CreditDecisionService implements it.
11
+ public CreditDecision ( ICreditDecisionService creditDecisionService )
11
12
{
12
13
this . creditDecisionService = creditDecisionService ;
13
14
}
Original file line number Diff line number Diff line change 2
2
3
3
namespace UnitTestingUsingNUnitWithMoq
4
4
{
5
- public class CreditDecisionService
5
+ public class CreditDecisionService : ICreditDecisionService
6
6
{
7
7
public CreditDecisionService ( )
8
8
{
Original file line number Diff line number Diff line change
1
+ using System ;
2
+
3
+ namespace UnitTestingUsingNUnitWithMoq
4
+ {
5
+ public interface ICreditDecisionService
6
+ {
7
+ string GetCreditDecision ( int creditScore ) ;
8
+ }
9
+ }
Original file line number Diff line number Diff line change 45
45
<ItemGroup >
46
46
<Compile Include =" CreditDecision.cs" />
47
47
<Compile Include =" CreditDecisionService.cs" />
48
+ <Compile Include =" ICreditDecisionService.cs" />
48
49
<Compile Include =" Program.cs" />
49
50
<Compile Include =" Properties\AssemblyInfo.cs" />
50
51
</ItemGroup >
You can’t perform that action at this time.
0 commit comments