unit testing - Assert that a method was called with an object that is changed in the method -
thats method want test:
public void set1(viewmodela viewmodela) { var viewmodelb = new viewmodelb { firstname = viewmodela.firstname, lastname = viewmodelb.lastname } service.set2(viewmodelb); }
how can assert viewmodelb instance passed service.set2 has property values mapped viewmodela , set2 took viewmodelb parameter?
assuming you've mocked service
instance, should able this:
service.assertwascalled(s => s.set2( arg<viewmodelb>.matches(b => b.firstname == "thefirstname" && b.lastname == "thelastname" ) ));
essentially you're doing asserting set2
method called, , given viewmodelb
instance first , last name match you're expecting.
Comments
Post a Comment