How can I get functionality similar to Spy++ in my C# app?

I’ve being answering similar questions like this here: How can I detect if a thread has windows handles?. Like it states, the main idea is to enumerate through process windows and their child windows using EnumWindows and EnumChildWindows API calls to get window handles and then call GetWindowText or SendDlgItemMessage with WM_GETTEXT to get window … Read more

Spying on a constructor using Jasmine

flipCounter is just another function, even if it also happens to construct an object. Hence you can do: var cSpy = spyOn(window, ‘flipCounter’); to obtain a spy on it, and do all sorts of inspections on it or say: var cSpy = spyOn(window, ‘flipCounter’).andCallThrough(); var counter = flipCounter(‘foo’, options); expect(cSpy).wasCalled(); However, this seems overkill. It … Read more

Mockito – @Spy vs @Mock

Technically speaking both “mocks” and “spies” are a special kind of “test doubles”. Mockito is unfortunately making the distinction weird. A mock in mockito is a normal mock in other mocking frameworks (allows you to stub invocations; that is, return specific values out of method calls). A spy in mockito is a partial mock in … Read more