-
Notifications
You must be signed in to change notification settings - Fork 748
Expand file tree
/
Copy pathDotnetRemovePackageTests.cs
More file actions
43 lines (35 loc) · 1.47 KB
/
DotnetRemovePackageTests.cs
File metadata and controls
43 lines (35 loc) · 1.47 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
// Copyright (c) .NET Foundation. All rights reserved.
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
using System.IO;
using Xunit;
using Xunit.Abstractions;
namespace Dotnet.Integration.Test;
[Collection(DotnetIntegrationCollection.Name)]
public sealed class DotnetRemovePackageTests(DotnetIntegrationTestFixture fixture, ITestOutputHelper testOutputHelper)
{
private readonly DotnetIntegrationTestFixture _fixture = fixture;
private readonly ITestOutputHelper _testOutputHelper = testOutputHelper;
[Fact]
public void RemovePkg_FileBasedApp()
{
using var pathContext = _fixture.CreateSimpleTestPathContext();
// Create the file-based app.
var fbaDir = Path.Join(pathContext.SolutionRoot, "fba");
Directory.CreateDirectory(fbaDir);
var appFile = Path.Join(fbaDir, "app.cs");
File.WriteAllText(appFile, """
#:package [email protected]
Console.WriteLine();
""");
// Remove the package.
_fixture.RunDotnetExpectSuccess(fbaDir, "package remove packageX --file app.cs", testOutputHelper: _testOutputHelper);
// Verify the full content of the modified .cs file.
var modifiedContent = File.ReadAllText(appFile);
_testOutputHelper.WriteLine("after:\n" + modifiedContent);
Assert.Equal(
"""
Console.WriteLine();
""",
modifiedContent);
}
}