File tree Expand file tree Collapse file tree 1 file changed +37
-1
lines changed
tests/Moq.Tests/Regressions Expand file tree Collapse file tree 1 file changed +37
-1
lines changed Original file line number Diff line number Diff line change @@ -2467,7 +2467,43 @@ public void InvokeApplyRule(object obj)
2467
2467
}
2468
2468
2469
2469
#endregion
2470
-
2470
+
2471
+ #region 809
2472
+
2473
+ public class Issue809
2474
+ {
2475
+ [ Fact ]
2476
+ public void Can_use_mocked_object_of_type_with_ctor_args_as_argument_in_setup_expression ( )
2477
+ {
2478
+ var mock1 = new Mock < IProperty > ( ) ;
2479
+ var mock2 = new Mock < IMethod > ( ) ;
2480
+ var ndc = new ClassWithoutDefaultConstructor ( string . Empty ) ;
2481
+
2482
+ mock1 . Setup ( x => x . Value ) . Returns ( ndc ) ;
2483
+ var mockedObject1 = mock1 . Object ;
2484
+ mock2 . Setup ( x => x . Test ( mockedObject1 . Value ) ) ;
2485
+ }
2486
+
2487
+ public class ClassWithoutDefaultConstructor
2488
+ {
2489
+ public ClassWithoutDefaultConstructor ( string dummy )
2490
+ {
2491
+ }
2492
+ }
2493
+
2494
+ public interface IProperty
2495
+ {
2496
+ ClassWithoutDefaultConstructor Value { get ; }
2497
+ }
2498
+
2499
+ public interface IMethod
2500
+ {
2501
+ void Test ( ClassWithoutDefaultConstructor value ) ;
2502
+ }
2503
+ }
2504
+
2505
+ #endregion
2506
+
2471
2507
#region #810
2472
2508
2473
2509
public class _810
You can’t perform that action at this time.
0 commit comments