Menu

Skip to content
  • Home
  • About
  • Color Coder
Hamid Mosalla
Twitter Email LinkedIn GitHub Stack Overflow RSS

Hamid Mosalla

Web Development And .Net Articles, Tutorials, Discussions

.Net

August 1, 2021 by Hamid Mosalla on .Net, Visual Studio

Color Coder: Using Roslyn APIs For Syntax Highlighting

Couple of years ago, I’ve created a Visual Studio extension to colorize things in C#. More specifically I was trying to colorize different programming constructs such as extension methods. So it had to be done in a syntax aware manner as oppose to coloring text. For that I used Roslyn .NET compiler to do this. … →

 
July 19, 2020 by Hamid Mosalla on .Net, .Net Core, C#

Careful Model Binding JavaScript ISO Date Format to DateTime

It is agreed by the .Net community that DateTime should not be used when we develop .Net applications. You can read more about why that here. In short the least we can do is to use DateTimeOffset instead. But this post is not about the common problems associated with using DateTime. But rather it’s about … →

 
May 22, 2020 by Hamid Mosalla on .Net, Asp.Net Core

Using IHttpClientFactory with Asp.Net MVC 5

Recently in my company we wanted to use IHttpClientFactory  with our web app. But the problem was IHttpClientFactory was originally meant to be used with Asp.Net Core and not MVC 5. So I had to find a workaround that to be able to use it with older MVC applications. So in this post I’m going … →

 
April 5, 2020 by Hamid Mosalla on .Net, XUnit

XUnit – Part 8: Using TheoryData Instead of MemberData and ClassData

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 … →

 
March 22, 2020 by Hamid Mosalla on .Net, .Net Core, Asp.Net Core, C#

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 … →

 
March 1, 2020 by Hamid Mosalla on .Net, C#, XUnit

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 … →

 
February 16, 2020 by Hamid Mosalla on .Net, C#, XUnit

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 … →

 
February 2, 2020 by Hamid Mosalla on .Net, C#, XUnit

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 … →

 
January 26, 2020 by Hamid Mosalla on .Net, C#, XUnit

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 … →

 
January 20, 2020 by Hamid Mosalla on .Net, C#, XUnit

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 … →

 
Older Posts →
Page 1 of 6

Archives

Categories

 
Subscribe!
Copyright © 2017 Hamid Mosalla
Casper Theme By Lacy Morrow