{"id":465382,"date":"2025-07-01T15:06:42","date_gmt":"2025-07-01T15:06:42","guid":{"rendered":"http:\/\/savepearlharbor.com\/?p=465382"},"modified":"-0001-11-30T00:00:00","modified_gmt":"-0001-11-29T21:00:00","slug":"","status":"publish","type":"post","link":"https:\/\/savepearlharbor.com\/?p=465382","title":{"rendered":"<span>\u0411\u0430\u0437\u0430 \u043f\u0440\u043e \u044e\u043d\u0438\u0442-\u0442\u0435\u0441\u0442\u044b \u0432 C# \u043d\u0430 xUnit v3<\/span>"},"content":{"rendered":"<div><!--[--><!--]--><\/div>\n<div id=\"post-content-body\">\n<div>\n<div class=\"article-formatted-body article-formatted-body article-formatted-body_version-2\">\n<div xmlns=\"http:\/\/www.w3.org\/1999\/xhtml\">\n<p>\u041f\u0440\u0438\u0432\u0435\u0442, \u0425\u0430\u0431\u0440!<\/p>\n<p>\u0421\u0435\u0433\u043e\u0434\u043d\u044f \u0440\u0430\u0437\u0431\u0435\u0440\u0451\u043c\u0441\u044f \u0441\u00a0\u044e\u043d\u0438\u0442\u2011\u0442\u0435\u0441\u0442\u0430\u043c\u0438 \u0432\u00a0C# \u043d\u0430\u00a0\u043e\u0441\u043d\u043e\u0432\u0435 <strong>xUnit v3<\/strong>\u00a0\u2014 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0438, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u0441\u0442\u0430\u043b\u0430 \u043f\u0440\u0430\u043a\u0442\u0438\u0447\u0435\u0441\u043a\u0438 \u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u043e\u043c \u0434\u0435\u2011\u0444\u0430\u043a\u0442\u043e \u0432.NET\u2011\u0441\u0440\u0435\u0434\u0435. <\/p>\n<p>\u041f\u043e\u0447\u0435\u043c\u0443 \u0438\u043c\u0435\u043d\u043d\u043e xUnit? \u0412\u0441\u0451 \u043f\u0440\u043e\u0441\u0442\u043e: \u0435\u0433\u043e \u0441\u043e\u0437\u0434\u0430\u043b\u0438 \u0414\u0436\u0438\u043c \u041d\u044c\u044e\u043a\u0438\u0440\u043a \u0438 \u0411\u0440\u044d\u0434 \u0423\u0438\u043b\u0441\u043e\u043d\u00a0\u2014 \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u0438 <a href=\"https:\/\/nunit.org\/\" rel=\"noopener noreferrer nofollow\">NUnit<\/a>. \u041e\u043d\u0438 \u0440\u0435\u0448\u0438\u043b\u0438 \u0432\u044b\u043a\u0438\u043d\u0443\u0442\u044c \u0432\u0441\u044e \u0430\u0440\u0445\u0430\u0438\u043a\u0443 \u0432\u0440\u043e\u0434\u0435 <code>[SetUp]<\/code>, <code>[TearDown]<\/code> \u0438 \u043f\u0440\u043e\u0447\u0438\u0445 \u0440\u0443\u0434\u0438\u043c\u0435\u043d\u0442\u043e\u0432 \u0438 \u043f\u043e\u0441\u0442\u0440\u043e\u0438\u043b\u0438 \u0444\u0440\u0435\u0439\u043c\u0432\u043e\u0440\u043a \u0441\u00a0\u043d\u0443\u043b\u044f, \u0441\u0442\u0440\u043e\u0433\u043e \u043f\u043e\u0434\u00a0TDD. \u0412\u0435\u0441\u043d\u043e\u0439 \u0432\u044b\u0448\u043b\u0430 <strong>xUnit v3 2.0.2<\/strong>, \u0432\u00a0\u043a\u043e\u0442\u043e\u0440\u043e\u0439 \u0437\u0430\u0432\u0435\u0437\u043b\u0438 <code>Assert.MultipleAsync<\/code>, \u043f\u043e\u043b\u043d\u043e\u0441\u0442\u044c\u044e \u043e\u0431\u043d\u043e\u0432\u0438\u043b\u0438 \u0441\u0435\u0440\u0438\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044e. \u0410\u00a0\u0432.NET 9\u00a0\u0443\u0436\u0435 \u0448\u0442\u0430\u0442\u043d\u043e \u043f\u0440\u043e\u0434\u0432\u0438\u0433\u0430\u0435\u0442\u0441\u044f <strong>Microsoft.Testing.Platform (MTP)<\/strong>\u00a0\u2014 \u0441\u0432\u0435\u0440\u0445\u043b\u0451\u0433\u043a\u0438\u0439 \u0442\u0435\u0441\u0442\u043e\u0432\u044b\u0439 \u0440\u0430\u043d\u0442\u0430\u0439\u043c, \u0441\u00a0\u043a\u043e\u0442\u043e\u0440\u044b\u043c xUnit v3\u00a0\u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442 \u043f\u0440\u044f\u043c\u043e \u0438\u0437\u00a0\u043a\u043e\u0440\u043e\u0431\u043a\u0438. \u041a\u043e\u0440\u043e\u0447\u0435 \u0433\u043e\u0432\u043e\u0440\u044f, \u044d\u0442\u043e \u0441\u0430\u043c\u044b\u0439 \u043d\u0430\u0442\u0438\u0432\u043d\u044b\u0439 \u0432\u044b\u0431\u043e\u0440 \u043f\u043e\u0434.NET 9\u00a0\u043d\u0430\u00a0\u0441\u0435\u0433\u043e\u0434\u043d\u044f.<\/p>\n<h3>\u0423\u0441\u0442\u0430\u043d\u0430\u0432\u043b\u0438\u0432\u0430\u0435\u043c \u0438\u043d\u0441\u0442\u0440\u0443\u043c\u0435\u043d\u0442\u044b<\/h3>\n<pre><code class=\"bash\"># \u043e\u0431\u043d\u043e\u0432\u043b\u044f\u0435\u043c \u0442\u0435\u043c\u043f\u043b\u0435\u0439\u0442\u044b \u0434\u043e v3 dotnet new install xunit.v3.templates dotnet new update  # \u0441\u043e\u0437\u0434\u0430\u0451\u043c \u0440\u0435\u0448\u0435\u043d\u0438\u0435 dotnet new sln -n DemoSolution dotnet new console -n DemoApp -o src\/DemoApp dotnet new xunit3   -n DemoApp.Tests -o test\/DemoApp.Tests dotnet sln add src\/DemoApp\/DemoApp.csproj dotnet sln add test\/DemoApp.Tests\/DemoApp.Tests.csproj<\/code><\/pre>\n<p>\u0428\u0430\u0431\u043b\u043e\u043d <code>xunit3<\/code> \u0443\u0436\u0435 \u043f\u043e\u0434\u0442\u044f\u043d\u0435\u0442:<\/p>\n<ul>\n<li>\n<p><code>xunit.v3<\/code>\u00a0\u2014 \u044f\u0434\u0440\u043e;<\/p>\n<\/li>\n<li>\n<p><code>xunit.v3.assert<\/code>\u00a0\u2014 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0443 \u0430\u0441\u0441\u0435\u0440\u0442\u043e\u0432;<\/p>\n<\/li>\n<li>\n<p><code>xunit.runner.visualstudio<\/code>\u00a0\u2014 \u0430\u0434\u0430\u043f\u0442\u0435\u0440 \u043f\u043e\u0434 <code>dotnet test<\/code>.<\/p>\n<\/li>\n<\/ul>\n<p>\u0412\u0441\u0451 \u044d\u0442\u043e \u043f\u043e\u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0431\u043b\u0430\u0433\u043e\u0434\u0430\u0440\u044f \u043d\u043e\u0432\u043e\u043c\u0443 \u043d\u0430\u0431\u043e\u0440\u0430 \u0442\u0435\u043c\u043f\u043b\u0435\u0439\u0442\u043e\u0432, \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u043d\u043e\u043c\u0443 \u0432\u00a0v3.<\/p>\n<h3>\u0410\u043d\u0430\u0442\u043e\u043c\u0438\u044f \u0442\u0435\u0441\u0442\u0430: [Fact] \u0438 [Theory]<\/h3>\n<h4>[Fact] \u2014 \u043e\u0434\u0438\u043d \u0441\u0446\u0435\u043d\u0430\u0440\u0438\u0439, \u043e\u0434\u0438\u043d \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442<\/h4>\n<pre><code class=\"cs\">public class CalculatorTests {     [Fact]     public void Add_ReturnsSum_WhenNumbersArePositive()     {         \/\/ Arrange         var calc = new Calculator();          \/\/ Act         var result = calc.Add(2, 3);          \/\/ Assert         Assert.Equal(5, result);     } }<\/code><\/pre>\n<h4>[Theory] \u2014 \u0434\u0430\u0435\u0448\u044c \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u0438\u0437\u0430\u0446\u0438\u044e<\/h4>\n<pre><code class=\"cs\">[Theory] [InlineData(2, 3, 5)] [InlineData(-2, -3, -5)] public void Add_Works_ForMultiplePairs(int a, int b, int expected) {     var calc = new Calculator();     Assert.Equal(expected, calc.Add(a, b)); }<\/code><\/pre>\n<p><code>InlineData<\/code>\u00a0\u2014 \u0441\u0430\u043c\u044b\u0439\u00a0\u0431\u044b\u0441\u0442\u0440\u044b\u0439 \u043f\u0443\u0442\u044c. \u0415\u0441\u043b\u0438 \u0434\u0430\u043d\u043d\u044b\u0445 \u043c\u043d\u043e\u0433\u043e\u00a0\u2014 <code>MemberData<\/code> \u0438\u043b\u0438 <code>ClassData<\/code> (\u043b\u0435\u043d\u0438\u0432\u043e\u0435 \u043f\u0435\u0440\u0435\u0447\u0438\u0441\u043b\u0435\u043d\u0438\u0435, \u0442\u0430\u043a \u0447\u0442\u043e\u00a0\u043f\u0430\u043c\u044f\u0442\u0438 \u043d\u0435\u00a0\u0436\u0430\u043b\u043a\u043e).<\/p>\n<h3>AAA<\/h3>\n<p><strong>AAA<\/strong>\u00a0\u2014 \u044d\u0442\u043e \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0430 \u043d\u0430\u043f\u0438\u0441\u0430\u043d\u0438\u044f \u044e\u043d\u0438\u0442\u2011\u0442\u0435\u0441\u0442\u0430, \u0430\u0431\u0431\u0440\u0435\u0432\u0438\u0430\u0442\u0443\u0440\u0430 \u043e\u0442:<\/p>\n<ul>\n<li>\n<p><strong>Arrange<\/strong>\u00a0\u2014 \u043f\u043e\u0434\u0433\u043e\u0442\u043e\u0432\u043a\u0430 \u0442\u0435\u0441\u0442\u043e\u0432\u043e\u0433\u043e \u043e\u043a\u0440\u0443\u0436\u0435\u043d\u0438\u044f;<\/p>\n<\/li>\n<li>\n<p><strong>Act<\/strong>\u00a0\u2014 \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u0435 \u0442\u0435\u0441\u0442\u0438\u0440\u0443\u0435\u043c\u043e\u0433\u043e \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u044f;<\/p>\n<\/li>\n<li>\n<p><strong>Assert<\/strong>\u00a0\u2014 \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0430 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u0430.<\/p>\n<\/li>\n<\/ul>\n<p>\u041f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u0438\u043c \u0441\u0446\u0435\u043d\u0430\u0440\u0438\u0439, \u0433\u0434\u0435<strong> \u0441\u0435\u0440\u0432\u0438\u0441 \u043d\u0430\u0447\u0438\u0441\u043b\u044f\u0435\u0442 \u0431\u043e\u043d\u0443\u0441\u043d\u044b\u0435 \u0431\u0430\u043b\u043b\u044b<\/strong> \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044e \u043f\u0440\u0438\u00a0\u043f\u043e\u043a\u0443\u043f\u043a\u0435. \u0415\u0441\u043b\u0438 \u043f\u043e\u043a\u0443\u043f\u043a\u0430 \u0431\u043e\u043b\u044c\u0448\u0435 500\u20bd\u00a0\u2014 \u043d\u0430\u0447\u0438\u0441\u043b\u044f\u0435\u0442\u0441\u044f 10% \u043e\u0442\u00a0\u0441\u0443\u043c\u043c\u044b. \u0415\u0441\u043b\u0438 \u043c\u0435\u043d\u044c\u0448\u0435\u00a0\u2014 5%. \u0411\u0430\u043b\u043b\u044b \u043e\u0442\u043f\u0440\u0430\u0432\u043b\u044f\u044e\u0442\u0441\u044f \u0432\u00a0\u0445\u0440\u0430\u043d\u0438\u043b\u0438\u0449\u0435.<\/p>\n<p><strong>\u041a\u043e\u0434 \u0441\u0435\u0440\u0432\u0438\u0441\u0430:<\/strong><\/p>\n<pre><code class=\"cs\">public interface IBonusRepository {     void AddPoints(int userId, int points); }  public class BonusService {     private readonly IBonusRepository _repository;      public BonusService(IBonusRepository repository)         =&gt; _repository = repository;      public void ProcessPurchase(int userId, decimal amount)     {         if (amount &lt;= 0)             throw new ArgumentException(\"Amount must be positive\");          int points = amount &gt;= 500             ? (int)(amount * 0.10m)             : (int)(amount * 0.05m);          _repository.AddPoints(userId, points);     } }<\/code><\/pre>\n<p><strong>\u041e\u0434\u0438\u043d \u043c\u043e\u0449\u043d\u044b\u0439, \u0441\u0430\u043c\u043e\u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u044b\u0439 \u0442\u0435\u0441\u0442 \u0441\u00a0AAA:<\/strong><\/p>\n<pre><code class=\"cs\">public class BonusServiceTests {     [Fact]     public void ProcessPurchase_AmountOverThreshold_AddsTenPercentBonus()     {         \/\/ Arrange         var mockRepo = new Mock&lt;IBonusRepository&gt;();         var service = new BonusService(mockRepo.Object);          int userId = 42;         decimal purchaseAmount = 600m;         int expectedPoints = 60; \/\/ 10% \u043e\u0442 600          \/\/ Act         service.ProcessPurchase(userId, purchaseAmount);          \/\/ Assert         mockRepo.Verify(r =&gt; r.AddPoints(userId, expectedPoints), Times.Once);     } }<\/code><\/pre>\n<h3>\u0414\u0440\u0443\u0436\u0438\u043c xUnit \u0441 Moq<\/h3>\n<pre><code class=\"cs\">var userRepo = new Mock&lt;IUserRepository&gt;(); userRepo.Setup(r =&gt; r.GetByIdAsync(42))         .ReturnsAsync(new User { Id = 42, Name = \"Neo\" });  var service = new UserService(userRepo.Object);  var result = await service.GetName(42);  Assert.Equal(\"Neo\", result); userRepo.Verify(r =&gt; r.GetByIdAsync(42), Times.Once);<\/code><\/pre>\n<p>Moq \u043e\u0441\u0442\u0430\u0451\u0442\u0441\u044f \u0441\u0430\u043c\u044b\u043c \u043f\u043e\u043f\u0443\u043b\u044f\u0440\u043d\u044b\u043c. \u0415\u0449\u0435 \u043c\u043e\u0436\u043d\u043e \u0441\u0432\u0438\u0447\u043d\u0443\u0442\u044c\u0441\u044f \u043d\u0430 <code>NSubstitute<\/code>, API \u043f\u043e\u0447\u0442\u0438 1-\u0432-1.<\/p>\n<h3>\u0414\u0435\u043b\u0438\u043c \u0442\u044f\u0436\u0435\u043b\u044b\u0439 \u0441\u0435\u0442\u0430\u043f \u043c\u0435\u0436\u0434\u0443 \u0442\u0435\u0441\u0442\u0430\u043c\u0438<\/h3>\n<p>\u0418\u043d\u043e\u0433\u0434\u0430 <strong>\u043a\u043e\u043d\u0441\u0442\u0440\u0443\u043a\u0442\u043e\u0440 \u0442\u0435\u0441\u0442\u2011\u043a\u043b\u0430\u0441\u0441\u0430<\/strong> (\u0432 xUnit \u044d\u0442\u043e Setup) \u043f\u0435\u0440\u0435\u0433\u0440\u0435\u0432\u0430\u0435\u0442\u0441\u044f. \u0422\u043e\u0433\u0434\u0430 \u0431\u0435\u0440\u0435\u043c <code>IClassFixture&lt;T&gt;<\/code>:<\/p>\n<pre><code class=\"cs\">public class DatabaseFixture : IDisposable {     public SqliteConnection Connection { get; }      public DatabaseFixture()     {         Connection = new SqliteConnection(\"DataSource=:memory:\");         Connection.Open();         new Schema().Create(Connection); \/\/ \u043c\u0438\u0433\u0440\u0430\u0446\u0438\u0438     }      public void Dispose() =&gt; Connection.Dispose(); }  public class UserRepositoryTests : IClassFixture&lt;DatabaseFixture&gt; {     private readonly DatabaseFixture _fixture;      public UserRepositoryTests(DatabaseFixture fixture)         =&gt; _fixture = fixture;      [Fact]     public async Task Save_And_Load_Roundtrip()     {         var repo = new UserRepository(_fixture.Connection);         var user = new User { Name = \"Trinity\" };          await repo.Save(user);         var loaded = await repo.Load(user.Id);          Assert.Equal(\"Trinity\", loaded.Name);     } }<\/code><\/pre>\n<p>\u0424\u0438\u043a\u0441\u0442\u0443\u0440\u0430 \u0441\u043e\u0437\u0434\u0430\u0451\u0442\u0441\u044f <strong>\u043e\u0434\u0438\u043d \u0440\u0430\u0437<\/strong> \u043d\u0430\u00a0\u043a\u043b\u0430\u0441\u0441, \u0447\u0438\u0441\u0442\u0438\u0442\u0441\u044f \u0432 <code>Dispose<\/code>\u00a0\u2014 \u043d\u0438\u043a\u0430\u043a\u043e\u0439 \u0443\u0441\u043b\u043e\u0432\u043d\u043e\u0439 \u043b\u043e\u0433\u0438\u043a\u0438 \u0432\u00a0\u0442\u0435\u0441\u0442\u0430\u0445. \u0414\u043b\u044f\u00a0\u0448\u0430\u0440\u0438\u043d\u0433\u0430 \u043c\u0435\u0436\u0434\u0443 \u043a\u043b\u0430\u0441\u0441\u0430\u043c\u0438\u00a0\u2014 <code>CollectionFixture<\/code>, \u0430\u00a0\u0435\u0441\u043b\u0438 \u043d\u0443\u0436\u0435\u043d DI\u2011style startup (Kafka, Redis)\u00a0\u2014 \u0441\u043c\u043e\u0442\u0440\u0438\u0442\u0435 Testcontainers.<\/p>\n<h3>\u0410\u0441\u0438\u043d\u0445\u0440\u043e\u043d\u043d\u043e\u0441\u0442\u044c<\/h3>\n<p><strong>xUnit \u0438\u0437\u043d\u0430\u0447\u0430\u043b\u044c\u043d\u043e \u043f\u0440\u043e\u0435\u043a\u0442\u0438\u0440\u043e\u0432\u0430\u043b\u0441\u044f \u0441\u00a0\u043f\u043e\u0434\u0434\u0435\u0440\u0436\u043a\u043e\u0439 <\/strong><code><strong>async<\/strong><\/code><strong>\/<\/strong><code><strong>await<\/strong><\/code>, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u043e\u043d \u043d\u0435\u00a0\u0442\u0440\u0435\u0431\u0443\u0435\u0442 \u043d\u0438\u043a\u0430\u043a\u0438\u0445 \u0442\u0430\u043d\u0446\u0435\u0432 \u0441\u00a0\u0431\u0443\u0431\u043d\u043e\u043c, \u0447\u0442\u043e\u0431\u044b \u043f\u0438\u0441\u0430\u0442\u044c \u0430\u0441\u0438\u043d\u0445\u0440\u043e\u043d\u043d\u044b\u0435 \u0442\u0435\u0441\u0442\u044b. \u0414\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e \u0432\u0435\u0440\u043d\u0443\u0442\u044c <code>Task<\/code> (\u0438\u043b\u0438 <code>ValueTask<\/code> \u0432.NET 7+) \u0438\u0437\u00a0\u043c\u0435\u0442\u043e\u0434\u0430, \u0438 \u0444\u0440\u0435\u0439\u043c\u0432\u043e\u0440\u043a \u0434\u043e\u0436\u0434\u0435\u0442\u0441\u044f \u0437\u0430\u0432\u0435\u0440\u0448\u0435\u043d\u0438\u044f \u0432\u0441\u0435\u0439 \u0446\u0435\u043f\u043e\u0447\u043a\u0438.<\/p>\n<p><strong>\u0411\u0430\u0437\u043e\u0432\u044b\u0439 \u0441\u0438\u043d\u0442\u0430\u043a\u0441\u0438\u0441 \u043f\u0440\u043e\u0441\u0442 \u0438 \u0438\u0434\u0435\u043d\u0442\u0438\u0447\u0435\u043d \u043e\u0431\u044b\u0447\u043d\u043e\u043c\u0443 \u043a\u043e\u0434\u0443:<\/strong><\/p>\n<pre><code class=\"cs\">[Fact] public async Task GetDataAsync_ReturnsExpectedResult() {     var sut = new DataService();      var result = await sut.GetDataAsync();      Assert.Equal(\"expected\", result); }<\/code><\/pre>\n<p>xUnit \u043f\u043e\u043b\u043d\u043e\u0441\u0442\u044c\u044e \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u0438\u0432\u0430\u0435\u0442 <code>await<\/code> \u0432\u00a0\u0442\u0435\u043b\u0435 \u0442\u0435\u0441\u0442\u0430\u00a0\u2014 \u043c\u043e\u0436\u043d\u043e \u0441\u043f\u043e\u043a\u043e\u0439\u043d\u043e \u043f\u0438\u0441\u0430\u0442\u044c \u0430\u0441\u0438\u043d\u0445\u0440\u043e\u043d\u043d\u0443\u044e \u043f\u043e\u0434\u0433\u043e\u0442\u043e\u0432\u043a\u0443, \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u044f \u0438 \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0438 \u0431\u0435\u0437 <code>.Result<\/code> \u0438 <code>.Wait()<\/code>, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0447\u0430\u0441\u0442\u043e \u0441\u0442\u0430\u043d\u043e\u0432\u044f\u0442\u0441\u044f \u043f\u0440\u0438\u0447\u0438\u043d\u043e\u0439 deadlock&#8217;\u043e\u0432.<\/p>\n<p><strong>\u0414\u043b\u044f\u00a0\u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0438 \u0432\u044b\u0431\u0440\u0430\u0441\u044b\u0432\u0430\u0435\u043c\u044b\u0445 \u0438\u0441\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0439 \u0432\u00a0\u0430\u0441\u0438\u043d\u0445\u0440\u043e\u043d\u043d\u044b\u0445 \u043c\u0435\u0442\u043e\u0434\u0430\u0445 \u0435\u0441\u0442\u044c \u043c\u0435\u0442\u043e\u0434 <\/strong><code><strong>Assert.ThrowsAsync&lt;T&gt;()<\/strong><\/code><strong>:<\/strong><\/p>\n<pre><code class=\"cs\">await Assert.ThrowsAsync&lt;InvalidOperationException&gt;(() =&gt;     sut.DoWeirdStuffAsync());<\/code><\/pre>\n<p>\u041d\u0435\u00a0\u0437\u0430\u0431\u044b\u0432\u0430\u0439\u0442\u0435 <strong>\u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0442\u044c <\/strong><code><strong>Task<\/strong><\/code><strong> \u0438\u0437\u00a0\u0442\u0435\u0441\u0442\u0430<\/strong>\u00a0\u2014 \u0438\u043d\u0430\u0447\u0435 xUnit \u043d\u0435\u00a0\u0434\u043e\u0436\u0434\u0435\u0442\u0441\u044f <code>await<\/code>, \u0438 \u0438\u0441\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435 \u043f\u0440\u043e\u0441\u0442\u043e \u043f\u0440\u043e\u0433\u043b\u043e\u0442\u0438\u0442\u0441\u044f \u0444\u0440\u0435\u0439\u043c\u0432\u043e\u0440\u043a\u043e\u043c. \u0422.\u0435 \u043a\u043e\u043d\u0441\u0442\u0440\u0443\u043a\u0446\u0438\u044f <code>Assert.ThrowsAsync(...).Wait()<\/code>\u00a0\u2014 \u044d\u0442\u043e \u043f\u043b\u043e\u0445\u043e\u0439 \u0442\u043e\u043d.<\/p>\n<p><strong>\u0412\u00a0\u0430\u0441\u0438\u043d\u0445\u0440\u043e\u043d\u043d\u044b\u0445 \u0442\u0435\u0441\u0442\u0430\u0445 \u043c\u043e\u0436\u043d\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c <\/strong><code><strong>Moq<\/strong><\/code><strong> \u0438 \u0435\u0433\u043e <\/strong><code><strong>ReturnsAsync<\/strong><\/code><strong>, <\/strong><code><strong>CallbackAsync<\/strong><\/code><strong>, <\/strong><code><strong>SetupSequence()<\/strong><\/code><strong> \u0434\u043b\u044f\u00a0\u0441\u0438\u043c\u0443\u043b\u044f\u0446\u0438\u0438 \u0440\u0430\u0437\u043d\u044b\u0445 \u0441\u0446\u0435\u043d\u0430\u0440\u0438\u0435\u0432:<\/strong><\/p>\n<pre><code class=\"cs\">mockRepo.Setup(x =&gt; x.LoadAsync(It.IsAny&lt;int&gt;()))         .ReturnsAsync(new User { Id = 1 });<\/code><\/pre>\n<p>\u041c\u043e\u0436\u043d\u043e \u0441\u0442\u0440\u043e\u0438\u0442\u044c \u0441\u043b\u043e\u0436\u043d\u044b\u0435 \u0442\u0435\u0441\u0442\u043e\u0432\u044b\u0435 \u0441\u0438\u0442\u0443\u0430\u0446\u0438\u0438 \u0441\u00a0\u0438\u043c\u0438\u0442\u0430\u0446\u0438\u0435\u0439 \u0437\u0430\u0434\u0435\u0440\u0436\u0435\u043a, \u0441\u0431\u043e\u0435\u0432, \u043f\u0435\u0440\u0435\u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u0435\u043c \u043e\u0442\u0432\u0435\u0442\u043e\u0432 \u043e\u0442\u00a0\u0432\u043d\u0435\u0448\u043d\u0438\u0445 \u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0441\u0442\u0435\u0439.<\/p>\n<p><strong>\u0410\u00a0\u0435\u0441\u043b\u0438 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0435 \u0444\u0438\u043a\u0441\u0442\u0443\u0440\u044b, \u0438\u043d\u0438\u0446\u0438\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044f \u043a\u043e\u0442\u043e\u0440\u044b\u0445 \u0437\u0430\u0432\u0438\u0441\u0438\u0442 \u043e\u0442 <\/strong><code><strong>async<\/strong><\/code><strong>, xUnit \u043d\u0435\u00a0\u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c <\/strong><code><strong>async<\/strong><\/code><strong> \u0432\u00a0\u043a\u043e\u043d\u0441\u0442\u0440\u0443\u043a\u0442\u043e\u0440\u0430\u0445 \u0438\u043b\u0438 <\/strong><code><strong>IDisposableAsync<\/strong><\/code><strong>.<\/strong> \u0412\u00a0\u0442\u0430\u043a\u0438\u0445 \u0441\u043b\u0443\u0447\u0430\u044f\u0445 \u0440\u0435\u043a\u043e\u043c\u0435\u043d\u0434\u0443\u0435\u0442\u0441\u044f \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c <code>IAsyncLifetime<\/code>, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0434\u0430\u0435\u0442 \u0434\u0432\u0430 \u043c\u0435\u0442\u043e\u0434\u0430: <code>InitializeAsync()<\/code> \u0438 <code>DisposeAsync()<\/code>\u00a0\u2014 \u043e\u043d\u0438 \u0432\u044b\u0437\u044b\u0432\u0430\u044e\u0442\u0441\u044f \u0434\u043e\u00a0\u0438 \u043f\u043e\u0441\u043b\u0435 \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f \u0432\u0441\u0435\u0445 \u0442\u0435\u0441\u0442\u043e\u0432 \u0432\u00a0\u043a\u043b\u0430\u0441\u0441\u0435:<\/p>\n<pre><code class=\"cs\">public class MyFixture : IAsyncLifetime {     public async Task InitializeAsync() { ... }     public async Task DisposeAsync() { ... } }<\/code><\/pre>\n<h3>\u0424\u0438\u0447\u0438 v3<\/h3>\n<p><strong>\u0414\u0438\u043d\u0430\u043c\u0438\u0447\u0435\u0441\u043a\u0438\u0439 skip<\/strong><\/p>\n<p>\u041d\u043e\u0432\u0430\u044f \u043f\u0430\u0440\u0430 \u0430\u0442\u0440\u0438\u0431\u0443\u0442\u043e\u0432 <code>[SkipWhen]<\/code> \u0438 <code>[SkipUnless]<\/code> \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u043f\u0440\u0438\u043d\u0438\u043c\u0430\u0442\u044c \u0440\u0435\u0448\u0435\u043d\u0438\u0435 \u043e\u00a0\u043f\u0440\u043e\u043f\u0443\u0441\u043a\u0435 \u0432\u043e\u00a0\u0432\u0440\u0435\u043c\u044f \u0438\u0441\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f, \u0430\u00a0\u043d\u0435\u00a0\u043d\u0430\u00a0\u043c\u043e\u043c\u0435\u043d\u0442 \u043a\u043e\u043c\u043f\u0438\u043b\u044f\u0446\u0438\u0438. \u0422\u0438\u043f\u043e\u0432\u043e\u0439 \u0441\u0446\u0435\u043d\u0430\u0440\u0438\u0439\u00a0\u2014 \u043e\u0442\u043a\u043b\u044e\u0447\u0438\u0442\u044c \u0442\u0435\u0441\u0442 \u0432\u00a0Windows\u2011\u0430\u0433\u0435\u043d\u0442\u0435, \u043d\u043e\u00a0\u0437\u0430\u043f\u0443\u0441\u0442\u0438\u0442\u044c \u0432\u00a0Linux\u2011\u043a\u043e\u043d\u0442\u0435\u0439\u043d\u0435\u0440\u0435:<\/p>\n<pre><code class=\"cs\">[Fact(SkipUnless = nameof(IsLinux))] static bool IsLinux =&gt; OperatingSystem.IsLinux();<\/code><\/pre>\n<p>\u0415\u0441\u043b\u0438 \u0432\u044b\u0440\u0430\u0436\u0435\u043d\u0438\u0435 \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u0442 <code>false<\/code>, \u0444\u0440\u0435\u0439\u043c\u0432\u043e\u0440\u043a \u043f\u043e\u043c\u0435\u0447\u0430\u0435\u0442 \u0442\u0435\u0441\u0442 \u043a\u0430\u043a\u00a0Skipped. \u0412\u043d\u0443\u0442\u0440\u0438 \u0430\u0442\u0440\u0438\u0431\u0443\u0442 \u0432\u044b\u0437\u044b\u0432\u0430\u0435\u0442 <code>Assert.Skip(\"\u2026\")<\/code>, \u0442\u0430\u043a \u0447\u0442\u043e\u00a0\u043f\u0440\u0438\u0447\u0438\u043d\u0443 \u043c\u043e\u0436\u043d\u043e \u0444\u043e\u0440\u043c\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0434\u0438\u043d\u0430\u043c\u0438\u0447\u0435\u0441\u043a\u0438. \u041d\u0430\u00a0CI \u043f\u043e\u0432\u0435\u0434\u0435\u043d\u0438\u0435 \u043c\u043e\u0436\u043d\u043e \u0443\u0436\u0435\u0441\u0442\u043e\u0447\u0438\u0442\u044c: <code>dotnet test --fail-skips<\/code> \u043f\u0435\u0440\u0435\u0432\u0435\u0434\u0435\u0442 \u043b\u044e\u0431\u043e\u0439 skip \u0432\u00a0Fail, \u0447\u0442\u043e\u0431\u044b \u0441\u043b\u0443\u0447\u0430\u0439\u043d\u043e \u043d\u0435\u00a0\u043f\u0440\u044f\u0442\u0430\u0442\u044c \u0432\u0430\u0436\u043d\u044b\u0435 \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0438. <\/p>\n<p><strong>Explicit\u2011\u0442\u0435\u0441\u0442\u044b<\/strong><\/p>\n<p>\u0422\u0435\u043f\u0435\u0440\u044c \u043c\u043e\u0436\u043d\u043e \u043e\u0431\u044a\u044f\u0432\u0438\u0442\u044c \u0442\u0435\u0441\u0442 \u00ab\u044f\u0432\u043d\u044b\u043c\u00bb \u0438 \u0437\u0430\u043f\u0443\u0441\u043a\u0430\u0442\u044c \u0435\u0433\u043e \u0442\u043e\u043b\u044c\u043a\u043e \u043f\u043e\u00a0\u0442\u0440\u0435\u0431\u043e\u0432\u0430\u043d\u0438\u044e. \u0414\u0435\u043b\u0430\u0435\u0442\u0441\u044f \u043e\u0434\u043d\u043e\u0439 \u0441\u0442\u0440\u043e\u043a\u043e\u0439:<\/p>\n<pre><code class=\"cs\">[Fact(Explicit = true, Reason = \"\u0414\u043e\u043b\u0433\u043e \u0433\u043e\u043d\u044f\u0435\u0442 \u0432\u043d\u0435\u0448\u043d\u044e\u044e \u0411\u0414\")] public async Task Migration_EndToEnd() { \u2026 }<\/code><\/pre>\n<p>\u041f\u043e\u00a0\u0443\u043c\u043e\u043b\u0447\u0430\u043d\u0438\u044e \u0442\u0430\u043a\u0438\u0435 \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0438 \u043f\u0440\u043e\u043f\u0443\u0441\u043a\u0430\u044e\u0442\u0441\u044f. \u0427\u0442\u043e\u0431\u044b \u0438\u0445 \u0432\u044b\u043f\u043e\u043b\u043d\u0438\u0442\u044c, \u043f\u0435\u0440\u0435\u0434\u0430\u0439\u0442\u0435 <code>--explicit on<\/code> (\u0438\u043b\u0438 \u0432\u043a\u043b\u044e\u0447\u0438\u0442\u0435 \u0433\u0430\u043b\u043a\u0443 \u00abRun explicit tests\u00bb \u0432\u00a0IDE). <\/p>\n<p><strong>Query filter\u00a0\u2014 \u044f\u0437\u044b\u043a \u0432\u044b\u0431\u043e\u0440\u043a\u0438<\/strong><\/p>\n<p>\u0421\u0442\u0430\u0440\u043e\u0435 <code>--filter FullyQualifiedName~Calculate<\/code> \u043e\u0441\u0442\u0430\u043b\u043e\u0441\u044c, \u043d\u043e\u00a0\u0440\u044f\u0434\u043e\u043c \u043f\u043e\u044f\u0432\u0438\u043b\u0441\u044f \u0434\u0435\u043a\u043b\u0430\u0440\u0430\u0442\u0438\u0432\u043d\u044b\u0439 DSL:<\/p>\n<pre><code class=\"bash\">dotnet test -filter \"class==*Order* &amp;&amp; trait!=Slow\"<\/code><\/pre>\n<p>\u041c\u043e\u0436\u043d\u043e \u043a\u043e\u043c\u0431\u0438\u043d\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0443\u0441\u043b\u043e\u0432\u0438\u044f \u043f\u043e\u00a0\u0438\u043c\u0435\u043d\u0438, \u043f\u0440\u043e\u0441\u0442\u0440\u0430\u043d\u0441\u0442\u0432\u0443 \u0438\u043c\u0435\u043d, <code>Trait<\/code>, \u043a\u0430\u0442\u0435\u0433\u043e\u0440\u0438\u0438, \u0432\u0440\u0435\u043c\u0435\u043d\u0438 \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f, \u0438 \u044d\u0442\u043e \u0447\u0438\u0442\u0430\u0435\u0442\u0441\u044f \u043a\u0443\u0434\u0430 \u043f\u043e\u043d\u044f\u0442\u043d\u0435\u0435, \u0447\u0435\u043c \u0440\u0435\u0433\u0443\u043b\u044f\u0440\u043d\u044b\u0435 \u0432\u044b\u0440\u0430\u0436\u0435\u043d\u0438\u044f. DSL \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u0438\u0432\u0430\u0435\u0442\u0441\u044f \u043a\u0430\u043a\u00a0\u0432\u00a0CLI, \u0442\u0430\u043a \u0438 \u0432\u00a0VS Test Explorer.<\/p>\n<p><code><strong>TestContext<\/strong><\/code><strong> \u0438 CancellationToken<\/strong><\/p>\n<p>\u0412\u00a0v3\u00a0\u043a\u0430\u0436\u0434\u044b\u0439 \u0442\u0435\u0441\u0442 \u043f\u043e\u043b\u0443\u0447\u0430\u0435\u0442 \u0431\u0435\u0437\u043e\u043f\u0430\u0441\u043d\u044b\u0439 \u043a\u0430\u043d\u0430\u043b \u043a\u00a0\u043e\u043a\u0440\u0443\u0436\u0435\u043d\u0438\u044e:<\/p>\n<pre><code class=\"cs\">await Task.Delay(30_000, TestContext.Current.CancellationToken); TestContext.Current.AddResultFile(\"out.log\");<\/code><\/pre>\n<p><code>CancellationToken<\/code> \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u043f\u0440\u0435\u0440\u044b\u0432\u0430\u0442\u044c \u0434\u043e\u043b\u0433\u0438\u0435 \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u0438, \u043a\u043e\u0433\u0434\u0430 \u0440\u0430\u043d\u043d\u0435\u0440 \u043e\u0441\u0442\u0430\u043d\u0430\u0432\u043b\u0438\u0432\u0430\u0435\u0442 \u0441\u0435\u0441\u0441\u0438\u044e. <code>AddResultFile<\/code> \u043f\u0440\u0438\u043a\u0440\u0435\u043f\u043b\u044f\u0435\u0442 \u0430\u0440\u0442\u0435\u0444\u0430\u043a\u0442\u044b (\u043b\u043e\u0433\u0438, \u0441\u043a\u0440\u0438\u043d\u0448\u043e\u0442\u044b) \u043a\u00a0\u043e\u0442\u0447\u0435\u0442\u0443, \u0438 \u0438\u0445 \u043c\u043e\u0436\u043d\u043e \u0441\u043a\u0430\u0447\u0430\u0442\u044c \u043f\u0440\u044f\u043c\u043e \u0438\u0437\u00a0\u0441\u0431\u043e\u0440\u043a\u0438 \u0432\u00a0CI.<\/p>\n<p>\u0414\u043b\u044f\u00a0\u0430\u0441\u0438\u043d\u0445\u0440\u043e\u043d\u043d\u044b\u0445 \u0444\u0438\u043a\u0441\u0442\u0443\u0440 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f <code>IAsyncLifetime<\/code>, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0442\u0435\u043f\u0435\u0440\u044c \u0442\u043e\u0436\u0435 \u0432\u0438\u0434\u0438\u0442 \u0442\u043e\u0442\u00a0\u0436\u0435 <code>CancellationToken<\/code>, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u0441\u0435\u0442\u0430\u043f\/\u0442\u0438\u0430\u0440\u0434\u0430\u0443\u043d \u0437\u0430\u0432\u0435\u0440\u0448\u0430\u044e\u0442\u0441\u044f \u0430\u043a\u043a\u0443\u0440\u0430\u0442\u043d\u043e.<\/p>\n<hr\/>\n<p>xUnit v3\u00a0\u0437\u0430\u043a\u0440\u044b\u0432\u0430\u0435\u0442 \u043f\u043e\u043b\u043d\u044b\u0439 \u0446\u0438\u043a\u043b \u044e\u043d\u0438\u0442\u2011\u0442\u0435\u0441\u0442\u043e\u0432 \u043f\u043e\u0434.NET 9: \u043f\u043e\u043d\u044f\u0442\u043d\u0430\u044f \u043c\u043e\u0434\u0435\u043b\u044c <code>[Fact]\/[Theory]<\/code>, \u0441\u0442\u0440\u043e\u0433\u0430\u044f \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0430 AAA, \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u043a\u0430 <code>async\/await<\/code>, DI\u2011\u0444\u0438\u043a\u0441\u00ad\u0442\u0443\u0440\u044b \u0438 \u0441\u0432\u0435\u0436\u0438\u0435 \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u0438\u00a0\u2014 \u0434\u0438\u043d\u0430\u043c\u0438\u0447\u0435\u0441\u043a\u0438\u0439 skip, explicit\u2011\u0437\u0430\u043f\u0443\u0441\u043a\u0438, query\u2011\u0444\u0438\u043b\u044c\u0442\u0440\u044b \u0438 <code>TestContext<\/code> \u0441\u00a0\u0442\u043e\u043a\u0435\u043d\u043e\u043c \u043e\u0442\u043c\u0435\u043d\u044b. <\/p>\n<p>\u0412\u043d\u0435\u0434\u0440\u044f\u0439\u0442\u0435 \u0448\u0430\u0431\u043b\u043e\u043d <code>xunit3<\/code>, \u0434\u0435\u0440\u0436\u0438\u0442\u0435 \u043f\u043e\u043a\u0440\u044b\u0442\u0438\u0435 \u043d\u0430\u00a0\u0443\u0440\u043e\u0432\u043d\u0435 \u043f\u043e\u043b\u0435\u0437\u043d\u044b\u0445 \u0441\u0446\u0435\u043d\u0430\u0440\u0438\u0435\u0432, \u0430\u00a0flaky\u2011\u0442\u0435\u0441\u0442\u044b \u0438\u0437\u043e\u043b\u0438\u0440\u0443\u0439\u0442\u0435 \u0447\u0435\u0440\u0435\u0437 <code>SkipWhen<\/code> \u0438 <code>--fail-skips<\/code>. \u0422\u0430\u043a \u0432\u044b \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u0435\u00a0\u0431\u044b\u0441\u0442\u0440\u044b\u0435 \u043f\u0440\u043e\u0433\u043e\u043d\u043a\u0438, \u0432\u043e\u0441\u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u0438\u043c\u044b\u0435 \u0431\u0430\u0433\u2011\u0444\u0438\u043b\u044c\u0442\u0440\u044b \u0438 \u0430\u0440\u0442\u0435\u0444\u0430\u043a\u0442\u044b \u0440\u0430\u043d\u0430 \u043f\u0440\u044f\u043c\u043e \u0432\u00a0\u043e\u0442\u0447\u0451\u0442\u0430\u0445.<\/p>\n<p>\u0415\u0441\u043b\u0438 \u0435\u0441\u0442\u044c \u0438\u043d\u0442\u0435\u0440\u0435\u0441\u043d\u044b\u0439 \u043e\u043f\u044b\u0442 \u0438 \u043a\u0435\u0439\u0441\u044b\u00a0\u2014 \u0434\u0435\u043b\u0438\u0442\u0435\u0441\u044c \u0432\u00a0\u043a\u043e\u043c\u043c\u0435\u043d\u0442\u0430\u0440\u0438\u044f\u0445.<\/p>\n<hr\/>\n<p>\u0425\u043e\u0442\u0438\u0442\u0435 \u043e\u0441\u0432\u043e\u0438\u0442\u044c \u044e\u043d\u0438\u0442\u2011\u0442\u0435\u0441\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435 \u0432\u00a0C# \u0441\u00a0xUnit v3? \u0420\u0435\u043a\u043e\u043c\u0435\u043d\u0434\u0443\u0435\u043c \u043e\u0437\u043d\u0430\u043a\u043e\u043c\u0438\u0442\u044c\u0441\u044f \u0441\u00a0\u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u043e\u0439 <a href=\"https:\/\/otus.pw\/ieEn\/\" rel=\"noopener noreferrer nofollow\">\u043a\u0443\u0440\u0441\u0430 \u00abC# Developer. Basic\u00bb<\/a> \u2014 \u043d\u0430 \u043d\u0435\u043c \u043c\u043e\u0436\u043d\u043e \u043d\u0430\u0443\u0447\u0438\u0442\u044c\u0441\u044f \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0432\u0441\u0435 \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u0438 xUnit \u0438 \u0443\u043b\u0443\u0447\u0448\u0438\u0442\u044c \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u043e \u043a\u043e\u0434\u0430. \u0422\u0430\u043a\u0436\u0435 \u0440\u0435\u043a\u043e\u043c\u0435\u043d\u0434\u0443\u0435\u043c \u0437\u0430\u0433\u043b\u044f\u043d\u0443\u0442\u044c \u0432 <a href=\"https:\/\/otus.pw\/kwWp\/\" rel=\"noopener noreferrer nofollow\">\u043a\u0430\u043b\u0435\u043d\u0434\u0430\u0440\u044c \u043e\u0442\u043a\u0440\u044b\u0442\u044b\u0445 \u0443\u0440\u043e\u043a\u043e\u0432<\/a>, \u0432 \u043a\u043e\u0442\u043e\u0440\u043e\u043c \u0432\u044b \u0442\u043e\u0447\u043d\u043e \u0441\u043c\u043e\u0436\u0435\u0442\u0435 \u043d\u0430\u0439\u0442\u0438 \u0447\u0442\u043e-\u043b\u0438\u0431\u043e \u043f\u043e\u043b\u0435\u0437\u043d\u043e\u0435 \u0434\u043b\u044f \u0441\u0435\u0431\u044f. <\/p>\n<\/div>\n<\/div>\n<\/div>\n<p><!----><!----><\/div>\n<p><!----><!----><br \/> \u0441\u0441\u044b\u043b\u043a\u0430 \u043d\u0430 \u043e\u0440\u0438\u0433\u0438\u043d\u0430\u043b \u0441\u0442\u0430\u0442\u044c\u0438 <a href=\"https:\/\/habr.com\/ru\/articles\/918942\/\"> https:\/\/habr.com\/ru\/articles\/918942\/<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<div><!--[--><!--]--><\/div>\n<div id=\"post-content-body\">\n<div>\n<div class=\"article-formatted-body article-formatted-body article-formatted-body_version-2\">\n<div xmlns=\"http:\/\/www.w3.org\/1999\/xhtml\">\n<p>\u041f\u0440\u0438\u0432\u0435\u0442, \u0425\u0430\u0431\u0440!<\/p>\n<p>\u0421\u0435\u0433\u043e\u0434\u043d\u044f \u0440\u0430\u0437\u0431\u0435\u0440\u0451\u043c\u0441\u044f \u0441\u00a0\u044e\u043d\u0438\u0442\u2011\u0442\u0435\u0441\u0442\u0430\u043c\u0438 \u0432\u00a0C# \u043d\u0430\u00a0\u043e\u0441\u043d\u043e\u0432\u0435 <strong>xUnit v3<\/strong>\u00a0\u2014 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0438, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u0441\u0442\u0430\u043b\u0430 \u043f\u0440\u0430\u043a\u0442\u0438\u0447\u0435\u0441\u043a\u0438 \u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u043e\u043c \u0434\u0435\u2011\u0444\u0430\u043a\u0442\u043e \u0432.NET\u2011\u0441\u0440\u0435\u0434\u0435. <\/p>\n<p>\u041f\u043e\u0447\u0435\u043c\u0443 \u0438\u043c\u0435\u043d\u043d\u043e xUnit? \u0412\u0441\u0451 \u043f\u0440\u043e\u0441\u0442\u043e: \u0435\u0433\u043e \u0441\u043e\u0437\u0434\u0430\u043b\u0438 \u0414\u0436\u0438\u043c \u041d\u044c\u044e\u043a\u0438\u0440\u043a \u0438 \u0411\u0440\u044d\u0434 \u0423\u0438\u043b\u0441\u043e\u043d\u00a0\u2014 \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u0438 <a href=\"https:\/\/nunit.org\/\" rel=\"noopener noreferrer nofollow\">NUnit<\/a>. \u041e\u043d\u0438 \u0440\u0435\u0448\u0438\u043b\u0438 \u0432\u044b\u043a\u0438\u043d\u0443\u0442\u044c \u0432\u0441\u044e \u0430\u0440\u0445\u0430\u0438\u043a\u0443 \u0432\u0440\u043e\u0434\u0435 <code>[SetUp]<\/code>, <code>[TearDown]<\/code> \u0438 \u043f\u0440\u043e\u0447\u0438\u0445 \u0440\u0443\u0434\u0438\u043c\u0435\u043d\u0442\u043e\u0432 \u0438 \u043f\u043e\u0441\u0442\u0440\u043e\u0438\u043b\u0438 \u0444\u0440\u0435\u0439\u043c\u0432\u043e\u0440\u043a \u0441\u00a0\u043d\u0443\u043b\u044f, \u0441\u0442\u0440\u043e\u0433\u043e \u043f\u043e\u0434\u00a0TDD. \u0412\u0435\u0441\u043d\u043e\u0439 \u0432\u044b\u0448\u043b\u0430 <strong>xUnit v3 2.0.2<\/strong>, \u0432\u00a0\u043a\u043e\u0442\u043e\u0440\u043e\u0439 \u0437\u0430\u0432\u0435\u0437\u043b\u0438 <code>Assert.MultipleAsync<\/code>, \u043f\u043e\u043b\u043d\u043e\u0441\u0442\u044c\u044e \u043e\u0431\u043d\u043e\u0432\u0438\u043b\u0438 \u0441\u0435\u0440\u0438\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044e. \u0410\u00a0\u0432.NET 9\u00a0\u0443\u0436\u0435 \u0448\u0442\u0430\u0442\u043d\u043e \u043f\u0440\u043e\u0434\u0432\u0438\u0433\u0430\u0435\u0442\u0441\u044f <strong>Microsoft.Testing.Platform (MTP)<\/strong>\u00a0\u2014 \u0441\u0432\u0435\u0440\u0445\u043b\u0451\u0433\u043a\u0438\u0439 \u0442\u0435\u0441\u0442\u043e\u0432\u044b\u0439 \u0440\u0430\u043d\u0442\u0430\u0439\u043c, \u0441\u00a0\u043a\u043e\u0442\u043e\u0440\u044b\u043c xUnit v3\u00a0\u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442 \u043f\u0440\u044f\u043c\u043e \u0438\u0437\u00a0\u043a\u043e\u0440\u043e\u0431\u043a\u0438. \u041a\u043e\u0440\u043e\u0447\u0435 \u0433\u043e\u0432\u043e\u0440\u044f, \u044d\u0442\u043e \u0441\u0430\u043c\u044b\u0439 \u043d\u0430\u0442\u0438\u0432\u043d\u044b\u0439 \u0432\u044b\u0431\u043e\u0440 \u043f\u043e\u0434.NET 9\u00a0\u043d\u0430\u00a0\u0441\u0435\u0433\u043e\u0434\u043d\u044f.<\/p>\n<h3>\u0423\u0441\u0442\u0430\u043d\u0430\u0432\u043b\u0438\u0432\u0430\u0435\u043c \u0438\u043d\u0441\u0442\u0440\u0443\u043c\u0435\u043d\u0442\u044b<\/h3>\n<pre><code class=\"bash\"># \u043e\u0431\u043d\u043e\u0432\u043b\u044f\u0435\u043c \u0442\u0435\u043c\u043f\u043b\u0435\u0439\u0442\u044b \u0434\u043e v3 dotnet new install xunit.v3.templates dotnet new update  # \u0441\u043e\u0437\u0434\u0430\u0451\u043c \u0440\u0435\u0448\u0435\u043d\u0438\u0435 dotnet new sln -n DemoSolution dotnet new console -n DemoApp -o src\/DemoApp dotnet new xunit3   -n DemoApp.Tests -o test\/DemoApp.Tests dotnet sln add src\/DemoApp\/DemoApp.csproj dotnet sln add test\/DemoApp.Tests\/DemoApp.Tests.csproj<\/code><\/pre>\n<p>\u0428\u0430\u0431\u043b\u043e\u043d <code>xunit3<\/code> \u0443\u0436\u0435 \u043f\u043e\u0434\u0442\u044f\u043d\u0435\u0442:<\/p>\n<ul>\n<li>\n<p><code>xunit.v3<\/code>\u00a0\u2014 \u044f\u0434\u0440\u043e;<\/p>\n<\/li>\n<li>\n<p><code>xunit.v3.assert<\/code>\u00a0\u2014 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0443 \u0430\u0441\u0441\u0435\u0440\u0442\u043e\u0432;<\/p>\n<\/li>\n<li>\n<p><code>xunit.runner.visualstudio<\/code>\u00a0\u2014 \u0430\u0434\u0430\u043f\u0442\u0435\u0440 \u043f\u043e\u0434 <code>dotnet test<\/code>.<\/p>\n<\/li>\n<\/ul>\n<p>\u0412\u0441\u0451 \u044d\u0442\u043e \u043f\u043e\u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0431\u043b\u0430\u0433\u043e\u0434\u0430\u0440\u044f \u043d\u043e\u0432\u043e\u043c\u0443 \u043d\u0430\u0431\u043e\u0440\u0430 \u0442\u0435\u043c\u043f\u043b\u0435\u0439\u0442\u043e\u0432, \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u043d\u043e\u043c\u0443 \u0432\u00a0v3.<\/p>\n<h3>\u0410\u043d\u0430\u0442\u043e\u043c\u0438\u044f \u0442\u0435\u0441\u0442\u0430: [Fact] \u0438 [Theory]<\/h3>\n<h4>[Fact] \u2014 \u043e\u0434\u0438\u043d \u0441\u0446\u0435\u043d\u0430\u0440\u0438\u0439, \u043e\u0434\u0438\u043d \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442<\/h4>\n<pre><code class=\"cs\">public class CalculatorTests {     [Fact]     public void Add_ReturnsSum_WhenNumbersArePositive()     {         \/\/ Arrange         var calc = new Calculator();          \/\/ Act         var result = calc.Add(2, 3);          \/\/ Assert         Assert.Equal(5, result);     } }<\/code><\/pre>\n<h4>[Theory] \u2014 \u0434\u0430\u0435\u0448\u044c \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u0438\u0437\u0430\u0446\u0438\u044e<\/h4>\n<pre><code class=\"cs\">[Theory] [InlineData(2, 3, 5)] [InlineData(-2, -3, -5)] public void Add_Works_ForMultiplePairs(int a, int b, int expected) {     var calc = new Calculator();     Assert.Equal(expected, calc.Add(a, b)); }<\/code><\/pre>\n<p><code>InlineData<\/code>\u00a0\u2014 \u0441\u0430\u043c\u044b\u0439\u00a0\u0431\u044b\u0441\u0442\u0440\u044b\u0439 \u043f\u0443\u0442\u044c. \u0415\u0441\u043b\u0438 \u0434\u0430\u043d\u043d\u044b\u0445 \u043c\u043d\u043e\u0433\u043e\u00a0\u2014 <code>MemberData<\/code> \u0438\u043b\u0438 <code>ClassData<\/code> (\u043b\u0435\u043d\u0438\u0432\u043e\u0435 \u043f\u0435\u0440\u0435\u0447\u0438\u0441\u043b\u0435\u043d\u0438\u0435, \u0442\u0430\u043a \u0447\u0442\u043e\u00a0\u043f\u0430\u043c\u044f\u0442\u0438 \u043d\u0435\u00a0\u0436\u0430\u043b\u043a\u043e).<\/p>\n<h3>AAA<\/h3>\n<p><strong>AAA<\/strong>\u00a0\u2014 \u044d\u0442\u043e \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0430 \u043d\u0430\u043f\u0438\u0441\u0430\u043d\u0438\u044f \u044e\u043d\u0438\u0442\u2011\u0442\u0435\u0441\u0442\u0430, \u0430\u0431\u0431\u0440\u0435\u0432\u0438\u0430\u0442\u0443\u0440\u0430 \u043e\u0442:<\/p>\n<ul>\n<li>\n<p><strong>Arrange<\/strong>\u00a0\u2014 \u043f\u043e\u0434\u0433\u043e\u0442\u043e\u0432\u043a\u0430 \u0442\u0435\u0441\u0442\u043e\u0432\u043e\u0433\u043e \u043e\u043a\u0440\u0443\u0436\u0435\u043d\u0438\u044f;<\/p>\n<\/li>\n<li>\n<p><strong>Act<\/strong>\u00a0\u2014 \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u0435 \u0442\u0435\u0441\u0442\u0438\u0440\u0443\u0435\u043c\u043e\u0433\u043e \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u044f;<\/p>\n<\/li>\n<li>\n<p><strong>Assert<\/strong>\u00a0\u2014 \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0430 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u0430.<\/p>\n<\/li>\n<\/ul>\n<p>\u041f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u0438\u043c \u0441\u0446\u0435\u043d\u0430\u0440\u0438\u0439, \u0433\u0434\u0435<strong> \u0441\u0435\u0440\u0432\u0438\u0441 \u043d\u0430\u0447\u0438\u0441\u043b\u044f\u0435\u0442 \u0431\u043e\u043d\u0443\u0441\u043d\u044b\u0435 \u0431\u0430\u043b\u043b\u044b<\/strong> \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044e \u043f\u0440\u0438\u00a0\u043f\u043e\u043a\u0443\u043f\u043a\u0435. \u0415\u0441\u043b\u0438 \u043f\u043e\u043a\u0443\u043f\u043a\u0430 \u0431\u043e\u043b\u044c\u0448\u0435 500\u20bd\u00a0\u2014 \u043d\u0430\u0447\u0438\u0441\u043b\u044f\u0435\u0442\u0441\u044f 10% \u043e\u0442\u00a0\u0441\u0443\u043c\u043c\u044b. \u0415\u0441\u043b\u0438 \u043c\u0435\u043d\u044c\u0448\u0435\u00a0\u2014 5%. \u0411\u0430\u043b\u043b\u044b \u043e\u0442\u043f\u0440\u0430\u0432\u043b\u044f\u044e\u0442\u0441\u044f \u0432\u00a0\u0445\u0440\u0430\u043d\u0438\u043b\u0438\u0449\u0435.<\/p>\n<p><strong>\u041a\u043e\u0434 \u0441\u0435\u0440\u0432\u0438\u0441\u0430:<\/strong><\/p>\n<pre><code class=\"cs\">public interface IBonusRepository {     void AddPoints(int userId, int points); }  public class BonusService {     private readonly IBonusRepository _repository;      public BonusService(IBonusRepository repository)         =&gt; _repository = repository;      public void ProcessPurchase(int userId, decimal amount)     {         if (amount &lt;= 0)             throw new ArgumentException(\"Amount must be positive\");          int points = amount &gt;= 500             ? (int)(amount * 0.10m)             : (int)(amount * 0.05m);          _repository.AddPoints(userId, points);     } }<\/code><\/pre>\n<p><strong>\u041e\u0434\u0438\u043d \u043c\u043e\u0449\u043d\u044b\u0439, \u0441\u0430\u043c\u043e\u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u044b\u0439 \u0442\u0435\u0441\u0442 \u0441\u00a0AAA:<\/strong><\/p>\n<pre><code class=\"cs\">public class BonusServiceTests {     [Fact]     public void ProcessPurchase_AmountOverThreshold_AddsTenPercentBonus()     {         \/\/ Arrange         var mockRepo = new Mock&lt;IBonusRepository&gt;();         var service = new BonusService(mockRepo.Object);          int userId = 42;         decimal purchaseAmount = 600m;         int expectedPoints = 60; \/\/ 10% \u043e\u0442 600          \/\/ Act         service.ProcessPurchase(userId, purchaseAmount);          \/\/ Assert         mockRepo.Verify(r =&gt; r.AddPoints(userId, expectedPoints), Times.Once);     } }<\/code><\/pre>\n<h3>\u0414\u0440\u0443\u0436\u0438\u043c xUnit \u0441 Moq<\/h3>\n<pre><code class=\"cs\">var userRepo = new Mock&lt;IUserRepository&gt;(); userRepo.Setup(r =&gt; r.GetByIdAsync(42))         .ReturnsAsync(new User { Id = 42, Name = \"Neo\" });  var service = new UserService(userRepo.Object);  var result = await service.GetName(42);  Assert.Equal(\"Neo\", result); userRepo.Verify(r =&gt; r.GetByIdAsync(42), Times.Once);<\/code><\/pre>\n<p>Moq \u043e\u0441\u0442\u0430\u0451\u0442\u0441\u044f \u0441\u0430\u043c\u044b\u043c \u043f\u043e\u043f\u0443\u043b\u044f\u0440\u043d\u044b\u043c. \u0415\u0449\u0435 \u043c\u043e\u0436\u043d\u043e \u0441\u0432\u0438\u0447\u043d\u0443\u0442\u044c\u0441\u044f \u043d\u0430 <code>NSubstitute<\/code>, API \u043f\u043e\u0447\u0442\u0438 1-\u0432-1.<\/p>\n<h3>\u0414\u0435\u043b\u0438\u043c \u0442\u044f\u0436\u0435\u043b\u044b\u0439 \u0441\u0435\u0442\u0430\u043f \u043c\u0435\u0436\u0434\u0443 \u0442\u0435\u0441\u0442\u0430\u043c\u0438<\/h3>\n<p>\u0418\u043d\u043e\u0433\u0434\u0430 <strong>\u043a\u043e\u043d\u0441\u0442\u0440\u0443\u043a\u0442\u043e\u0440 \u0442\u0435\u0441\u0442\u2011\u043a\u043b\u0430\u0441\u0441\u0430<\/strong> (\u0432 xUnit \u044d\u0442\u043e Setup) \u043f\u0435\u0440\u0435\u0433\u0440\u0435\u0432\u0430\u0435\u0442\u0441\u044f. \u0422\u043e\u0433\u0434\u0430 \u0431\u0435\u0440\u0435\u043c <code>IClassFixture&lt;T&gt;<\/code>:<\/p>\n<pre><code class=\"cs\">public class DatabaseFixture : IDisposable {     public SqliteConnection Connection { get; }      public DatabaseFixture()     {         Connection = new SqliteConnection(\"DataSource=:memory:\");         Connection.Open();         new Schema().Create(Connection); \/\/ \u043c\u0438\u0433\u0440\u0430\u0446\u0438\u0438     }      public void Dispose() =&gt; Connection.Dispose(); }  public class UserRepositoryTests : IClassFixture&lt;DatabaseFixture&gt; {     private readonly DatabaseFixture _fixture;      public UserRepositoryTests(DatabaseFixture fixture)         =&gt; _fixture = fixture;      [Fact]     public async Task Save_And_Load_Roundtrip()     {         var repo = new UserRepository(_fixture.Connection);         var user = new User { Name = \"Trinity\" };          await repo.Save(user);         var loaded = await repo.Load(user.Id);          Assert.Equal(\"Trinity\", loaded.Name);     } }<\/code><\/pre>\n<p>\u0424\u0438\u043a\u0441\u0442\u0443\u0440\u0430 \u0441\u043e\u0437\u0434\u0430\u0451\u0442\u0441\u044f <strong>\u043e\u0434\u0438\u043d \u0440\u0430\u0437<\/strong> \u043d\u0430\u00a0\u043a\u043b\u0430\u0441\u0441, \u0447\u0438\u0441\u0442\u0438\u0442\u0441\u044f \u0432 <code>Dispose<\/code>\u00a0\u2014 \u043d\u0438\u043a\u0430\u043a\u043e\u0439 \u0443\u0441\u043b\u043e\u0432\u043d\u043e\u0439 \u043b\u043e\u0433\u0438\u043a\u0438 \u0432\u00a0\u0442\u0435\u0441\u0442\u0430\u0445. \u0414\u043b\u044f\u00a0\u0448\u0430\u0440\u0438\u043d\u0433\u0430 \u043c\u0435\u0436\u0434\u0443 \u043a\u043b\u0430\u0441\u0441\u0430\u043c\u0438\u00a0\u2014 <code>CollectionFixture<\/code>, \u0430\u00a0\u0435\u0441\u043b\u0438 \u043d\u0443\u0436\u0435\u043d DI\u2011style startup (Kafka, Redis)\u00a0\u2014 \u0441\u043c\u043e\u0442\u0440\u0438\u0442\u0435 Testcontainers.<\/p>\n<h3>\u0410\u0441\u0438\u043d\u0445\u0440\u043e\u043d\u043d\u043e\u0441\u0442\u044c<\/h3>\n<p><strong>xUnit \u0438\u0437\u043d\u0430\u0447\u0430\u043b\u044c\u043d\u043e \u043f\u0440\u043e\u0435\u043a\u0442\u0438\u0440\u043e\u0432\u0430\u043b\u0441\u044f \u0441\u00a0\u043f\u043e\u0434\u0434\u0435\u0440\u0436\u043a\u043e\u0439 <\/strong><code><strong>async<\/strong><\/code><strong>\/<\/strong><code><strong>await<\/strong><\/code>, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u043e\u043d \u043d\u0435\u00a0\u0442\u0440\u0435\u0431\u0443\u0435\u0442 \u043d\u0438\u043a\u0430\u043a\u0438\u0445 \u0442\u0430\u043d\u0446\u0435\u0432 \u0441\u00a0\u0431\u0443\u0431\u043d\u043e\u043c, \u0447\u0442\u043e\u0431\u044b \u043f\u0438\u0441\u0430\u0442\u044c \u0430\u0441\u0438\u043d\u0445\u0440\u043e\u043d\u043d\u044b\u0435 \u0442\u0435\u0441\u0442\u044b. \u0414\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e \u0432\u0435\u0440\u043d\u0443\u0442\u044c <code>Task<\/code> (\u0438\u043b\u0438 <code>ValueTask<\/code> \u0432.NET 7+) \u0438\u0437\u00a0\u043c\u0435\u0442\u043e\u0434\u0430, \u0438 \u0444\u0440\u0435\u0439\u043c\u0432\u043e\u0440\u043a \u0434\u043e\u0436\u0434\u0435\u0442\u0441\u044f \u0437\u0430\u0432\u0435\u0440\u0448\u0435\u043d\u0438\u044f \u0432\u0441\u0435\u0439 \u0446\u0435\u043f\u043e\u0447\u043a\u0438.<\/p>\n<p><strong>\u0411\u0430\u0437\u043e\u0432\u044b\u0439 \u0441\u0438\u043d\u0442\u0430\u043a\u0441\u0438\u0441 \u043f\u0440\u043e\u0441\u0442 \u0438 \u0438\u0434\u0435\u043d\u0442\u0438\u0447\u0435\u043d \u043e\u0431\u044b\u0447\u043d\u043e\u043c\u0443 \u043a\u043e\u0434\u0443:<\/strong><\/p>\n<pre><code class=\"cs\">[Fact] public async Task GetDataAsync_ReturnsExpectedResult() {     var sut = new DataService();      var result = await sut.GetDataAsync();      Assert.Equal(\"expected\", result); }<\/code><\/pre>\n<p>xUnit \u043f\u043e\u043b\u043d\u043e\u0441\u0442\u044c\u044e \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u0438\u0432\u0430\u0435\u0442 <code>await<\/code> \u0432\u00a0\u0442\u0435\u043b\u0435 \u0442\u0435\u0441\u0442\u0430\u00a0\u2014 \u043c\u043e\u0436\u043d\u043e \u0441\u043f\u043e\u043a\u043e\u0439\u043d\u043e \u043f\u0438\u0441\u0430\u0442\u044c \u0430\u0441\u0438\u043d\u0445\u0440\u043e\u043d\u043d\u0443\u044e \u043f\u043e\u0434\u0433\u043e\u0442\u043e\u0432\u043a\u0443, \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u044f \u0438 \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0438 \u0431\u0435\u0437 <code>.Result<\/code> \u0438 <code>.Wait()<\/code>, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0447\u0430\u0441\u0442\u043e \u0441\u0442\u0430\u043d\u043e\u0432\u044f\u0442\u0441\u044f \u043f\u0440\u0438\u0447\u0438\u043d\u043e\u0439 deadlock&#8217;\u043e\u0432.<\/p>\n<p><strong>\u0414\u043b\u044f\u00a0\u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0438 \u0432\u044b\u0431\u0440\u0430\u0441\u044b\u0432\u0430\u0435\u043c\u044b\u0445 \u0438\u0441\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0439 \u0432\u00a0\u0430\u0441\u0438\u043d\u0445\u0440\u043e\u043d\u043d\u044b\u0445 \u043c\u0435\u0442\u043e\u0434\u0430\u0445 \u0435\u0441\u0442\u044c \u043c\u0435\u0442\u043e\u0434 <\/strong><code><strong>Assert.ThrowsAsync&lt;T&gt;()<\/strong><\/code><strong>:<\/strong><\/p>\n<pre><code class=\"cs\">await Assert.ThrowsAsync&lt;InvalidOperationException&gt;(() =&gt;     sut.DoWeirdStuffAsync());<\/code><\/pre>\n<p>\u041d\u0435\u00a0\u0437\u0430\u0431\u044b\u0432\u0430\u0439\u0442\u0435 <strong>\u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0442\u044c <\/strong><code><strong>Task<\/strong><\/code><strong> \u0438\u0437\u00a0\u0442\u0435\u0441\u0442\u0430<\/strong>\u00a0\u2014 \u0438\u043d\u0430\u0447\u0435 xUnit \u043d\u0435\u00a0\u0434\u043e\u0436\u0434\u0435\u0442\u0441\u044f <code>await<\/code>, \u0438 \u0438\u0441\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435 \u043f\u0440\u043e\u0441\u0442\u043e \u043f\u0440\u043e\u0433\u043b\u043e\u0442\u0438\u0442\u0441\u044f \u0444\u0440\u0435\u0439\u043c\u0432\u043e\u0440\u043a\u043e\u043c. \u0422.\u0435 \u043a\u043e\u043d\u0441\u0442\u0440\u0443\u043a\u0446\u0438\u044f <code>Assert.ThrowsAsync(...).Wait()<\/code>\u00a0\u2014 \u044d\u0442\u043e \u043f\u043b\u043e\u0445\u043e\u0439 \u0442\u043e\u043d.<\/p>\n<p><strong>\u0412\u00a0\u0430\u0441\u0438\u043d\u0445\u0440\u043e\u043d\u043d\u044b\u0445 \u0442\u0435\u0441\u0442\u0430\u0445 \u043c\u043e\u0436\u043d\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c <\/strong><code><strong>Moq<\/strong><\/code><strong> \u0438 \u0435\u0433\u043e <\/strong><code><strong>ReturnsAsync<\/strong><\/code><strong>, <\/strong><code><strong>CallbackAsync<\/strong><\/code><strong>, <\/strong><code><strong>SetupSequence()<\/strong><\/code><strong> \u0434\u043b\u044f\u00a0\u0441\u0438\u043c\u0443\u043b\u044f\u0446\u0438\u0438 \u0440\u0430\u0437\u043d\u044b\u0445 \u0441\u0446\u0435\u043d\u0430\u0440\u0438\u0435\u0432:<\/strong><\/p>\n<pre><code class=\"cs\">mockRepo.Setup(x =&gt; x.LoadAsync(It.IsAny&lt;int&gt;()))         .ReturnsAsync(new User { Id = 1 });<\/code><\/pre>\n<p>\u041c\u043e\u0436\u043d\u043e \u0441\u0442\u0440\u043e\u0438\u0442\u044c \u0441\u043b\u043e\u0436\u043d\u044b\u0435 \u0442\u0435\u0441\u0442\u043e\u0432\u044b\u0435 \u0441\u0438\u0442\u0443\u0430\u0446\u0438\u0438 \u0441\u00a0\u0438\u043c\u0438\u0442\u0430\u0446\u0438\u0435\u0439 \u0437\u0430\u0434\u0435\u0440\u0436\u0435\u043a, \u0441\u0431\u043e\u0435\u0432, \u043f\u0435\u0440\u0435\u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u0435\u043c \u043e\u0442\u0432\u0435\u0442\u043e\u0432 \u043e\u0442\u00a0\u0432\u043d\u0435\u0448\u043d\u0438\u0445 \u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0441\u0442\u0435\u0439.<\/p>\n<p><strong>\u0410\u00a0\u0435\u0441\u043b\u0438 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0435 \u0444\u0438\u043a\u0441\u0442\u0443\u0440\u044b, \u0438\u043d\u0438\u0446\u0438\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044f \u043a\u043e\u0442\u043e\u0440\u044b\u0445 \u0437\u0430\u0432\u0438\u0441\u0438\u0442 \u043e\u0442 <\/strong><code><strong>async<\/strong><\/code><strong>, xUnit \u043d\u0435\u00a0\u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c <\/strong><code><strong>async<\/strong><\/code><strong> \u0432\u00a0\u043a\u043e\u043d\u0441\u0442\u0440\u0443\u043a\u0442\u043e\u0440\u0430\u0445 \u0438\u043b\u0438 <\/strong><code><strong>IDisposableAsync<\/strong><\/code><strong>.<\/strong> \u0412\u00a0\u0442\u0430\u043a\u0438\u0445 \u0441\u043b\u0443\u0447\u0430\u044f\u0445 \u0440\u0435\u043a\u043e\u043c\u0435\u043d\u0434\u0443\u0435\u0442\u0441\u044f \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c <code>IAsyncLifetime<\/code>, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0434\u0430\u0435\u0442 \u0434\u0432\u0430 \u043c\u0435\u0442\u043e\u0434\u0430: <code>InitializeAsync()<\/code> \u0438 <code>DisposeAsync()<\/code>\u00a0\u2014 \u043e\u043d\u0438 \u0432\u044b\u0437\u044b\u0432\u0430\u044e\u0442\u0441\u044f \u0434\u043e\u00a0\u0438 \u043f\u043e\u0441\u043b\u0435 \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f \u0432\u0441\u0435\u0445 \u0442\u0435\u0441\u0442\u043e\u0432 \u0432\u00a0\u043a\u043b\u0430\u0441\u0441\u0435:<\/p>\n<pre><code class=\"cs\">public class MyFixture : IAsyncLifetime {     public async Task InitializeAsync() { ... }     public async Task DisposeAsync() { ... } }<\/code><\/pre>\n<h3>\u0424\u0438\u0447\u0438 v3<\/h3>\n<p><strong>\u0414\u0438\u043d\u0430\u043c\u0438\u0447\u0435\u0441\u043a\u0438\u0439 skip<\/strong><\/p>\n<p>\u041d\u043e\u0432\u0430\u044f \u043f\u0430\u0440\u0430 \u0430\u0442\u0440\u0438\u0431\u0443\u0442\u043e\u0432 <code>[SkipWhen]<\/code> \u0438 <code>[SkipUnless]<\/code> \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u043f\u0440\u0438\u043d\u0438\u043c\u0430\u0442\u044c \u0440\u0435\u0448\u0435\u043d\u0438\u0435 \u043e\u00a0\u043f\u0440\u043e\u043f\u0443\u0441\u043a\u0435 \u0432\u043e\u00a0\u0432\u0440\u0435\u043c\u044f \u0438\u0441\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f, \u0430\u00a0\u043d\u0435\u00a0\u043d\u0430\u00a0\u043c\u043e\u043c\u0435\u043d\u0442 \u043a\u043e\u043c\u043f\u0438\u043b\u044f\u0446\u0438\u0438. \u0422\u0438\u043f\u043e\u0432\u043e\u0439 \u0441\u0446\u0435\u043d\u0430\u0440\u0438\u0439\u00a0\u2014 \u043e\u0442\u043a\u043b\u044e\u0447\u0438\u0442\u044c \u0442\u0435\u0441\u0442 \u0432\u00a0Windows\u2011\u0430\u0433\u0435\u043d\u0442\u0435, \u043d\u043e\u00a0\u0437\u0430\u043f\u0443\u0441\u0442\u0438\u0442\u044c \u0432\u00a0Linux\u2011\u043a\u043e\u043d\u0442\u0435\u0439\u043d\u0435\u0440\u0435:<\/p>\n<pre><code class=\"cs\">[Fact(SkipUnless = nameof(IsLinux))] static bool IsLinux =&gt; OperatingSystem.IsLinux();<\/code><\/pre>\n<p>\u0415\u0441\u043b\u0438 \u0432\u044b\u0440\u0430\u0436\u0435\u043d\u0438\u0435 \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u0442 <code>false<\/code>, \u0444\u0440\u0435\u0439\u043c\u0432\u043e\u0440\u043a \u043f\u043e\u043c\u0435\u0447\u0430\u0435\u0442 \u0442\u0435\u0441\u0442 \u043a\u0430\u043a\u00a0Skipped. \u0412\u043d\u0443\u0442\u0440\u0438 \u0430\u0442\u0440\u0438\u0431\u0443\u0442 \u0432\u044b\u0437\u044b\u0432\u0430\u0435\u0442 <code>Assert.Skip(\"\u2026\")<\/code>, \u0442\u0430\u043a \u0447\u0442\u043e\u00a0\u043f\u0440\u0438\u0447\u0438\u043d\u0443 \u043c\u043e\u0436\u043d\u043e \u0444\u043e\u0440\u043c\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0434\u0438\u043d\u0430\u043c\u0438\u0447\u0435\u0441\u043a\u0438. \u041d\u0430\u00a0CI \u043f\u043e\u0432\u0435\u0434\u0435\u043d\u0438\u0435 \u043c\u043e\u0436\u043d\u043e \u0443\u0436\u0435\u0441\u0442\u043e\u0447\u0438\u0442\u044c: <code>dotnet test --fail-skips<\/code> \u043f\u0435\u0440\u0435\u0432\u0435\u0434\u0435\u0442 \u043b\u044e\u0431\u043e\u0439 skip \u0432\u00a0Fail, \u0447\u0442\u043e\u0431\u044b \u0441\u043b\u0443\u0447\u0430\u0439\u043d\u043e \u043d\u0435\u00a0\u043f\u0440\u044f\u0442\u0430\u0442\u044c \u0432\u0430\u0436\u043d\u044b\u0435 \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0438. <\/p>\n<p><strong>Explicit\u2011\u0442\u0435\u0441\u0442\u044b<\/strong><\/p>\n<p>\u0422\u0435\u043f\u0435\u0440\u044c \u043c\u043e\u0436\u043d\u043e \u043e\u0431\u044a\u044f\u0432\u0438\u0442\u044c \u0442\u0435\u0441\u0442 \u00ab\u044f\u0432\u043d\u044b\u043c\u00bb \u0438 \u0437\u0430\u043f\u0443\u0441\u043a\u0430\u0442\u044c \u0435\u0433\u043e \u0442\u043e\u043b\u044c\u043a\u043e \u043f\u043e\u00a0\u0442\u0440\u0435\u0431\u043e\u0432\u0430\u043d\u0438\u044e. \u0414\u0435\u043b\u0430\u0435\u0442\u0441\u044f \u043e\u0434\u043d\u043e\u0439 \u0441\u0442\u0440\u043e\u043a\u043e\u0439:<\/p>\n<pre><code class=\"cs\">[Fact(Explicit = true, Reason = \"\u0414\u043e\u043b\u0433\u043e \u0433\u043e\u043d\u044f\u0435\u0442 \u0432\u043d\u0435\u0448\u043d\u044e\u044e \u0411\u0414\")] public async Task Migration_EndToEnd() { \u2026 }<\/code><\/pre>\n<p>\u041f\u043e\u00a0\u0443\u043c\u043e\u043b\u0447\u0430\u043d\u0438\u044e \u0442\u0430\u043a\u0438\u0435 \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0438 \u043f\u0440\u043e\u043f\u0443\u0441\u043a\u0430\u044e\u0442\u0441\u044f. \u0427\u0442\u043e\u0431\u044b \u0438\u0445 \u0432\u044b\u043f\u043e\u043b\u043d\u0438\u0442\u044c, \u043f\u0435\u0440\u0435\u0434\u0430\u0439\u0442\u0435 <code>--explicit on<\/code> (\u0438\u043b\u0438 \u0432\u043a\u043b\u044e\u0447\u0438\u0442\u0435 \u0433\u0430\u043b\u043a\u0443 \u00abRun explicit tests\u00bb \u0432\u00a0IDE). <\/p>\n<p><strong>Query filter\u00a0\u2014 \u044f\u0437\u044b\u043a \u0432\u044b\u0431\u043e\u0440\u043a\u0438<\/strong><\/p>\n<p>\u0421\u0442\u0430\u0440\u043e\u0435 <code>--filter FullyQualifiedName~Calculate<\/code> \u043e\u0441\u0442\u0430\u043b\u043e\u0441\u044c, \u043d\u043e\u00a0\u0440\u044f\u0434\u043e\u043c \u043f\u043e\u044f\u0432\u0438\u043b\u0441\u044f \u0434\u0435\u043a\u043b\u0430\u0440\u0430\u0442\u0438\u0432\u043d\u044b\u0439 DSL:<\/p>\n<pre><code class=\"bash\">dotnet test -filter \"class==*Order* &amp;&amp; trait!=Slow\"<\/code><\/pre>\n<p>\u041c\u043e\u0436\u043d\u043e \u043a\u043e\u043c\u0431\u0438\u043d\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0443\u0441\u043b\u043e\u0432\u0438\u044f \u043f\u043e\u00a0\u0438\u043c\u0435\u043d\u0438, \u043f\u0440\u043e\u0441\u0442\u0440\u0430\u043d\u0441\u0442\u0432\u0443 \u0438\u043c\u0435\u043d, <code>Trait<\/code>, \u043a\u0430\u0442\u0435\u0433\u043e\u0440\u0438\u0438, \u0432\u0440\u0435\u043c\u0435\u043d\u0438 \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f, \u0438 \u044d\u0442\u043e \u0447\u0438\u0442\u0430\u0435\u0442\u0441\u044f \u043a\u0443\u0434\u0430 \u043f\u043e\u043d\u044f\u0442\u043d\u0435\u0435, \u0447\u0435\u043c \u0440\u0435\u0433\u0443\u043b\u044f\u0440\u043d\u044b\u0435 \u0432\u044b\u0440\u0430\u0436\u0435\u043d\u0438\u044f. DSL \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u0438\u0432\u0430\u0435\u0442\u0441\u044f \u043a\u0430\u043a\u00a0\u0432\u00a0CLI, \u0442\u0430\u043a \u0438 \u0432\u00a0VS Test Explorer.<\/p>\n<p><code><strong>TestContext<\/strong><\/code><strong> \u0438 CancellationToken<\/strong><\/p>\n<p>\u0412\u00a0v3\u00a0\u043a\u0430\u0436\u0434\u044b\u0439 \u0442\u0435\u0441\u0442 \u043f\u043e\u043b\u0443\u0447\u0430\u0435\u0442 \u0431\u0435\u0437\u043e\u043f\u0430\u0441\u043d\u044b\u0439 \u043a\u0430\u043d\u0430\u043b \u043a\u00a0\u043e\u043a\u0440\u0443\u0436\u0435\u043d\u0438\u044e:<\/p>\n<pre><code class=\"cs\">await Task.Delay(30_000, TestContext.Current.CancellationToken); TestContext.Current.AddResultFile(\"out.log\");<\/code><\/pre>\n<p><code>CancellationToken<\/code> \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u043f\u0440\u0435\u0440\u044b\u0432\u0430\u0442\u044c \u0434\u043e\u043b\u0433\u0438\u0435 \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u0438, \u043a\u043e\u0433\u0434\u0430 \u0440\u0430\u043d\u043d\u0435\u0440 \u043e\u0441\u0442\u0430\u043d\u0430\u0432\u043b\u0438\u0432\u0430\u0435\u0442 \u0441\u0435\u0441\u0441\u0438\u044e. <code>AddResultFile<\/code> \u043f\u0440\u0438\u043a\u0440\u0435\u043f\u043b\u044f\u0435\u0442 \u0430\u0440\u0442\u0435\u0444\u0430\u043a\u0442\u044b (\u043b\u043e\u0433\u0438, \u0441\u043a\u0440\u0438\u043d\u0448\u043e\u0442\u044b) \u043a\u00a0\u043e\u0442\u0447\u0435\u0442\u0443, \u0438 \u0438\u0445 \u043c\u043e\u0436\u043d\u043e \u0441\u043a\u0430\u0447\u0430\u0442\u044c \u043f\u0440\u044f\u043c\u043e \u0438\u0437\u00a0\u0441\u0431\u043e\u0440\u043a\u0438 \u0432\u00a0CI.<\/p>\n<p>\u0414\u043b\u044f\u00a0\u0430\u0441\u0438\u043d\u0445\u0440\u043e\u043d\u043d\u044b\u0445 \u0444\u0438\u043a\u0441\u0442\u0443\u0440 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f <code>IAsyncLifetime<\/code>, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0442\u0435\u043f\u0435\u0440\u044c \u0442\u043e\u0436\u0435 \u0432\u0438\u0434\u0438\u0442 \u0442\u043e\u0442\u00a0\u0436\u0435 <code>CancellationToken<\/code>, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u0441\u0435\u0442\u0430\u043f\/\u0442\u0438\u0430\u0440\u0434\u0430\u0443\u043d \u0437\u0430\u0432\u0435\u0440\u0448\u0430\u044e\u0442\u0441\u044f \u0430\u043a\u043a\u0443\u0440\u0430\u0442\u043d\u043e.<\/p>\n<hr\/>\n<p>xUnit v3\u00a0\u0437\u0430\u043a\u0440\u044b\u0432\u0430\u0435\u0442 \u043f\u043e\u043b\u043d\u044b\u0439 \u0446\u0438\u043a\u043b \u044e\u043d\u0438\u0442\u2011\u0442\u0435\u0441\u0442\u043e\u0432 \u043f\u043e\u0434.NET 9: \u043f\u043e\u043d\u044f\u0442\u043d\u0430\u044f \u043c\u043e\u0434\u0435\u043b\u044c <code>[Fact]\/[Theory]<\/code>, \u0441\u0442\u0440\u043e\u0433\u0430\u044f \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0430 AAA, \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u043a\u0430 <code>async\/await<\/code>, DI\u2011\u0444\u0438\u043a\u0441\u00ad\u0442\u0443\u0440\u044b \u0438 \u0441\u0432\u0435\u0436\u0438\u0435 \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u0438\u00a0\u2014 \u0434\u0438\u043d\u0430\u043c\u0438\u0447\u0435\u0441\u043a\u0438\u0439 skip, explicit\u2011\u0437\u0430\u043f\u0443\u0441\u043a\u0438, query\u2011\u0444\u0438\u043b\u044c\u0442\u0440\u044b \u0438 <code>TestContext<\/code> \u0441\u00a0\u0442\u043e\u043a\u0435\u043d\u043e\u043c \u043e\u0442\u043c\u0435\u043d\u044b. <\/p>\n<p>\u0412\u043d\u0435\u0434\u0440\u044f\u0439\u0442\u0435 \u0448\u0430\u0431\u043b\u043e\u043d <code>xunit3<\/code>, \u0434\u0435\u0440\u0436\u0438\u0442\u0435 \u043f\u043e\u043a\u0440\u044b\u0442\u0438\u0435 \u043d\u0430\u00a0\u0443\u0440\u043e\u0432\u043d\u0435 \u043f\u043e\u043b\u0435\u0437\u043d\u044b\u0445 \u0441\u0446\u0435\u043d\u0430\u0440\u0438\u0435\u0432, \u0430\u00a0flaky\u2011\u0442\u0435\u0441\u0442\u044b \u0438\u0437\u043e\u043b\u0438\u0440\u0443\u0439\u0442\u0435 \u0447\u0435\u0440\u0435\u0437 <code>SkipWhen<\/code> \u0438 <code>--fail-skips<\/code>. \u0422\u0430\u043a \u0432\u044b \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u0435\u00a0\u0431\u044b\u0441\u0442\u0440\u044b\u0435 \u043f\u0440\u043e\u0433\u043e\u043d\u043a\u0438, \u0432\u043e\u0441\u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u0438\u043c\u044b\u0435 \u0431\u0430\u0433\u2011\u0444\u0438\u043b\u044c\u0442\u0440\u044b \u0438 \u0430\u0440\u0442\u0435\u0444\u0430\u043a\u0442\u044b \u0440\u0430\u043d\u0430 \u043f\u0440\u044f\u043c\u043e \u0432\u00a0\u043e\u0442\u0447\u0451\u0442\u0430\u0445.<\/p>\n<p>\u0415\u0441\u043b\u0438 \u0435\u0441\u0442\u044c \u0438\u043d\u0442\u0435\u0440\u0435\u0441\u043d\u044b\u0439 \u043e\u043f\u044b\u0442 \u0438 \u043a\u0435\u0439\u0441\u044b\u00a0\u2014 \u0434\u0435\u043b\u0438\u0442\u0435\u0441\u044c \u0432\u00a0\u043a\u043e\u043c\u043c\u0435\u043d\u0442\u0430\u0440\u0438\u044f\u0445.<\/p>\n<hr\/>\n<p>\u0425\u043e\u0442\u0438\u0442\u0435 \u043e\u0441\u0432\u043e\u0438\u0442\u044c \u044e\u043d\u0438\u0442\u2011\u0442\u0435\u0441\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435 \u0432\u00a0C# \u0441\u00a0xUnit v3? \u0420\u0435\u043a\u043e\u043c\u0435\u043d\u0434\u0443\u0435\u043c \u043e\u0437\u043d\u0430\u043a\u043e\u043c\u0438\u0442\u044c\u0441\u044f \u0441\u00a0\u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u043e\u0439 <a href=\"https:\/\/otus.pw\/ieEn\/\" rel=\"noopener noreferrer nofollow\">\u043a\u0443\u0440\u0441\u0430 \u00abC# Developer. Basic\u00bb<\/a> \u2014 \u043d\u0430 \u043d\u0435\u043c \u043c\u043e\u0436\u043d\u043e \u043d\u0430\u0443\u0447\u0438\u0442\u044c\u0441\u044f \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0432\u0441\u0435 \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u0438 xUnit \u0438 \u0443\u043b\u0443\u0447\u0448\u0438\u0442\u044c \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u043e \u043a\u043e\u0434\u0430. \u0422\u0430\u043a\u0436\u0435 \u0440\u0435\u043a\u043e\u043c\u0435\u043d\u0434\u0443\u0435\u043c \u0437\u0430\u0433\u043b\u044f\u043d\u0443\u0442\u044c \u0432 <a href=\"https:\/\/otus.pw\/kwWp\/\" rel=\"noopener noreferrer nofollow\">\u043a\u0430\u043b\u0435\u043d\u0434\u0430\u0440\u044c \u043e\u0442\u043a\u0440\u044b\u0442\u044b\u0445 \u0443\u0440\u043e\u043a\u043e\u0432<\/a>, \u0432 \u043a\u043e\u0442\u043e\u0440\u043e\u043c \u0432\u044b \u0442\u043e\u0447\u043d\u043e \u0441\u043c\u043e\u0436\u0435\u0442\u0435 \u043d\u0430\u0439\u0442\u0438 \u0447\u0442\u043e-\u043b\u0438\u0431\u043e \u043f\u043e\u043b\u0435\u0437\u043d\u043e\u0435 \u0434\u043b\u044f \u0441\u0435\u0431\u044f. <\/p>\n<\/div>\n<\/div>\n<\/div>\n<p><!----><!----><\/div>\n<p><!----><!----><br \/> \u0441\u0441\u044b\u043b\u043a\u0430 \u043d\u0430 \u043e\u0440\u0438\u0433\u0438\u043d\u0430\u043b \u0441\u0442\u0430\u0442\u044c\u0438 <a href=\"https:\/\/habr.com\/ru\/articles\/918942\/\"> https:\/\/habr.com\/ru\/articles\/918942\/<\/a><br \/><\/br><\/br><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[],"tags":[],"class_list":["post-465382","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/465382","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=465382"}],"version-history":[{"count":0,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/465382\/revisions"}],"wp:attachment":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=465382"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=465382"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=465382"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}