using AmiReel.Models;
using Microsoft.VisualStudio.TestTools.UnitTesting;

namespace AmiReel.Tests.Models;

[TestClass]
public class SupportedVideoFormatsTests
{
    [TestMethod]
    [DataRow(@"C:\videos\clip.avi")]
    [DataRow(@"C:\videos\clip.mp4")]
    [DataRow(@"C:\videos\clip.MOV")]
    [DataRow(@"C:\videos\clip.mkv")]
    [DataRow(@"C:\videos\clip.webm")]
    public void IsSupported_WithAcceptedExtension_ReturnsTrue(string path)
    {
        // Act
        bool result = SupportedVideoFormats.IsSupported(path);

        // Assert
        Assert.IsTrue(result);
    }

    [TestMethod]
    [DataRow(@"C:\documents\report.pdf")]
    [DataRow(@"C:\images\photo.png")]
    [DataRow(@"C:\audio\track.mp3")]
    public void IsSupported_WithUnsupportedExtension_ReturnsFalse(string path)
    {
        // Act
        bool result = SupportedVideoFormats.IsSupported(path);

        // Assert
        Assert.IsFalse(result);
    }

    [TestMethod]
    public void IsSupported_IsCaseInsensitive()
    {
        // Arrange
        const string lower = @"C:\videos\clip.avi";
        const string upper = @"C:\videos\clip.AVI";

        // Act & Assert
        Assert.IsTrue(SupportedVideoFormats.IsSupported(lower));
        Assert.IsTrue(SupportedVideoFormats.IsSupported(upper));
    }

    [TestMethod]
    public void IsSupported_WithNoExtension_ReturnsFalse()
    {
        // Act
        bool result = SupportedVideoFormats.IsSupported(@"C:\videos\clip");

        // Assert
        Assert.IsFalse(result);
    }

    [TestMethod]
    public void PickerFilter_ContainsEveryExtensionAsAGlobPattern()
    {
        // Act
        string filter = SupportedVideoFormats.PickerFilter;

        // Assert
        foreach (string extension in SupportedVideoFormats.Extensions)
            StringAssert.Contains(filter, "*" + extension);
    }
}
