コード例 #1
0
                public void HelperSetupTest()
                {
                    SetupOperationStub <string>(value => "test");
                    SetupOperationStub <int>(value => "25");

                    var operationUser = new OperationUser(m_OperationStub.Object);

                    var intOperationResult    = operationUser.DoOperation(9);
                    var stringOperationResult = operationUser.DoOperation("Hello");

                    Assert.Equal("25", intOperationResult);
                    Assert.Equal("test", stringOperationResult);
                }
コード例 #2
0
                public void InlineSetupTest()
                {
                    m_OperationStub.Setup(m => m.Operation(It.IsAny <string>())).Returns <string>(value => "test");
                    m_OperationStub.Setup(m => m.Operation(It.IsAny <int>())).Returns <int>(value => "25");

                    var operationUser = new OperationUser(m_OperationStub.Object);

                    var intOperationResult    = operationUser.DoOperation(9);
                    var stringOperationResult = operationUser.DoOperation("Hello");

                    Assert.Equal("25", intOperationResult);
                    Assert.Equal("test", stringOperationResult);
                }