Skip to main content
Stack Overflow
  1. About
  2. For Teams
Filter by
Sorted by
Tagged with
-3 votes
3 answers
197 views

Consider this unit test of an API client with an async function Index. Index should throw an exception when an http error occurs and thats what I want to test. public async Task TestServiceError() { ...
2 votes
1 answer
283 views

I have two classes: class ClassA { public required string Name { get; set; } } class ClassB { public required string Name { get; set; } } With FluentAssertions this test succeeds: classA....
0 votes
0 answers
35 views

I'm writing tests to make sure the output of a thing matches an expected result. The only hitch is that the actual and expected texts are about 9KB each. When the comparison fails, Shouldly cuts off ...
Lee Crabtree's user avatar
  • 1,266
1 vote
2 answers
166 views

In the following code, o[0].AccountEnabled has type bool while graphUsers[0].AccountEnabled has type bool?. Without the explicit cast to bool?, I get the following error: 'bool' does not contain a ...
Shuzheng's user avatar
  • 14.6k
1 vote
2 answers
238 views

In our project we have a test written by a former colleague that is firing a request to an end point, which should - and does - return a 500 - InternalServerError (checking for this using Shouldly) ...
2 votes
1 answer
237 views

Let's say I have a simple data class as such. public class SortMeClass { public string StringProp { get; set; } public int IntProp { get; set; } } I then take a collection of SortMeClass ...
RLH's user avatar
  • 15.8k
0 votes
1 answer
383 views

I would like to check that the string from a textbox is of format "dd-MMM-yyyy" e.g. 14-Mar-2023 I have written the following code but I get an error string date = Page.HeaderDate().Text ...
RShome's user avatar
  • 547
0 votes
1 answer
517 views

I have a method to send an email. How can I write a unit test to verify this method. I'm using MS test with shouldly public async Task SendEmail(string Id, string exception) { ...
Kumara's user avatar
  • 1
4 votes
1 answer
3k views

What are the differences (if any) between Shouldly and FluentAssertions? Can either do anything that the other one can't? Or are they functionally the same with just a different syntax? The only other ...
1 vote
1 answer
1k views

I wrote this unit test using XUnit and Shouldly. Please note that I replaced parts of the namespace, variable names, properties etc, as the customer is a large public organization. [Fact] public async ...
10 votes
1 answer
3k views

I'm using the excellent Shouldly library in my xUnit tests and I'm finding myself using the set sequence of assertions in different tests, so I'm combining them into new assertion extension methods - ...
Dai's user avatar
  • 158k
1 vote
2 answers
1k views

How can I to make a unit test check that a list of object not contains a duplicate element based on some properties. Here is what I tried to do: [Fact] public void ...
ucef's user avatar
  • 557
1 vote
1 answer
697 views

I am using a an assertion framework called Shouldly for C#. The code looks like this: [Fact] public void SimpleTest() { false.ShouldBe(true); } This is the same as: [Fact] public void ...
0 votes
1 answer
256 views

I'm trying to come up with a Resharper pattern to apply to sequential Shouldly asserts. For instance, I have these checks: field1.ShouldNotBeNull(); field2.ShouldBe(expectedField2Value); And ...
2 votes
3 answers
3k views

I have a property in a class public class User { public string FiscalCode {get; set;} } And i want test the property fiscal code with two condition. The test is ok if fiscalcode is null or ...
user3401335's user avatar
  • 2,415

15 30 50 per page
1
2

AltStyle によって変換されたページ (->オリジナル) /