I previously wrote about using MemberData, ClassData in this post. The problem with those are their reliance on IEnumerable<object[]>. This can cause runtime issues even if we don’t get any errors at compile time. In this post I’m going to introduce a strongly typed option in xUnit called TheoryData. So in this post I’m going …
.Net
.NET is a large collection of a bunch of different things really; including compilers, runtimes, programming languages and a bunch of different tools and technologies.
It provides a lot of common functionality that can be tapped into rather than recreating it from scratch.
C# is one language that can be used on .NET. It get compiled initially by Roslyn and can get additional compilation at runtime by RyuJIT. Other languages include F#, which can all be compiled and run against its runtimes.
This works because it’s generally not compiled to a particularly low level language but rather to an Intermediate Language that can be executed by a .NET runtime. The runtime then does the appropriate translations to actual system/hardware calls allowing you to not have to worry about it.
When you create at least C# projects, you have to specify what runtime you’re targeting so that it can be compiled appropriately to work; not just whether it’s Framework or Core, but also the version number since functionality of the same thing may be different.
One of the goals with .NET 5+ is to reduce the confusion by bringing many of the parts together under one umbrella, but it’s going to be a while before that replaced enough existing software to really get rid of the confusion (especially since .NET 5 isn’t going to have Long Term Support).
Upgrade to Asp.Net Core From Asp.Net MVC 5
I’m working on a project written with Asp.Net MVC 5 were I work. We intend first upgrade our class libraries to .Net Standard as much as we can. Then we make the move to Asp.Net Core. But since we have many class libraries, I’ve decide to first do a little search about what is the …
XUnit – Part 7: Categorizing Tests with xUnit Trait
Sometimes we only need to run a specific kind of tests and not others. In order to be able to do that we need some mechanism to categorize our tests. xUnit has a built in mechanism for this called Trait. In this post I’m going to show how we can use it to categorize our …
XUnit – Part 6: Testing The Database with xUnit Custom Attributes
In this Often we need to test our database code. There are a lot of ways to do that, but I think the cleanest way is to create a custom attribute for it. What we want to achieve is to create a custom attribute. In this attribute we pass the information need to connect to …
XUnit – Part 5: Share Test Context With IClassFixture and ICollectionFixture
xUnit has different mechanisms to share test context and dependencies. Not only it allows us to share different dependencies between tests, but also between multiple test classes. We can also choose to get a fresh set of data every time for our test. So in this post, I’m going to go though those mechanism with …
XUnit – Part 4: Parallelism and Custom Test Collections
As multi core processor and computers gain prevalence, the topic of Parallelism become more important. It allows us to use the computing resource we have available to the fullest. So by release of xUnit 2, we have the ability to run the tests in parallel. In this version, the tests are gathered into collection, and …
XUnit – Part 3: Action Based Assertions Assert.Raises and Assert.Throws
In my previous post, we saw how value and type based assertions works in xUnit. In this post I’m going to focus on assertions that check whether or not something happened. Specifically we look at assertions to check if an event is raised or an exception is thrown. Asserting if An Event Is Raised Let’s …
XUnit – Part 2: Value and Type Based Assertions in xUnit
In xUnit and many other testing frameworks, assertion is the mean that we conduct our test. In other word we assert an expectation that something is true about a piece of code. There are many different types of assertion in xUnit that we can use. Normally assertions are based on different types of object, but …
XUnit – Part 1: xUnit Packages and Writing Your First Unit Test
I one of my previous post I said I’m going to write a series of articles on xUnit. I’m going to start from the begging which is installing xUnit packages. I’m also going to explain a little about other frameworks that might be used with xUnit to complement it. In the future I’ll go in …
Using Google Indexing API With Google API Client Library for .NET
Normally websites get indexed by google automatically. There’s also sitemap to help us announce what should be crawled by google or certain pages exist on our website. For each update of our website the search engine crawlers from google visit our website and update their indexes with our pages information. But waiting for google bots …