[{"data":1,"prerenderedAt":272},["ShallowReactive",2],{"navigation":3,"page-blog,announcing-csharpfunctionalextensions-fluentassertions":54},[4,8,12],{"title":5,"path":6,"stem":7},"Home","\u002F","1.index",{"title":9,"path":10,"external":11},"NimblePros","\u002Fnimblepros",true,{"title":13,"path":14,"stem":15,"children":16,"page":53},"Blog","\u002Fblog","blog",[17,21,25,29,33,37,41,45,49],{"title":18,"path":19,"stem":20},"2021 Year in Review","\u002Fblog\u002F2021-year-in-review","blog\u002F1.2021-year-in-review",{"title":22,"path":23,"stem":24},"Introducing Payroll Processor","\u002Fblog\u002Fintroducing-payroll-processor","blog\u002F2.introducing-payroll-processor",{"title":26,"path":27,"stem":28},"Announcing the CSharpFunctionalExtensions.FluentAssertions Library","\u002Fblog\u002Fannouncing-csharpfunctionalextensions-fluentassertions","blog\u002F3.announcing-csharpfunctionalextensions-fluentassertions",{"title":30,"path":31,"stem":32},"2022 Year in Review","\u002Fblog\u002F2022-year-in-review","blog\u002F4.2022-year-in-review",{"title":34,"path":35,"stem":36},"CodeMash 2023 Highlights","\u002Fblog\u002Fcodemash-2023-highlights","blog\u002F5.codemash-2023-highlights",{"title":38,"path":39,"stem":40},"Stir Trek 2023 Highlights","\u002Fblog\u002Fstir-trek-2023-highlights","blog\u002F6.stir-trek-2023-highlights",{"title":42,"path":43,"stem":44},"2023 Year in Review","\u002Fblog\u002F2023-year-in-review","blog\u002F7.2023-year-in-review",{"title":46,"path":47,"stem":48},"NServiceBus Zero to Hero Series","\u002Fblog\u002Fnservicebus-series","blog\u002F8.nservicebus-series",{"title":50,"path":51,"stem":52},"Building My DIY Solar Power System: A Complete Guide","\u002Fblog\u002Fdiy-solar-project","blog\u002F9.diy-solar-project",false,{"id":55,"title":26,"body":56,"date":265,"description":266,"extension":267,"head":268,"image":66,"keywords":268,"layout":268,"meta":269,"navigation":11,"path":27,"seo":270,"stem":28,"__hash__":271},"blog\u002Fblog\u002F3.announcing-csharpfunctionalextensions-fluentassertions.md",{"type":57,"value":58,"toc":260},"minimark",[59,67,87,92,98,163,166,181,206,210,235,239,256],[60,61,62],"p",{},[63,64],"img",{"alt":65,"src":66},"Announcing the CSharpFunctionalExtensions.FluentAssertions library","\u002FAnnouncing-the-CSharpFunctionalExtensions-FluentAssertions-library.png",[60,68,69,70,77,78,82,83,86],{},"Version 1.0.0 of ",[71,72,76],"a",{"href":73,"rel":74},"https:\u002F\u002Fwww.nuget.org\u002Fpackages\u002FCSharpFunctionalExtensions.FluentAssertions",[75],"nofollow","CSharpFunctionalExtensions.FluentAssertions"," is now available on NuGet! This package enables developers to increase the readability of their tests by providing a more fluent way to write assertions based on common types such as ",[79,80,81],"code",{},"Maybe\u003CT>"," and ",[79,84,85],{},"Result"," from the CSharpFunctionalExtensions library.",[88,89,91],"h2",{"id":90},"an-example-from-csharpfunctionalextensionsfluentassertions","An Example from CSharpFunctionalExtensions.FluentAssertions",[60,93,94,95,97],{},"Let's take a look at what a xUnit test method with an assertion on a ",[79,96,81],{}," object might look like first without and then with this new library.",[99,100,105],"pre",{"className":101,"code":102,"language":103,"meta":104,"style":104},"language-csharp shiki shiki-themes github-dark github-light","[Fact]\npublic void MaybeShouldHaveValue()\n{\n  int value = 4680;\n  var maybe = Maybe.From(value);\n\n  maybe.Value.Should().NotBeNull();\n  maybe.Value.Should().Be(value); \n}\n","csharp","",[79,106,107,115,121,127,133,139,145,151,157],{"__ignoreMap":104},[108,109,112],"span",{"class":110,"line":111},"line",1,[108,113,114],{},"[Fact]\n",[108,116,118],{"class":110,"line":117},2,[108,119,120],{},"public void MaybeShouldHaveValue()\n",[108,122,124],{"class":110,"line":123},3,[108,125,126],{},"{\n",[108,128,130],{"class":110,"line":129},4,[108,131,132],{},"  int value = 4680;\n",[108,134,136],{"class":110,"line":135},5,[108,137,138],{},"  var maybe = Maybe.From(value);\n",[108,140,142],{"class":110,"line":141},6,[108,143,144],{"emptyLinePlaceholder":11},"\n",[108,146,148],{"class":110,"line":147},7,[108,149,150],{},"  maybe.Value.Should().NotBeNull();\n",[108,152,154],{"class":110,"line":153},8,[108,155,156],{},"  maybe.Value.Should().Be(value); \n",[108,158,160],{"class":110,"line":159},9,[108,161,162],{},"}\n",[60,164,165],{},"With the reference to the CSharpFunctionalExtensions.FluentAssertions library, the assertion of the test method can be changed to the following.",[99,167,169],{"className":101,"code":168,"language":103,"meta":104,"style":104},"maybe.Should().HaveSomeValue();\nmaybe.Should().HaveValue(value);\n",[79,170,171,176],{"__ignoreMap":104},[108,172,173],{"class":110,"line":111},[108,174,175],{},"maybe.Should().HaveSomeValue();\n",[108,177,178],{"class":110,"line":117},[108,179,180],{},"maybe.Should().HaveValue(value);\n",[60,182,183,184,189,190,192,193,192,195,192,198,201,202,205],{},"You can check out other sample usages of the CSharpFunctionalExtensions.FluentAssertions library in the ",[71,185,188],{"href":186,"rel":187},"https:\u002F\u002Fgithub.com\u002FNitroDevs\u002FCSharpFunctionalExtensions.FluentAssertions#usage",[75],"Usage"," section of the project's readme. The library contains FluentAssertion extensions for ",[79,191,81],{},", ",[79,194,85],{},[79,196,197],{},"Result\u003CT>",[79,199,200],{},"Result\u003CT, E>",", and ",[79,203,204],{},"UnitResult\u003CE>"," types.",[88,207,209],{"id":208},"closing-remarks","Closing Remarks",[60,211,212,213,218,219,224,225,228,229,234],{},"This package was motivated by some of the tests I have been writing for ",[71,214,217],{"href":215,"rel":216},"https:\u002F\u002Fgithub.com\u002FKyleMcMaster\u002Fpayroll-processor",[75],"payroll processor"," as I refactor that codebase from LanguageExt to CSharpFunctionalExtensions. This project's success should also be strongly attributed to the contributions by ",[71,220,223],{"href":221,"rel":222},"https:\u002F\u002Ftwitter.com\u002Fseangwright",[75],"Sean"," Wright](",[71,226,221],{"href":221,"rel":227},[75],") for helping me through the process of publishing a NuGet package for the first time and establishing an automated deployment pipeline with the ability to generate a preview package easily. Give him a follow on Twitter! I'd also like to thank ",[71,230,233],{"href":231,"rel":232},"https:\u002F\u002Fgithub.com\u002FMrBogomips",[75],"Giovanni Costagliola"," for being the first community contributor to this project.",[88,236,238],{"id":237},"resources","Resources",[240,241,242,250],"ul",{},[243,244,245],"li",{},[71,246,249],{"href":247,"rel":248},"https:\u002F\u002Fgithub.com\u002FNitroDevs\u002FCSharpFunctionalExtensions.FluentAssertions",[75],"GitHub Repository",[243,251,252],{},[71,253,255],{"href":73,"rel":254},[75],"Package on NuGet",[257,258,259],"style",{},"html .dark .shiki span {color: var(--shiki-dark);background: var(--shiki-dark-bg);font-style: var(--shiki-dark-font-style);font-weight: var(--shiki-dark-font-weight);text-decoration: var(--shiki-dark-text-decoration);}html.dark .shiki span {color: var(--shiki-dark);background: var(--shiki-dark-bg);font-style: var(--shiki-dark-font-style);font-weight: var(--shiki-dark-font-weight);text-decoration: var(--shiki-dark-text-decoration);}html .default .shiki span {color: var(--shiki-default);background: var(--shiki-default-bg);font-style: var(--shiki-default-font-style);font-weight: var(--shiki-default-font-weight);text-decoration: var(--shiki-default-text-decoration);}html .shiki span {color: var(--shiki-default);background: var(--shiki-default-bg);font-style: var(--shiki-default-font-style);font-weight: var(--shiki-default-font-weight);text-decoration: var(--shiki-default-text-decoration);}",{"title":104,"searchDepth":117,"depth":117,"links":261},[262,263,264],{"id":90,"depth":117,"text":91},{"id":208,"depth":117,"text":209},{"id":237,"depth":117,"text":238},"2022-10-15T00:00:00.000Z","Overview of the new library providing FluentAssertions for CSharpFunctionalExtensions. Now available on NuGet!","md",null,{},{"title":26,"description":266},"w6rN2Xw6_uEqMgCYu09-6tusJTfXbfYfEQs8tCspas4",1786745735899]