.NET Unit Test Tooling in 2018
It is 2018, and I have only just learned about the fantastic FluentAssertions framework. Seems like a nice time for a quick review of unit testing tools for .NET. Personal preferences: NUnit, FluentAssertions, Moq.
a Bahá'í, software engineer, and nature lover in Austin, Texas, USA
It is 2018, and I have only just learned about the fantastic FluentAssertions framework. Seems like a nice time for a quick review of unit testing tools for .NET. Personal preferences: NUnit, FluentAssertions, Moq.
There is a positive a trend of developers doing more of their own testing, going beyond unit testing. However, if independent testers are cut out of the loop, then surely many applications will suffer. Case in point: a user unexpectedly entering a decimal temperatures and military time in a citizen science data collection application.
Packer is a cross-platform tool for scripting out virtual machine images. Put another way: use it to create new virtual machines with fully automated and repeatable installations. No clicking around. Some of the benefits:
Recently I installed MongoDb using Chocolatey, and was surprised to notice that the executables weren’t placed into the Chocolately path. Chocolatey uses a shimming process to automatically add executes to PATH. This is really quite nice.
One of my very first technical blog posts was about running OpenSSH on Windows [no longer available] - written over 14 years ago. Recently I was playing around with Microsoft’s port of OpenSSH, which has officially achieved version v1.0.0.0 beta status. Installation was pretty easy, but I ran into a little problem: needing to set “user” group permissions. This little gist has my final script. For reasons of my own I didn’t feel like running the chocolatey install, so I don’t know if it has this permission problem.
The plovers gather in their southern haunts.
The long journey north.
Migration.
Another backyard success: breeding habitat for the Gulf fritillary butterfly. This medium-sized orange butterfly, while less famous than the Monarch for which it is sometimes mistaken, is a beautiful part of our landscape. Like the Monarch, its caterpillars can only eat from one type of plant (“passionflower”) and they have a long-distance migration: across the Gulf of Mexico to southern Florida.
The serious nature of air pollution did not truly hit me until a family wedding in Austin, Texas in the late 90’s. That year the pollution was so severe that older family members were warned by their doctors not to attend. As a kid from the suburbs, I didn’t have to deal with the reality of “bad air” that millions of people in the urban cores breath day in, day out. As a person of faith, I began to awaken to the manifest injustice of suburban commuters contributing more than their fair share to pollution, from the tailpipe and the power plant. What had been a mere academic awareness suddenly turned visceral.
I had just upgraded NuGet packages - a seemingly innocent thing to do.
Everything compiles fine and I tried to run my ASP.NET WebAPI service. Testing
in Postman works fine, but when I try to let the browser call an endpoint (any
endpoint), I get a mysterious 500 server error with a rather unhelpful payload
message of {"message":"An error has occurred."}
. However, even with Chrome
accessing the service, a breakpoint in the endpoint showed me that the code was
executing fine. The problem is clearly occurring inside the ASP.NET engine when
trying to send the response back to the browser.
Chrome sends several headers that Postman does not, so I tried copying those
headers into Postman to see if any of them made the difference. About half of
them required use of the Postman interceptor, and I decided to do some googling
before fiddling with that. Couldn’t turn anything up. I couldn’t even find a way
to trace down the error, although I had a nagging feeling that the compression
header might be related, since it was one of the key headers that Postman
wouldn’t send (Accept-Encoding:gzip, deflate, sdch
).
And that’s when I suddenly remember to look at the Windows Event Viewer. And sure enough, in the Application log I find a pair of error messages:
My hunch was right: something wrong with the compression. Why did this suddenly occur? I have no idea. I hadn’t deleted files out of Temp recently. My NuGet package upgrades were for ancillary libraries, but not for ASP.NET itself. But the solution was trivial: as suggested by Event ID 2264 – IIS W3SVC Configuration, I just had to create the directory manually, and then everything was working again.
The Yellow-rumped Warblers and Dark-eyed Juncos have been back and enjoying our back yard for several weeks now. This year, the warblers have decided to trust our bird bath - we’ve frequently seen them drinking and bathing over the past several weeks. While the Blue Jays have still been coming round, and we’ve had several sightings of Orange-crowned Warbler and Ruby-Crowned Kinglet this fall, I hadn’t seen a Bewick’s Wren in quite some time. Thus I was delighted to see this guy a few days ago. The light isn’t very good, and the window is a bit dirty, but the ID is clear.