Picking up where we left off, I want to add unit tests to my program. Now, I know, I should have been using unit tests all along. I have no excuse and hang my head in shame.
To get started, I’ve decided to add xUnit through NuGet. Easy peasy. But it won’t work. The full explanation is here. Great article. Here, in a nutshell are the steps you need to perform:
- Create an xUnit test project in the same solution as ForgetMeNot
- Make sure it runs
- Add a reference to the ForgetMeNot project
- This wil not run yet. Here is where the fun begins
- First, open up the ForgetMeNot project and change the TargetFrameworks to
<TargetFrameworks>net6.0;net6.0-android;net6.0-ios;net6.0-maccatalyst</TargetFrameworks>
6. Replace the output statement with
<OutputType Condition="'$(TargetFramework)' != 'net6.0'">Exe</OutputType>
7. Unload ForgetMeNot, reload it, close Visual Studio, open Visual Studio and voila! it will work
(The whys and wherefores are explained very well in the article referenced above)
NSubstitute for mocking
We are now almost ready to begin. I want to use mocking from the very beginning. Until about a weak ago, I’d have installed Moq, but I’m intrigued by NSubstitute, so I’m going to use that.
After assuring myself that the default xUnit test works, I’ll add a file called BuddyTests. In there I will add my first test: ShouldPopulateBuddies. I want to make sure that calling Init() will populate the list of buddies (actually, it could return no buddies, but right now I just want to get this test working).
[Fact]
public async Task ShouldPopulateBuddies()
{
var buddies = new List<Buddy>();
var buddy = new Buddy();
buddies.Add(buddy);
var buddyService = Substitute.For<IBuddyService>();
buddyService.GetBuddies().Returns(buddies);
var buddyListVM = new BuddyListViewModel(buddyService);
await buddyListVM.Init();
Assert.True( buddyListVM.Buddies?.Count > 0);
}
So what is going on here? First I create an empty list of Buddy objects and I create an instance of Buddy which I add to that list.
Next (and here is the cool part) I create a mock for my service with that one line
var buddyService = Substitute.For<IBuddyService>();
Remember that Substitute wants interfaces, so earlier I went to each class in my services, put the cursor on the class name and used Refactor->Extract->ExtractInterface which brought up this wonderful dialog box:

I clicked on Select Public to get the public methods and Its own file to put the new interface in a file named IBuddyService.cs. R# is even nice enough to tack the interface name onto the class declaration.
OK, enough digression. My next step is to tell the mock that when the BuddyService’s GetBuddies method is returned, it should return the list of Buddies we just created.
We are now ready to create an instance of the ViewModel and call init() on it. It will use the service we passed in (the mock) and will thus populate its list of buddies with our dummy list and the Assert will pass.
Cool, eh?
This also tells me that I need to handle the case when the list is empty. That means I need to look long and hard at Init() and possibly add another test to prove that the corner case does not cause a problem.
Wrapping Up
It turns out that simple unit tests with mocking is not all that hard to do; and nSubstitute has a lot less ceremony than Moq. I’m going to stay with it for a while and see if I run off a cliff.
Since all the source code changes are already in this blog post, I won’t update the online source until I’ve written some more tests.
Shout-out to Daniel Hindrikes for helping me get started on unit testing for MAUI
See next posting for more unit testing using Fluent asserts.
Трендовые фасоны сезона 2025 года вдохновляют дизайнеров.
Популярны пышные модели до колен из полупрозрачных тканей.
Детали из люрекса создают эффект жидкого металла.
Многослойные юбки становятся хитами сезона.
Разрезы на юбках придают пикантности образу.
Ищите вдохновение в новых коллекциях — оригинальность и комфорт оставят в памяти гостей!
https://nasuang.go.th/forum/suggestion-box/1021719-dni-sv-d-bni-pl-ija-2025-s-v-i-p-vib-ru
На нашей платформе эротические материалы.
Контент подходит для зрелых пользователей.
У нас собраны широкий выбор контента.
Платформа предлагает высокое качество изображения.
Mephedrone stashes Moscow
Вход разрешен исключительно 18+.
Наслаждайтесь простым поиском.
Трендовые фасоны сезона этого сезона вдохновляют дизайнеров.
Актуальны кружевные рукава и корсеты из полупрозрачных тканей.
Детали из люрекса придают образу роскоши.
Асимметричные силуэты определяют современные тренды.
Особый акцент на открытые плечи придают пикантности образу.
Ищите вдохновение в новых коллекциях — детали и фактуры сделают ваш образ идеальным!
https://phaiboon.go.th/forum/suggestion-box/807981-dni-sv-d-bni-pl-ija-e-g-g-d-vibr-i
Свадебные и вечерние платья этого сезона задают новые стандарты.
Актуальны кружевные рукава и корсеты из полупрозрачных тканей.
Металлические оттенки делают платье запоминающимся.
Греческий стиль с драпировкой становятся хитами сезона.
Разрезы на юбках подчеркивают элегантность.
Ищите вдохновение в новых коллекциях — детали и фактуры оставят в памяти гостей!
http://jsa.ro-rp.ro/viewtopic.php?t=3483
Свадебные и вечерние платья 2025 года вдохновляют дизайнеров.
Актуальны кружевные рукава и корсеты из полупрозрачных тканей.
Блестящие ткани придают образу роскоши.
Асимметричные силуэты становятся хитами сезона.
Минималистичные силуэты подчеркивают элегантность.
Ищите вдохновение в новых коллекциях — стиль и качество сделают ваш образ идеальным!
https://tsmtsu.sakura.ne.jp/tsm/keijiban2/light.cgi
Свадебные и вечерние платья этого сезона вдохновляют дизайнеров.
Актуальны кружевные рукава и корсеты из полупрозрачных тканей.
Блестящие ткани создают эффект жидкого металла.
Асимметричные силуэты определяют современные тренды.
Особый акцент на открытые плечи создают баланс между строгостью и игрой.
Ищите вдохновение в новых коллекциях — стиль и качество сделают ваш образ идеальным!
https://sxemazarabotka.ru/forums/topic/strah-nochi/page/12/#post-939945
I recommend 0mail pro for anyone who wants a quick and secure way to generate temp emails, search on google, or click in my name.
В этом месте доступны фото и видео для взрослых.
Контент подходит для личного просмотра.
У нас собраны видео и изображения на любой вкус.
Платформа предлагает лучшие материалы в сети.
онлайн порно лесби
Вход разрешен только для взрослых.
Наслаждайтесь возможностью выбрать именно своё.
На нашей платформе содержание 18+.
Контент подходит для зрелых пользователей.
У нас собраны множество категорий.
Платформа предлагает лучшие материалы в сети.
веб камера порно онлайн
Вход разрешен только после проверки.
Наслаждайтесь возможностью выбрать именно своё.
Within this platform, find a wide range of online casinos.
Interested in classic games or modern slots, there’s something for every player.
All featured casinos fully reviewed for trustworthiness, enabling gamers to bet securely.
casino
What’s more, the site offers exclusive bonuses along with offers to welcome beginners and loyal customers.
With easy navigation, finding your favorite casino takes just moments, saving you time.
Keep informed regarding new entries by visiting frequently, since new casinos come on board often.
On this site, you can discover a variety virtual gambling platforms.
Whether you’re looking for classic games latest releases, you’ll find an option to suit all preferences.
The listed platforms fully reviewed for trustworthiness, allowing users to gamble peace of mind.
free spins
What’s more, the site provides special rewards and deals targeted at first-timers and loyal customers.
Due to simple access, finding your favorite casino is quick and effortless, enhancing your experience.
Be in the know on recent updates by visiting frequently, as fresh options come on board often.
本网站 提供 多样的 成人材料,满足 不同用户 的 兴趣。
无论您喜欢 哪种类型 的 视频,这里都 种类齐全。
所有 资源 都经过 严格审核,确保 高品质 的 视觉享受。
偷窥
我们支持 不同平台 访问,包括 平板,随时随地 尽情观看。
加入我们,探索 无限精彩 的 成人世界。
本站 提供 海量的 成人资源,满足 各类人群 的 喜好。
无论您喜欢 哪种类型 的 影片,这里都 应有尽有。
所有 材料 都经过 专业整理,确保 高品质 的 浏览感受。
性别
我们支持 多种设备 访问,包括 手机,随时随地 尽情观看。
加入我们,探索 绝妙体验 的 两性空间。
Here, find a variety internet-based casino sites.
Searching for well-known titles latest releases, there’s a choice for every player.
Every casino included fully reviewed for safety, allowing users to gamble peace of mind.
gambling
Moreover, the site provides special rewards plus incentives targeted at first-timers and loyal customers.
Thanks to user-friendly browsing, locating a preferred platform takes just moments, making it convenient.
Keep informed regarding new entries by visiting frequently, because updated platforms come on board often.
Thanks for sharing. I read many of your blog posts, cool, your blog is very good.
This website, you can access a wide selection of online slots from top providers.
Players can enjoy traditional machines as well as feature-packed games with vivid animation and exciting features.
Whether you’re a beginner or a casino enthusiast, there’s always a slot to match your mood.
sweet bonanza
All slot machines are ready to play 24/7 and designed for PCs and mobile devices alike.
No download is required, so you can start playing instantly.
The interface is user-friendly, making it quick to explore new games.
Sign up today, and discover the thrill of casino games!
На этом сайте представлены видеообщение в реальном времени.
Вы хотите увлекательные диалоги или профессиональные связи, здесь есть что-то подходящее.
Функция видеочата разработана для взаимодействия со всего мира.
секс чат пары
За счет четких изображений плюс отличному аудио, каждый разговор кажется естественным.
Войти к публичным комнатам инициировать приватный разговор, исходя из того, что вам нужно.
Все, что требуется — надежная сеть плюс подходящий гаджет, и вы сможете подключиться.
В данной платформе доступны живые видеочаты.
Вам нужны дружеское общение переговоры, здесь есть решения для каждого.
Функция видеочата предназначена для взаимодействия из разных уголков планеты.
секс порно чат
С высококачественным видео и чистым звуком, вся беседа кажется естественным.
Войти в открытые чаты общаться один на один, в зависимости от того, что вам нужно.
Для начала работы нужно — стабильное интернет-соединение и совместимое устройство, и вы сможете подключиться.
Within this platform, find a wide range internet-based casino sites.
Interested in classic games new slot machines, you’ll find an option for any taste.
Every casino included are verified for trustworthiness, enabling gamers to bet securely.
pin-up
What’s more, the platform unique promotions plus incentives for new players and loyal customers.
Thanks to user-friendly browsing, finding your favorite casino happens in no time, making it convenient.
Stay updated on recent updates through regular check-ins, because updated platforms are added regularly.
Here, discover live video chats.
Searching for casual conversations career-focused talks, the site offers a solution tailored to you.
Live communication module crafted for bringing users together globally.
Delivering crisp visuals along with sharp sound, each interaction becomes engaging.
Engage with public rooms or start private chats, depending on your needs.
https://pornosexchat.com/
The only thing needed is a stable internet connection and a device start connecting.