using System; using System.Collections.Generic; using System.Linq; using CliFx.Models; using CliFx.Services; using CliFx.Tests.TestCommands; using FluentAssertions; using NUnit.Framework; namespace CliFx.Tests.Services { [TestFixture] public class CommandFactoryTests { private static CommandSchema GetCommandSchema(Type commandType) => new CommandSchemaResolver().GetCommandSchemas(new[] {commandType}).Single(); private static IEnumerable GetTestCases_CreateCommand() { yield return new TestCaseData(GetCommandSchema(typeof(HelloWorldDefaultCommand))); } [Test] [TestCaseSource(nameof(GetTestCases_CreateCommand))] public void CreateCommand_Test(CommandSchema commandSchema) { // Arrange var factory = new CommandFactory(); // Act var command = factory.CreateCommand(commandSchema); // Assert command.Should().BeOfType(commandSchema.Type); } } }