Image for post
Image for post
Photo credit: https://unsplash.com/@_louisreed

This article is the continuation of this one, where I created the solution with the Domain layer and the interface to the Infrastructure (in this case a repository) layer.

Our next step is to create our Test project by running the following commands. We are creating an NUnit test project and including it in the solution.

dotnet new nunit --framework netstandard2.1 --name Transactions.Testsdotnet sln Transactions.sln add Transactions.Domain/

Let’s now install NSubstitute with the following command.

dotnet add package NSubstitute

As seen on the previous article, we don’t have an implementation for the Repository layer (only interface), so we will mock it by using NSubstitute. …


Image for post
Image for post
Image credit: https://unsplash.com/@mitchel3uo

“The business rules can be tested without the UI, Database, Web Server, or any other external element”.

The above quote was written by Robert C. Martin, a.k.a. Uncle Bob, in his genial, amazing, great blog Clean Coder.

Does this mean that we can implement all the business rules of a project and test all of them before adding a database, an API or something like that?

Of course it does!

Our Domain layer (or Use Cases, or Business, the name is up to you and depends on your approach in this part) should implement all the business rules on the system, while depending on no other layer. …


Image for post
Image for post
Photo credit: Lefteris kallergis

Dependency injection is a technique which is largely used to avoid tight coupling inside the applications, by abstracting objects/modules and inverting the dependency flow.

Of course this is a simplified explanation of it but, if you are here, I believe that we are familiarized with the technique and you might have googled “dependency injection in rust”, or something like that, in order to know specifically how to use it in Rust.

Otherwise, check this link out. The explanation about the topic is way more instructive =).

In this article I want to show how to use dependency injection using Waiter DI, a very useful DI crate for Rust. …


Image for post
Image for post
Photo credit: Chandler Cruttenden

I’ve been investing some time of the past two months in Rust using some online courses and YouTube videos. My first impressions: I’m really enjoying it!

In this article I intend to show in an objective way how to include some useful packages (or crates, in the Rust dialect) to your Rust project.

I’m assuming that you already have Rust installed.

To create a new project, select a folder and execute the following command on your terminal: cargo new example --bin.

In your Cargo.toml file, add the dependencies as the following:

[dependencies]
tokio = { version = "0.3", features = ["full"] }
mongodb = { version = "1.1.1", default-features = false, features = ["async-std-runtime"]…

Image for post
Image for post
Photo Credit: processingly

When we start to use Typescript to program in Node.js, usually our main goal is make use of the benefits of object oriented languages, for instance, some of the design patterns.

The objective of this arcticle is to show a way to use one of these patterns: the dependency injection.

I’m not entering in details about the pattern itself but, very briefly, this pattern allows you to reduce the coupling of your source code by inverting the dependences of the modules and classes.

Let’s start by installing the necessary packages for it. I’m assuming you already have a project in typescript and you only want to add the injection in it. …

About

Paolo Victor

Full-stack software developer. Guitarrist. Frequent Google and Medium goer.

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store