Actions are called in silverlight unit test using MOQ

Let's say that I have it

_articlesService.SaveAsync(Model, AddressOf OnSaveCompleted)

OnSaveCompleteMethod does a few things, obviously. His a

Protected Overridable Sub OnSaveCompleted(ByVal asyncValidationResult As AsyncValidationResult)

In my unittest. I need to run makeded SaveAsync and call OnSaveCompleted anyway, because the method sends events that I need to know have been sent.

Right now, the code just passes this method, so it never executed it.

Need help solving this because I'm stuck right now.

+3
source share
2 answers

If I understand your context correctly:

  • You have a class under the test that uses ArticleService
  • ArticleService ( )
  • .
  • , .

, , . , AskService SaveAsync. , , .

. - . , . . , , , .

, , ArticlesService, ArticlesService. CUT , .

, , CUT , , Moq "Raise", "", :

http://code.google.com/p/moq/wiki/QuickStart

: "CallBack", , , OnSaveCompleted. , ; , . , !

+1

, .

ArticleService.

SaveAsync , .

, OnSaveCompleted . ( View Model Base, , viewmodel -.).

- WCF, , , , , .

, , .

, .:)

.

0

Source: https://habr.com/ru/post/1775820/


All Articles