Search
 
SCRIPT & CODE EXAMPLE
 

CSHARP

unit test throw exception c# xunit

[Fact]
public void ProfileRepository_GetSettingsForUserIDWithInvalidArguments_ThrowsArgumentException()
{
    //arrange
    ProfileRepository profiles = new ProfileRepository();
    //act
    Action act = () => profiles.GetSettingsForUserID("");
    //assert
    ArgumentException exception = Assert.Throws<ArgumentException>(act);
    //The thrown exception can be used for even more detailed assertions.
    Assert.Equal("expected error message here", exception.Message);
}
Comment

PREVIOUS NEXT
Code Example
Csharp :: implement custom string to datetime convert net core 
Csharp :: unity object change sprite 
Csharp :: c# latex 
Csharp :: distinct prime factors count of a number 
Csharp :: C# Unit test IConfiguration 
Csharp :: good food 
Csharp :: get last 4 character c# 
Csharp :: console reset color c# 
Csharp :: unity set mouse 
Csharp :: how to verify the scene unity 
Csharp :: unity pick random number 
Csharp :: convert string to list int c# 
Csharp :: int to bool c# 
Csharp :: c# enum to int array 
Csharp :: decimal c# 2 digits 
Csharp :: unity ui get the canvas 
Csharp :: Unity Children Destroy 
Csharp :: hide button unity 
Csharp :: camera follow script car unity 
Csharp :: csharp datagridview filter column 
Csharp :: c# cancellationtoken example 
Csharp :: weapon switching unity 
Csharp :: relative path c# 
Csharp :: linq get a dictionary key and value c# 
Csharp :: remove all array elements c# 
Csharp :: new ienumerable 
Csharp :: timespan to integer c# 
Csharp :: if statement c# 
Csharp :: c# empty array 
Csharp :: how to show an arrya in c# 
ADD CONTENT
Topic
Content
Source link
Name
4+7 =