Last post Jan 21, 2009 03:25 AM by Shengqing Yang - MSFT
Jan 19, 2009 12:28 PM|azamsharp|LINK
I am having trouble assigning values to the properties defined in the mock objects.
Public Interface IAddCustomerView
Property FirstName() As String
Property LastName() As String
Property Message() As String
My unit test below always fails saying that getMessage was never called:
Public Sub Should_Display_A_Success_Message()
_presenter = New AddCustomerPresenter(_view, _repositoryStub)
_view.AssertWasCalled(Function(x) x.Message = "Customer has been added successfully")
Dim customer As New Customer()
_view.FirstName = "Mohammad"
_view.LastName = "Azam"
customer.FirstName = _view.FirstName
customer.LastName = _view.LastName
Dim isInserted As Boolean = _repository.AddCustomer(customer)
If isInserted Then
_view.Message = "Customer has been added successfully"
_view.Message = "Customer has not been added"
The Message properties always return "Nothing". What is that??
Jan 21, 2009 03:25 AM|Shengqing Yang - MSFT|LINK
I haven't found the getMessage function you said in the code above. And the only reason _view.Message always returns empty I can imagine is the if statements is never fired. Have you tried to set a pointbreak at line 'Dim isInserted As Boolean = _repository.AddCustomer(customer)'
to see what happens there? Probably some logical mistake in AddCustomer method.