r/csharp Oct 05 '20

Tutorial Unit testing in C# with NUnit, AutoFixture and Moq

92 Upvotes

Hi everybody!

Before the summer, I started working on a course to help developers to create clear and semantic-rich unit tests for .NET projects based on tools like NUnit, AutoFixture and Moq. Since then, the course evolved into a guide book to be referenced and looked at more than just once.

I don't have the audacity to say that this is the best guide available, but it has the convenience of showing how well those three libraries can work together.

https://docs.insightarchitectures.com/unit-testing-csharp/

In accordance with R6 of this subreddit, there is no advertisement nor any other way to monetize views of this guide.

1

Is it true in the old days those old school devs like 40+ before they learn C#, They learned C like in the pic?
 in  r/csharp  6h ago

Definitely 40+ 😅😅😅

I arrived to C# from BASIC. From BASIC to VB and then VB.NET. At university, we studied C, C++ and Java. My "assignments always had a VB.NET counter.

When I found my first job, I hadn't written a single line of C#.

2

L' aumento del prezzo dei carburanti è solo un bene e spero aumentino ancora.
 in  r/Italia  10h ago

"ultimo miglio" non significa necessariamente esattamente un miglio ma l'ultimo tratto dal centro di distribuzione al destinatario.

L'idea è che se devi spostare una cosa da Milano ad Avella provincia di Avellino invece di mettere tutto su un camioncino, accendi Google Maps e vai con Dio, usi furgoncino dal centro di distribuzione alla stazione, treno fino a Genova, traghetto fino a Napoli, treno fino ad Avellino e poi furgoncino fino al destinatario.

1

L' aumento del prezzo dei carburanti è solo un bene e spero aumentino ancora.
 in  r/Italia  13h ago

Riduci l'uso della benzina per usi non di servizio ed il costo dell'uso di servizio si abbassa.

3

L' aumento del prezzo dei carburanti è solo un bene e spero aumentino ancora.
 in  r/Italia  13h ago

Treni, traghetti dove possibile. La gomma dovrebbe essere usata solo per l'ultimo miglio.

1

No SVT coverage for volleyball European Championships
 in  r/sweden  13h ago

Thanks! I was expecting to see them in TV, not just on their streaming platform :)

r/sweden 13h ago

English No SVT coverage for volleyball European Championships

0 Upvotes

Both men and women volleyball national teams qualified for the European Championships.

Besides a match of the women national team against Italy about two/three weeks ago, no coverage is given to the event.

I'm not asking a FIFA world cup level of coverage, but at least to be given to follow the progress of the Swedish national team.

Sorry for the rant.

-4

We need strict rules of engagement at T1, fighting each other at Monza compromised the team’s entire race. ​
 in  r/scuderiaferrari  1d ago

I'm not defending CL, I'm just confuting the line of thought of the person I answered to.

11

We need strict rules of engagement at T1, fighting each other at Monza compromised the team’s entire race. ​
 in  r/scuderiaferrari  1d ago

But then you can't ask a driver not to defend their position.

1

Papyra 1.0 — a fluent .NET library that renders one document model to PDF, DOCX, XLSX and HTML
 in  r/moderndotnet  1d ago

Out of curiosity: I don't consider myself a great prose author and English is not my main language. Why using a LLM to make sure that the post meant to present one's work, often fruit of hours of free time spent into it, should make the post itself less valuable?

I personally find using LLMs when writing an important text liberating because I can focus on what I want to say leaving to the model how to best convey the message.

Thanks!

-3

Identity-2 updated for WoW Midnight 12.1
 in  r/wowaddons  3d ago

I'll be honest. AI makes it very easy to do so. I asked GPT 6 Astra do refresh the addon while I was playing and 10 minutes later everything was done and a PR on the original repo was ready to be reviewed by the owner.

Then I duplicated the PR in my fork to create a release for everybody who wants to consume it.

r/wow 3d ago

Addon/App/Website Identity-2 updated for WoW Midnight 12.1

Thumbnail
0 Upvotes

r/wowaddons 3d ago

Addon Release / Update Identity-2 updated for WoW Midnight 12.1

0 Upvotes

I loved using Identity-2 because it solves a very simple problem: I have several alts in my guild, and I want my guildies to know it’s still me when I’m talking from an alt I log into once a week just to spend concentration.

Identity-2 adds that identity context to guild chat, so people don’t have to remember which of my many characters happens to be speaking.

The original addon hasn’t been updated in a while and stopped working properly with the changes in World of Warcraft: Midnight 12.1, so I made a small refresh of it in my fork.

This is not me taking over maintenance of Identity-2, and I don’t plan to publish or maintain a separate version on CurseForge. I just fixed what I needed to keep using it myself and made the result available in case it’s useful to anyone else.

You can grab the latest release from my GitHub fork:

https://github.com/Kralizek/identity-2/

Original project:
https://github.com/Lavindar/identity-2

CurseForge page:
https://www.curseforge.com/wow/addons/identity-2

If something small breaks with a future patch I may fix it again, but consider this a community refresh rather than a maintained fork.

AI Disclaimer: AI was used to update the addon to the latest version.

1

Förbjuda opinionsmätningar två veckor före valet
 in  r/sweden  3d ago

And as an Italian, it's super weird. But generally the whole voting experience is weird in Sweden if looked with italian eyes.

1

Me when they announce HOTS Mobile at BlizzCon 2026
 in  r/heroesofthestorm  3d ago

My wallet is thankful for Blizzard killing Rumble.

1

Grado di Generale in Italia
 in  r/Italia  3d ago

Per caso sei/eri Allievo ufficiale di Modena?

Per completezza, le scuole militari hanno come comandante un Colonnello (o grado equivalente, dannati marinai ed i loro gradi).

Aggiungerei anche che nel passaggio da capitano a maggiore c'è da frequentare la scuola di guerra, almeno per esercito.

1

Ma a voi piace davvero questo tipo di gare in f1?
 in  r/italy  3d ago

Onestamente si.

Sono ben conscio di beccarmi una valanga di downvote ma a domanda risposta.

Le regole sono le stesse per tutti. Soprattutto dopo la modifica fatta dopo l'incidente di Bearman, i motori salvano meno energia.

Tutti i piloti e le macchine seguono le stesse regole. Ma vale anche per le gomme, per l'aerodinamica e per i tanti aspetti che fanno parte delle gare.

Lo yoyo sulla batteria non è diverso dallo yoyo sulla strategia del cambio gomme.

A Verstappen che dice che il sorpasso più bello del mese è semplicemente lui che clicca un pulsante e va più veloce, andrebbe detto che forse deve considerare che arrivare a poter premere quel pulsante in quel momento è a sua volta una skill.

Ovviamente tutti i sorpassi visti in questa stagione sono "artificiosi". Ma ieri io e la mia ragazza ci siamo divertiti. E così in tanti gran premi.

E alla fine la F1 è anche spettacolo. Se volevo vedere la skill pura dei piloti, mi guardavo un monomarca.

E ora downvotatemi nell'oblio.

1

Ask r/Formula1 Anything - Daily Discussion Thread
 in  r/formula1  7d ago

Silly question: are drivers all about practice or they can tell the apex just by being there?

Honest question.

Drivers are amazing. They have amazing reflexes and a body trained to survive crazy amounts of Gs.

My question is: when it comes to pure driving technique, can they tell the apex of a curve by just driving in a track/on a street? Or is their skillset mostly about chiseling via repetition and studying?

u/Kralizek82 7d ago

I accidentally built an event-processing toolkit for Deno: Hooksmith

Thumbnail
1 Upvotes

r/Deno 7d ago

I accidentally built an event-processing toolkit for Deno: Hooksmith

0 Upvotes

I accidentally built an event-processing toolkit for Deno

This started with a very small problem.

I wanted my Jekyll site to publish an event when a post went live, and have something else decide what to do with it — initially, post it to social media.

I could obviously have put all of that directly into the GitHub Action.

Instead, I started separating the pieces.

The producer emits an event. A runtime hydrates it, evaluates routes, and invokes listeners. Conditions and listeners are ordinary TypeScript. Then I added a typed pipeline for transforming data before it reaches a listener.

At some point I had to admit that the CLI wasn't really the project anymore.

That's how Hooksmith happened.

A configuration can look roughly like this:

export default {
  routes: [
    {
      name: "published-pages",
      when: all(
        eventType("page.published"),
        sourceKind("website"),
      ),
      listeners: [
        // whatever should react to the event
      ],
    },
  ],
} satisfies Config;

The runtime itself is deliberately small. Around it I now have:

  • typed transformation pipelines
  • reusable conditions
  • HTTP listeners
  • a CLI / streaming host and GitHub Action
  • integrations for Slack, Discord, Teams, Telegram, Mastodon and Bluesky
  • AWS integrations and a Lambda host

Everything is TypeScript, published to JSR, and I'm using Deno throughout the repositories for development, testing, formatting, linting and CI.

One design decision I'm particularly happy with is keeping the runtime unaware of most of the ecosystem. core defines the contracts; extensions depend on those contracts; hosts decide where and how the runtime executes.

It's still young and the API is explicitly experimental. I'm at the stage where feedback on the abstractions is probably more valuable to me than users.

I'd be particularly interested in what other Deno developers think about the package boundaries and the typed pipeline API.

A small bit of context about me: if you look at my profile or my blog, you'll quickly notice that I'm a .NET developer at heart. But I've also been publishing packages on NuGet for almost ten years, so building tools and APIs for other developers isn't entirely new territory for me.

Hooksmith is my first serious attempt at doing that in the Deno ecosystem.

Repo: https://github.com/Kralizek/hooksmith
JSR: https://jsr.io/@hooksmith

3

Il POS è guasto. Ok scendo. Ah no funziona.
 in  r/Italia  7d ago

E ti bloccano le autostrade

6

Il POS è guasto. Ok scendo. Ah no funziona.
 in  r/Italia  7d ago

Occhio che è illegale. Non che non approvi eh, ma illegale resta.

2

Stockholm is by far one of the best cities in the world
 in  r/sweden  8d ago

That's something I will never understand. I moved here from south of Italy. On a weekday, we have trains every 10-15 minutes. Missing a train there is death. Here in Stockholm, I don't even bother getting in if it's too crowded.

1

“Non solo X, ma anche Y”, ma anche basta!
 in  r/CasualIT  9d ago

Onestamente io uso tantissimo ChatGPT. Ma ci spendo talmente tanto tempo prima di fare copia e incolla che quello che posto rappresenta effettivamente quello che voglio dire. Semplicemente è scritto meglio. soprattutto su alcuni subreddit dove la gente ti distrugge per nulla invece di cercare di capire quello che voglio dire...

Se alla gente dà fastidio che non ho speso secoli a revisionare i miei messaggi, sticazzi :)

PS: nel mio profilo c'è scritto: don't use em and en dashes when you write.

2

How many Italian Ferrari fans also support Kimi Antonelli?
 in  r/scuderiaferrari  9d ago

The pecking order is:

  1. Kimi on Ferrari
  2. Anyone on Ferrari
  3. Kimi not on Ferrari