Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
769 views
in Technique[技术] by (71.8m points)

unit testing - TDD for Windows Store app development without mocks

Has anyone come up with a good TDD setup for Windows Store App development? I'm so used to using mocking frameworks, but this is no-longer an option since dynamic assembly generation is missing in WinRT.

I have seen the alpha MoqRT framework, but I am hoping to avoid something in such experimental stages. I have also been so spoiled with using mock objects that I balk at using the stubs or shims offered as an alternative from Microsoft (Microsoft Fakes).

Have any of you successfully figured out good techniques for doing Windows Store App development using DI and properly-isolated TDD-style unit tests? If so, what have you done?

Edit:

I also notice that the "Add Fakes Assembly" option isn't present in my "Windows Store App" unit test project, so that maybe isn't an option.

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

The approach I'm trying out now is placing the testable code in a regular .NET 4.5 assembly, allowing it to be unit tested with mocks using a normal unit test project. Then, in the Windows Store App project, these same source files are added as links. This is inconvenient since I'm having to duplicate project references between the two platforms, and I have to be careful to ensure the code compiles in both projects, but this approach does allow me to use better unit testing tools.

I'm still eagerly waiting to see if someone comes up with something better.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
...