-
-
Notifications
You must be signed in to change notification settings - Fork 20
Expand file tree
/
Copy pathManifestTests.cs
More file actions
49 lines (40 loc) · 1.79 KB
/
ManifestTests.cs
File metadata and controls
49 lines (40 loc) · 1.79 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
44
45
46
47
48
49
using Microsoft.VisualStudio.TestTools.UnitTesting;
using System.IO;
using System.Xml.Linq;
namespace CopilotTokenTracker.Tests
{
[TestClass]
public class ManifestTests
{
private static readonly string ManifestPath =
Path.Combine(AppContext.BaseDirectory, "source.extension.vsixmanifest");
[TestMethod]
public void VsixManifest_DescriptionUnder280Characters()
{
Assert.IsTrue(File.Exists(ManifestPath), $"Manifest not found at: {ManifestPath}");
var doc = XDocument.Load(ManifestPath);
XNamespace ns = "http://schemas.microsoft.com/developer/vsx-schema/2011";
var description = doc.Root?
.Element(ns + "Metadata")?
.Element(ns + "Description")?
.Value?.Trim();
Assert.IsNotNull(description, "Description element not found in vsixmanifest");
Assert.IsTrue(
description.Length <= 280,
$"Description is {description.Length} characters — Visual Studio Marketplace requires ≤ 280. Current value: \"{description}\"");
}
[TestMethod]
public void VsixManifest_DescriptionNotEmpty()
{
Assert.IsTrue(File.Exists(ManifestPath), $"Manifest not found at: {ManifestPath}");
var doc = XDocument.Load(ManifestPath);
XNamespace ns = "http://schemas.microsoft.com/developer/vsx-schema/2011";
var description = doc.Root?
.Element(ns + "Metadata")?
.Element(ns + "Description")?
.Value?.Trim();
Assert.IsNotNull(description, "Description element not found in vsixmanifest");
Assert.IsFalse(string.IsNullOrWhiteSpace(description), "Description must not be empty");
}
}
}