There are a couple ways to verify if 2 Json strings are equivalent. Using DeepEquals on JObject There’s a static function DeepEquals on JObject which compares the values of 2 tokens and all their descendant tokens. We can parse the Json strings into JObject and then use this function to compare them. Using FluentAssertions Another … [Read more…]
In my project at work, I come across a function where I have to deserialise a Json string to an anonymous object. For Json serialisation in this project, we always use the following Json serialisation settings. I expect the result anonymous object would ignore null properties but they are included. See example below This is … [Read more…]
I have a need to override the default namespace and change the root name when serialising object to XML string. I could add XmlType attribute and change the namespace and add XmlRoot attribute for a different root name. However, we have different clients and each requires different namespace and root name. So I need to … [Read more…]
We discover a bug in our code where it seems like the gateway api is calling the core microservice infinitely. The problem We have a background task which creates some entities in the database. This results in eventual consistency. However, the front end does not know when the background task finishes. So when the front … [Read more…]
I often find myself adding some sort factory in almost every project I’ve ever worked on. Let’s say we have a pizza price checker factory that returns a validator to check if the price is valid based on a particular type of pizza. It would look something like below However, if you have other similar … [Read more…]
In this post, I’m going to show how to read details of a digital certificate using Chilkat library from a Base64 string. The below is my model of the details I want to read from the certificate. Here is the method to read in the certificate
In my last post, I showed how to read an XML digital signature. In this post, I’m going to show how to verify the XML digital signature to check if it’s valid or not.
For a project I’m working on, I have to read in an XML digital signature – XmlDSig. In this post, I’m going to show how to read an XmlDsig value using SignedXml object from namespace System.Security.Cryptography.Xml. I add a class to hold my signature data The following is the function to read the XmlDsig value