diff --git a/IntelliTect.TestTools.TestFramework.slnf b/IntelliTect.TestTools.TestFramework.slnf deleted file mode 100644 index 6e57d01a..00000000 --- a/IntelliTect.TestTools.TestFramework.slnf +++ /dev/null @@ -1,10 +0,0 @@ -{ - "solution": { - "path": "IntelliTect.TestTools.sln", - "projects": [ - "IntelliTect.TestTools.TestFramework\\ExampleTests\\ExampleTests\\ExampleTests.csproj", - "IntelliTect.TestTools.TestFramework\\IntelliTect.TestTools.TestFramework.Tests\\IntelliTect.TestTools.TestFramework.Tests.csproj", - "IntelliTect.TestTools.TestFramework\\IntelliTect.TestTools.TestFramework\\IntelliTect.TestTools.TestFramework.csproj" - ] - } -} \ No newline at end of file diff --git a/IntelliTect.TestTools.TestFramework/ExampleTests/ExampleTests/Data/Account.cs b/IntelliTect.TestTools.TestFramework/ExampleTests/ExampleTests/Data/Account.cs deleted file mode 100644 index 926faf22..00000000 --- a/IntelliTect.TestTools.TestFramework/ExampleTests/ExampleTests/Data/Account.cs +++ /dev/null @@ -1,10 +0,0 @@ -namespace ExampleTests.Data -{ - public class Account - { - public int Id { get; set; } - public string FirstName { get; set; } - public string LastName { get; set; } - public string Password { get; set; } - } -} diff --git a/IntelliTect.TestTools.TestFramework/ExampleTests/ExampleTests/Data/AccountFactory.cs b/IntelliTect.TestTools.TestFramework/ExampleTests/ExampleTests/Data/AccountFactory.cs deleted file mode 100644 index 5437f458..00000000 --- a/IntelliTect.TestTools.TestFramework/ExampleTests/ExampleTests/Data/AccountFactory.cs +++ /dev/null @@ -1,48 +0,0 @@ -using System; - -namespace ExampleTests.Data -{ - public class AccountFactory - { - public AccountFactory() - { - AccountId = GetAccountId; - Account = GetFullAccount; - } - - public Func AccountId { get; private set; } - public Func Account { get; private set; } - - private Account GetFullAccount(IServiceProvider service) - { - var acct = new Account { Id = QueryAccountId() }; - acct = ExampleQuery(acct.Id); - return acct; - } - - private Account GetAccountId(IServiceProvider service) - { - var acct = new Account { Id = QueryAccountId() }; - return acct; - } - - private int QueryAccountId() - { - // In real example, run a query here - return 012345; - } - - private Account ExampleQuery(int acctId) - { - // In real example, run a query here - var acct = new Account - { - Id = acctId, - FirstName = "Tester", - LastName = "McTesterson", - Password = "Password!" - }; - return acct; - } - } -} diff --git a/IntelliTect.TestTools.TestFramework/ExampleTests/ExampleTests/Data/SiteStatus.cs b/IntelliTect.TestTools.TestFramework/ExampleTests/ExampleTests/Data/SiteStatus.cs deleted file mode 100644 index 64865d94..00000000 --- a/IntelliTect.TestTools.TestFramework/ExampleTests/ExampleTests/Data/SiteStatus.cs +++ /dev/null @@ -1,8 +0,0 @@ -namespace ExampleTests.Data -{ - public class SiteStatus - { - public bool IsHeaderAvailable { get; set; } - public bool IsBodyAvailable { get; set; } - } -} diff --git a/IntelliTect.TestTools.TestFramework/ExampleTests/ExampleTests/ExampleTests.csproj b/IntelliTect.TestTools.TestFramework/ExampleTests/ExampleTests/ExampleTests.csproj deleted file mode 100644 index ed8c8010..00000000 --- a/IntelliTect.TestTools.TestFramework/ExampleTests/ExampleTests/ExampleTests.csproj +++ /dev/null @@ -1,39 +0,0 @@ - - - - net6.0 - 11.0 - enable - - CA1303;CS1822;CS1822;CS8620;CS8625;CS8600;CS8602;CS8618;CS8603;CS8604;CA1822;CA1062 - - false - - - - - all - - - - - - - - all - runtime; build; native; contentfiles; analyzers; buildtransitive - - - - - - - - - - - Always - - - - diff --git a/IntelliTect.TestTools.TestFramework/ExampleTests/ExampleTests/Harness/BasePage.cs b/IntelliTect.TestTools.TestFramework/ExampleTests/ExampleTests/Harness/BasePage.cs deleted file mode 100644 index 7e0f97cc..00000000 --- a/IntelliTect.TestTools.TestFramework/ExampleTests/ExampleTests/Harness/BasePage.cs +++ /dev/null @@ -1,18 +0,0 @@ -using System; -using System.Text.Json.Serialization; -using OpenQA.Selenium; - -namespace ExampleTests.Harness -{ - public class BasePage - { - public BasePage(IWebDriver driver) - { - Driver = driver; - } - - public Uri BaseUrl { get; set; } = new Uri("https://intellitect.com/"); - [JsonIgnore] - protected IWebDriver Driver { get; set; } - } -} diff --git a/IntelliTect.TestTools.TestFramework/ExampleTests/ExampleTests/Harness/Blogs.cs b/IntelliTect.TestTools.TestFramework/ExampleTests/ExampleTests/Harness/Blogs.cs deleted file mode 100644 index 504cd3bc..00000000 --- a/IntelliTect.TestTools.TestFramework/ExampleTests/ExampleTests/Harness/Blogs.cs +++ /dev/null @@ -1,9 +0,0 @@ -using OpenQA.Selenium; - -namespace ExampleTests.Harness -{ - public class Blogs : BasePage - { - public Blogs(IWebDriver driver) : base(driver) { } - } -} diff --git a/IntelliTect.TestTools.TestFramework/ExampleTests/ExampleTests/Harness/HomePage.cs b/IntelliTect.TestTools.TestFramework/ExampleTests/ExampleTests/Harness/HomePage.cs deleted file mode 100644 index 4e97a5e1..00000000 --- a/IntelliTect.TestTools.TestFramework/ExampleTests/ExampleTests/Harness/HomePage.cs +++ /dev/null @@ -1,16 +0,0 @@ -using OpenQA.Selenium; - -namespace ExampleTests.Harness -{ - public class HomePage : BasePage - { - public HomePage(IWebDriver driver) : base(driver) { } - - public void NavigateToPage() - { - Driver.Navigate().GoToUrl(BaseUrl); - } - - public IWebElement Body => Driver.FindElement(By.TagName("body")); - } -} diff --git a/IntelliTect.TestTools.TestFramework/ExampleTests/ExampleTests/Harness/IntelliTectWebpage.cs b/IntelliTect.TestTools.TestFramework/ExampleTests/ExampleTests/Harness/IntelliTectWebpage.cs deleted file mode 100644 index 7923e933..00000000 --- a/IntelliTect.TestTools.TestFramework/ExampleTests/ExampleTests/Harness/IntelliTectWebpage.cs +++ /dev/null @@ -1,19 +0,0 @@ -using OpenQA.Selenium; -using System.Text.Json.Serialization; - -namespace ExampleTests.Harness -{ - public class IntelliTectWebpage : BasePage - { - public IntelliTectWebpage(IWebDriver driver) : base(driver) - { - HomePage = new HomePage(Driver); - Blogs = new Blogs(Driver); - } - - [JsonIgnore] - public HomePage HomePage { get; } - [JsonIgnore] - public Blogs Blogs { get; } - } -} diff --git a/IntelliTect.TestTools.TestFramework/ExampleTests/ExampleTests/IntelliTectTests.cs b/IntelliTect.TestTools.TestFramework/ExampleTests/ExampleTests/IntelliTectTests.cs deleted file mode 100644 index d48e71c9..00000000 --- a/IntelliTect.TestTools.TestFramework/ExampleTests/ExampleTests/IntelliTectTests.cs +++ /dev/null @@ -1,63 +0,0 @@ -using IntelliTect.TestTools.TestFramework; -using OpenQA.Selenium; -using Xunit; -using ExampleTests.Data; - -namespace ExampleTests -{ - public class IntelliTectTests - { - // Convert to tests for real websites. - // For scenarios I can't do on IntelliTect's site, try: - // http://the-internet.herokuapp.com/ - // https://www.ultimateqa.com/automation/ - // https://demoqa.com/ - // http://automationpractice.com/index.php - // https://www.telerik.com/support/demos <-- Might be good for multi-language testing? Check out ConversationUI - // https://restful-booker.herokuapp.com/ <-- for API tests - - [Fact] - public void Test1() - { - var expectedResult = new SiteStatus - { - IsHeaderAvailable = true, - IsBodyAvailable = true - }; - - TestBuilder builder = new(); - builder - .AddLogger() - .AddDependencyService(new WebDriverFactory("Chrome").Driver) - .AddDependencyService() - .AddTestBlock() - .AddTestBlock(expectedResult) - .ExecuteTestCase(); - } - - [Fact] - public void RegisterMembership() - { - TestBuilder builder = new(); - builder - .AddDependencyService(new WebDriverFactory("Chrome").Driver) - .AddDependencyService() - .AddTestBlock("NewTester", "McTest") - .AddTestBlock() - .ExecuteTestCase(); - } - - [Fact] - public void LogIn() - { - TestBuilder builder = new(); - builder - .AddDependencyService(new WebDriverFactory("Chrome").Driver) - .AddDependencyService(new AccountFactory().Account) - .AddDependencyService() - .AddTestBlock() - .AddTestBlock() - .ExecuteTestCase(); - } - } -} \ No newline at end of file diff --git a/IntelliTect.TestTools.TestFramework/ExampleTests/ExampleTests/NewLogger.cs b/IntelliTect.TestTools.TestFramework/ExampleTests/ExampleTests/NewLogger.cs deleted file mode 100644 index 7cdbfb62..00000000 --- a/IntelliTect.TestTools.TestFramework/ExampleTests/ExampleTests/NewLogger.cs +++ /dev/null @@ -1,44 +0,0 @@ -using IntelliTect.TestTools.TestFramework; -using System; -using System.Collections.Generic; -using System.Text; - -namespace ExampleTests -{ - public class NewLogger : ILogger - { - public string TestCaseKey { get; set; } - public string CurrentTestBlock { get; set; } - - public void Debug(string message) - { - Log($"{TestCaseKey} - {CurrentTestBlock} - Debug: {message}"); - } - - public void Error(string message) - { - Log($"{TestCaseKey} - {CurrentTestBlock} - Error: {message}"); - } - - public void Info(string message) - { - Log($"{TestCaseKey} - {CurrentTestBlock} - Info: {message}"); - } - - public void TestBlockInput(string input) - { - Log($"{TestCaseKey} - {CurrentTestBlock} - Input: {input}"); - } - - public void TestBlockOutput(string output) - { - Log($"{TestCaseKey} - {CurrentTestBlock} - Output: {output}"); - } - - private void Log(string message) - { - System.Diagnostics.Debug.WriteLine(message); - System.Console.WriteLine(message); - } - } -} diff --git a/IntelliTect.TestTools.TestFramework/ExampleTests/ExampleTests/TestBlocks/LogIn.cs b/IntelliTect.TestTools.TestFramework/ExampleTests/ExampleTests/TestBlocks/LogIn.cs deleted file mode 100644 index 0a8306e7..00000000 --- a/IntelliTect.TestTools.TestFramework/ExampleTests/ExampleTests/TestBlocks/LogIn.cs +++ /dev/null @@ -1,17 +0,0 @@ -using ExampleTests.Data; -using Xunit; - -namespace ExampleTests.TestBlocks -{ - public class LogIn : TestBlockBase - { - public Account Account { get; set; } - - public void Execute() - { - // Do stuff with account object - Assert.True(Account.Id != 0); - Assert.False(string.IsNullOrWhiteSpace(Account.Password)); - } - } -} diff --git a/IntelliTect.TestTools.TestFramework/ExampleTests/ExampleTests/TestBlocks/NavigateToWebsite.cs b/IntelliTect.TestTools.TestFramework/ExampleTests/ExampleTests/TestBlocks/NavigateToWebsite.cs deleted file mode 100644 index 8f055516..00000000 --- a/IntelliTect.TestTools.TestFramework/ExampleTests/ExampleTests/TestBlocks/NavigateToWebsite.cs +++ /dev/null @@ -1,13 +0,0 @@ -using ExampleTests.Data; -using OpenQA.Selenium; - -namespace ExampleTests.TestBlocks -{ - public class NavigateToWebsite : TestBlockBase - { - public void Execute() - { - IntelliTect.HomePage.NavigateToPage(); - } - } -} diff --git a/IntelliTect.TestTools.TestFramework/ExampleTests/ExampleTests/TestBlocks/RegisterAndReturnNewAccount.cs b/IntelliTect.TestTools.TestFramework/ExampleTests/ExampleTests/TestBlocks/RegisterAndReturnNewAccount.cs deleted file mode 100644 index 2502c13c..00000000 --- a/IntelliTect.TestTools.TestFramework/ExampleTests/ExampleTests/TestBlocks/RegisterAndReturnNewAccount.cs +++ /dev/null @@ -1,12 +0,0 @@ -using ExampleTests.Data; - -namespace ExampleTests.TestBlocks -{ - public class RegisterAndReturnNewAccount : TestBlockBase - { - public Account Execute(string firstName, string lastName) - { - return new Account { FirstName = firstName, LastName = lastName, Id = 98765 }; - } - } -} diff --git a/IntelliTect.TestTools.TestFramework/ExampleTests/ExampleTests/TestBlocks/TestBlockBase.cs b/IntelliTect.TestTools.TestFramework/ExampleTests/ExampleTests/TestBlocks/TestBlockBase.cs deleted file mode 100644 index ba2f232a..00000000 --- a/IntelliTect.TestTools.TestFramework/ExampleTests/ExampleTests/TestBlocks/TestBlockBase.cs +++ /dev/null @@ -1,10 +0,0 @@ -using ExampleTests.Harness; -using IntelliTect.TestTools.TestFramework; - -namespace ExampleTests.TestBlocks -{ - public class TestBlockBase : ITestBlock - { - public IntelliTectWebpage IntelliTect { get; set; } - } -} diff --git a/IntelliTect.TestTools.TestFramework/ExampleTests/ExampleTests/TestBlocks/VerifyAccountRegisteredCorrectly.cs b/IntelliTect.TestTools.TestFramework/ExampleTests/ExampleTests/TestBlocks/VerifyAccountRegisteredCorrectly.cs deleted file mode 100644 index 21c4c89f..00000000 --- a/IntelliTect.TestTools.TestFramework/ExampleTests/ExampleTests/TestBlocks/VerifyAccountRegisteredCorrectly.cs +++ /dev/null @@ -1,15 +0,0 @@ -using ExampleTests.Data; -using Xunit; - -namespace ExampleTests.TestBlocks -{ - public class VerifyAccountRegisteredCorrectly : TestBlockBase - { - public void Execute(Account account) - { - Assert.Equal("NewTester", account.FirstName); - Assert.Equal("McTest", account.LastName); - Assert.Equal(98765, account.Id); - } - } -} diff --git a/IntelliTect.TestTools.TestFramework/ExampleTests/ExampleTests/TestBlocks/VerifyAccountSummary.cs b/IntelliTect.TestTools.TestFramework/ExampleTests/ExampleTests/TestBlocks/VerifyAccountSummary.cs deleted file mode 100644 index 54bfab5d..00000000 --- a/IntelliTect.TestTools.TestFramework/ExampleTests/ExampleTests/TestBlocks/VerifyAccountSummary.cs +++ /dev/null @@ -1,15 +0,0 @@ -using ExampleTests.Data; -using Xunit; - -namespace ExampleTests.TestBlocks -{ - public class VerifyAccountSummary : TestBlockBase - { - public void Execute(Account account) - { - Assert.Equal("Tester", account.FirstName); - Assert.Equal("McTesterson", account.LastName); - Assert.Equal(012345, account.Id); - } - } -} diff --git a/IntelliTect.TestTools.TestFramework/ExampleTests/ExampleTests/TestBlocks/VerifyWebsiteAvailability.cs b/IntelliTect.TestTools.TestFramework/ExampleTests/ExampleTests/TestBlocks/VerifyWebsiteAvailability.cs deleted file mode 100644 index e9c6aa1f..00000000 --- a/IntelliTect.TestTools.TestFramework/ExampleTests/ExampleTests/TestBlocks/VerifyWebsiteAvailability.cs +++ /dev/null @@ -1,18 +0,0 @@ -using ExampleTests.Data; -using OpenQA.Selenium; -using Xunit; - -namespace ExampleTests.TestBlocks -{ - public class VerifyWebsiteBodyIsDisplayed : TestBlockBase - { - //public Account Account { get; set; } - //public Car Car { get; set; } - //protected Data.SiteStatus ExpectedResult { get; set; } - - public void Execute(Data.SiteStatus expected) - { - Assert.Equal(expected.IsBodyAvailable, IntelliTect.HomePage.Body.Displayed); - } - } -} diff --git a/IntelliTect.TestTools.TestFramework/ExampleTests/ExampleTests/WebDriverFactory.cs b/IntelliTect.TestTools.TestFramework/ExampleTests/ExampleTests/WebDriverFactory.cs deleted file mode 100644 index e47bf7a9..00000000 --- a/IntelliTect.TestTools.TestFramework/ExampleTests/ExampleTests/WebDriverFactory.cs +++ /dev/null @@ -1,25 +0,0 @@ -using OpenQA.Selenium; -using OpenQA.Selenium.Chrome; -using System; -using System.IO; - -namespace ExampleTests -{ - public class WebDriverFactory - { - public WebDriverFactory(string browserType) - { - _BrowserType = browserType; - Driver = GetWebDriver; - } - - public Func Driver { get; private set; } - - private IWebDriver GetWebDriver(IServiceProvider service) - { - return new ChromeDriver(Directory.GetCurrentDirectory()); - } - - private string _BrowserType; - } -} diff --git a/IntelliTect.TestTools.TestFramework/ExampleTests/ExampleTests/chromedriver.exe b/IntelliTect.TestTools.TestFramework/ExampleTests/ExampleTests/chromedriver.exe deleted file mode 100644 index ae807724..00000000 Binary files a/IntelliTect.TestTools.TestFramework/ExampleTests/ExampleTests/chromedriver.exe and /dev/null differ diff --git a/IntelliTect.TestTools.TestFramework/ExampleTests/ExampleTests/chromedriver_v73.exe b/IntelliTect.TestTools.TestFramework/ExampleTests/ExampleTests/chromedriver_v73.exe deleted file mode 100644 index a26e69f6..00000000 Binary files a/IntelliTect.TestTools.TestFramework/ExampleTests/ExampleTests/chromedriver_v73.exe and /dev/null differ diff --git a/IntelliTect.TestTools.TestFramework/ExampleTests/ExampleTests/chromedriver_v74.exe b/IntelliTect.TestTools.TestFramework/ExampleTests/ExampleTests/chromedriver_v74.exe deleted file mode 100644 index 6abaee3d..00000000 Binary files a/IntelliTect.TestTools.TestFramework/ExampleTests/ExampleTests/chromedriver_v74.exe and /dev/null differ diff --git a/IntelliTect.TestTools.TestFramework/ExampleTests/ExampleTests/chromedriver_v77.exe b/IntelliTect.TestTools.TestFramework/ExampleTests/ExampleTests/chromedriver_v77.exe deleted file mode 100644 index ae807724..00000000 Binary files a/IntelliTect.TestTools.TestFramework/ExampleTests/ExampleTests/chromedriver_v77.exe and /dev/null differ diff --git a/IntelliTect.TestTools.TestFramework/IntelliTect.TestTools.TestFramework.Tests/ErrorMessages.cs b/IntelliTect.TestTools.TestFramework/IntelliTect.TestTools.TestFramework.Tests/ErrorMessages.cs deleted file mode 100644 index 2b5d50f4..00000000 --- a/IntelliTect.TestTools.TestFramework/IntelliTect.TestTools.TestFramework.Tests/ErrorMessages.cs +++ /dev/null @@ -1,11 +0,0 @@ -namespace IntelliTect.TestTools.TestFramework.Tests -{ - public static class ErrorMessages - { - public const string ExecuteError = "there must be one and only one execute method"; - public const string MissingInputError = "unable to satisfy test block input"; - public const string MismatchedExecuteOverrideError = "unable to find corresponding execute parameter"; - public const string TooManyExecuteOverridesError = "too many execute overrides were provided"; - public const string AlreadyAddedError = "multiple execute argument overrides of the same type are not allowed"; - } -} diff --git a/IntelliTect.TestTools.TestFramework/IntelliTect.TestTools.TestFramework.Tests/ExampleLogger.cs b/IntelliTect.TestTools.TestFramework/IntelliTect.TestTools.TestFramework.Tests/ExampleLogger.cs deleted file mode 100644 index d34309fc..00000000 --- a/IntelliTect.TestTools.TestFramework/IntelliTect.TestTools.TestFramework.Tests/ExampleLogger.cs +++ /dev/null @@ -1,42 +0,0 @@ -using System; - -namespace IntelliTect.TestTools.TestFramework.Tests -{ - public class ThrowingLogger : ITestCaseLogger - { - public ThrowingLogger(TestCase tc) - { - TestCase = tc; - } - - public string? TestCaseKey { get; set; } - public string? CurrentTestBlock { get; set; } - - public TestCase TestCase { get; } - - public void Debug(string message) - { - throw new NotImplementedException(); - } - - public void Critical(string message) - { - throw new NotImplementedException(); - } - - public void Info(string message) - { - throw new NotImplementedException(); - } - - public void TestBlockInput(object input) - { - throw new NotImplementedException(); - } - - public void TestBlockOutput(object output) - { - throw new NotImplementedException(); - } - } -} diff --git a/IntelliTect.TestTools.TestFramework/IntelliTect.TestTools.TestFramework.Tests/IntelliTect.TestTools.TestFramework.Tests.csproj b/IntelliTect.TestTools.TestFramework/IntelliTect.TestTools.TestFramework.Tests/IntelliTect.TestTools.TestFramework.Tests.csproj deleted file mode 100644 index 730a05a6..00000000 --- a/IntelliTect.TestTools.TestFramework/IntelliTect.TestTools.TestFramework.Tests/IntelliTect.TestTools.TestFramework.Tests.csproj +++ /dev/null @@ -1,31 +0,0 @@ - - - - net6.0 - 11.0 - enable - - CA1303; - CA1822; - - false - - - - - all - - - - - all - runtime; build; native; contentfiles; analyzers; buildtransitive - - - - - - - - - \ No newline at end of file diff --git a/IntelliTect.TestTools.TestFramework/IntelliTect.TestTools.TestFramework.Tests/TestBase.cs b/IntelliTect.TestTools.TestFramework/IntelliTect.TestTools.TestFramework.Tests/TestBase.cs deleted file mode 100644 index c12bd268..00000000 --- a/IntelliTect.TestTools.TestFramework/IntelliTect.TestTools.TestFramework.Tests/TestBase.cs +++ /dev/null @@ -1,22 +0,0 @@ -using System; -using Xunit; - -namespace IntelliTect.TestTools.TestFramework.Tests -{ - public class TestBase - { - protected static void ValidateAggregateException(AggregateException result, int expectedInnerExceptions, params string[] messages) - { - if (result is null) throw new ArgumentNullException(nameof(result)); - Assert.Equal(expectedInnerExceptions, result.InnerExceptions.Count); - - foreach(string s in messages) - { - Assert.Contains(result.InnerExceptions, - m => m.Message.Contains( - s, - StringComparison.InvariantCultureIgnoreCase)); - } - } - } -} diff --git a/IntelliTect.TestTools.TestFramework/IntelliTect.TestTools.TestFramework.Tests/TestBuilderTests/ErrorConditions/ExecuteMethodErrors.cs b/IntelliTect.TestTools.TestFramework/IntelliTect.TestTools.TestFramework.Tests/TestBuilderTests/ErrorConditions/ExecuteMethodErrors.cs deleted file mode 100644 index feefabc7..00000000 --- a/IntelliTect.TestTools.TestFramework/IntelliTect.TestTools.TestFramework.Tests/TestBuilderTests/ErrorConditions/ExecuteMethodErrors.cs +++ /dev/null @@ -1,54 +0,0 @@ -using System; -using Xunit; - -namespace IntelliTect.TestTools.TestFramework.Tests.TestBuilderTests.ErrorConditions -{ - public class ExecuteMethodErrors - { - [Fact] - public void BuildWithMissingExecuteMethodThrowsInvalidOperationException() - { - // Arrange - TestBuilder builder = new(); - - // Act - var result = Assert.Throws(() => - builder.AddTestBlock()); - - // Assert - Assert.Contains( - ErrorMessages.ExecuteError, - result.Message, - StringComparison.InvariantCultureIgnoreCase); - } - - [Fact] - public void BuildWithTwoExecuteMethodsThrowsInvalidOperationException() - { - // Arrange - TestBuilder builder = new(); - - // Act - var result = Assert.Throws(() => - builder.AddTestBlock()); - - // Assert - Assert.Contains( - ErrorMessages.ExecuteError, - result.Message, - StringComparison.InvariantCultureIgnoreCase); - } - } - - public class ExampleTestBlockWithMultipleExecuteMethods : TestBlock - { - public void Execute() - { - } - - public void Execute(string input) - { - Assert.Equal("Testing", input); - } - } -} diff --git a/IntelliTect.TestTools.TestFramework/IntelliTect.TestTools.TestFramework.Tests/TestBuilderTests/ErrorConditions/ExecuteOverrideTests.cs b/IntelliTect.TestTools.TestFramework/IntelliTect.TestTools.TestFramework.Tests/TestBuilderTests/ErrorConditions/ExecuteOverrideTests.cs deleted file mode 100644 index 8446b23e..00000000 --- a/IntelliTect.TestTools.TestFramework/IntelliTect.TestTools.TestFramework.Tests/TestBuilderTests/ErrorConditions/ExecuteOverrideTests.cs +++ /dev/null @@ -1,126 +0,0 @@ -using IntelliTect.TestTools.TestFramework.Tests.TestData.TestBlocks; -using System; -using System.Collections.Generic; -using System.Text; -using Xunit; - -namespace IntelliTect.TestTools.TestFramework.Tests.TestBuilderTests.ErrorConditions -{ - public class ExecuteOverrideTests : TestBase - { - [Fact] - public void BuildWithMismatchedOverrideAndNoOtherMatchingThrowsAggregateException() - { - // Arrange - TestBuilder builder = new(); - builder.AddTestBlock(1); - - // Act - var result = Assert.Throws(() => - builder.Build()); - - // Assert - ValidateAggregateException( - result, - 2, - ErrorMessages.MissingInputError, - ErrorMessages.MismatchedExecuteOverrideError); - } - - [Fact] - public void BuildWithTooManyOverridesAndNoOtherMatchingThrowsAggregateException() - { - // Arrange - TestBuilder builder = new(); - builder.AddTestBlock("Testing1", true); - - // Act - var result = Assert.Throws(() => - builder.Build()); - - // Assert - ValidateAggregateException( - result, - 2, - ErrorMessages.MissingInputError, - ErrorMessages.TooManyExecuteOverridesError); - } - - [Fact] - public void BuildWithMismatchedOverrideAndOneMatchingThrowsAggregateException() - { - // Arrange - TestBuilder builder = new TestBuilder() - .AddDependencyInstance("Testing") - .AddTestBlock(1); - - // Act - var result = Assert.Throws(() => - builder.Build()); - - // Assert - ValidateAggregateException( - result, - 1, - ErrorMessages.MismatchedExecuteOverrideError); - } - - [Fact] - public void BuildWithTooManyOverridesAndOneMatchingThrowsAggregateException() - { - // Arrange - TestBuilder builder = new TestBuilder() - .AddDependencyInstance("Testing") - .AddTestBlock("Testing1", true); - - // Act - var result = Assert.Throws(() => - builder.Build()); - - // Assert - ValidateAggregateException( - result, - 1, - ErrorMessages.TooManyExecuteOverridesError); - } - - [Fact] - public void BuildWithDuplicateExecuteOverridesThrowsAggregateException() - { - // Arrange - TestBuilder builder = new(); - builder.AddTestBlock("Testing1", "Testing2"); - - // Act - var result = Assert.Throws(() => - builder.Build()); - - // Assert - ValidateAggregateException( - result, - 1, - ErrorMessages.AlreadyAddedError); - } - - [Fact] - public void BuildWithExecuteOverrideOutOfOrderReturnThrowsAggregateException() - { - // Arrange - TestBuilder builder = new(); - builder - .AddTestBlock(true) - .AddTestBlock(); - - // Act - var result = Assert.Throws(() => - builder.Build()); - - // Assert - ValidateAggregateException( - result, - 2, - ErrorMessages.MismatchedExecuteOverrideError, - ErrorMessages.MissingInputError); - } - } -} diff --git a/IntelliTect.TestTools.TestFramework/IntelliTect.TestTools.TestFramework.Tests/TestBuilderTests/ErrorConditions/MultipleDependencyErrors.cs b/IntelliTect.TestTools.TestFramework/IntelliTect.TestTools.TestFramework.Tests/TestBuilderTests/ErrorConditions/MultipleDependencyErrors.cs deleted file mode 100644 index bd37f8a2..00000000 --- a/IntelliTect.TestTools.TestFramework/IntelliTect.TestTools.TestFramework.Tests/TestBuilderTests/ErrorConditions/MultipleDependencyErrors.cs +++ /dev/null @@ -1,112 +0,0 @@ -using IntelliTect.TestTools.TestFramework.Tests.TestData.TestBlocks; -using System; -using Xunit; - -namespace IntelliTect.TestTools.TestFramework.Tests.TestBuilderTests.ErrorConditions -{ - public class MultipleDependencyErrors : TestBase - { - [Fact] - public void BuildWithMissingDependencyThrowsAggregateException() - { - // Arrange - TestBuilder builder = new TestBuilder() - .AddTestBlock() - .AddTestBlock(); - - // Act - var result = Assert.Throws(() => - builder.Build()); - - // Assert - ValidateAggregateException( - result, - 2, - ErrorMessages.MissingInputError); - } - - [Fact] - public void BuildWithMismatchedDependencyThrowsAggregateException() - { - // Arrange - TestBuilder builder = new TestBuilder() - .AddDependencyInstance(true) - .AddTestBlock() - .AddTestBlock(); - - // Act - var result = Assert.Throws(() => - builder.Build()); - - // Assert - ValidateAggregateException( - result, - 2, - ErrorMessages.MissingInputError); - } - - [Fact] - public void BuildWithMismatchedDependencyAsTestBlockParamThrowsAggregateException() - { - // Arrange - TestBuilder builder = new(); - builder - .AddTestBlock(true) - .AddTestBlock(true); - - // Act - var result = Assert.Throws(() => - builder.Build()); - - // Assert - ValidateAggregateException( - result, - 4, - ErrorMessages.MissingInputError, - ErrorMessages.MismatchedExecuteOverrideError); - } - - [Fact] - public void BuildWithMismatchedTestBlockReturnThrowsAggregateException() - { - // Arrange - TestBuilder builder = new(); - builder - .AddDependencyInstance(true) - .AddTestBlock() - .AddTestBlock() - .AddTestBlock(); - - // Act - var result = Assert.Throws(() => - builder.Build()); - - // Assert - ValidateAggregateException( - result, - 2, - ErrorMessages.MissingInputError); - } - - [Fact] - public void BuildWithExecuteOverrideAndMismatchedTestBlockReturnThrowsAggregateException() - { - // Arrange - TestBuilder builder = new(); - builder - .AddTestBlock(true) - .AddTestBlock() - .AddTestBlock(); - - // Act - var result = Assert.Throws(() => - builder.Build()); - - // Assert - ValidateAggregateException( - result, - 2, - ErrorMessages.MissingInputError); - } - } -} diff --git a/IntelliTect.TestTools.TestFramework/IntelliTect.TestTools.TestFramework.Tests/TestBuilderTests/ErrorConditions/SingleDependencyErrors.cs b/IntelliTect.TestTools.TestFramework/IntelliTect.TestTools.TestFramework.Tests/TestBuilderTests/ErrorConditions/SingleDependencyErrors.cs deleted file mode 100644 index 73fef88b..00000000 --- a/IntelliTect.TestTools.TestFramework/IntelliTect.TestTools.TestFramework.Tests/TestBuilderTests/ErrorConditions/SingleDependencyErrors.cs +++ /dev/null @@ -1,125 +0,0 @@ -using IntelliTect.TestTools.TestFramework.Tests.TestData.Dependencies; -using IntelliTect.TestTools.TestFramework.Tests.TestData.TestBlocks; -using System; -using Xunit; - -namespace IntelliTect.TestTools.TestFramework.Tests.TestBuilderTests.ErrorConditions -{ - public class SingleDependencyErrors : TestBase - { - // Make sure to check for out of order returns/dependencies - - [Fact] - public void BuildWithMissingDependencyInstanceThrowsAggregateException() - { - // Arrange - TestBuilder builder = new(); - builder.AddTestBlock(); - - // Act - var result = Assert.Throws(() => - builder.Build()); - - // Assert - ValidateAggregateException( - result, - 1, - ErrorMessages.MissingInputError); - } - - [Fact] - public void BuildWithMismatchedDependencyInstanceThrowsAggregateException() - { - // Arrange - TestBuilder builder = new TestBuilder() - .AddDependencyInstance(1) - .AddTestBlock(); - - // Act - var result = Assert.Throws(() => - builder.Build()); - - // Assert - ValidateAggregateException( - result, - 1, - ErrorMessages.MissingInputError); - } - - [Fact] - public void BuildWithMismatchedExecuteReturnThrowsAggregateException() - { - // Arrange - TestBuilder builder = new(); - builder - .AddDependencyInstance(true) - .AddTestBlock() - .AddTestBlock(); - - // Act - var result = Assert.Throws(() => - builder.Build()); - - // Assert - ValidateAggregateException( - result, - 1, - ErrorMessages.MissingInputError); - } - - [Fact] - public void BuildWithOutOfOrderReturnThrowsAggregateException() - { - // Arrange - TestBuilder builder = new(); - builder - .AddDependencyInstance(true) - .AddTestBlock() - .AddTestBlock(); - - // Act - var result = Assert.Throws(() => - builder.Build()); - - // Assert - ValidateAggregateException( - result, - 1, - ErrorMessages.MissingInputError); - } - - [Fact] - public void BuildWithExecuteOverrideMismatchedExecuteReturnThrowsAggregateException() - { - // Arrange - TestBuilder builder = new(); - builder - .AddTestBlock(true) - .AddTestBlock(); - - // Act - var result = Assert.Throws(() => - builder.Build()); - - // Assert - ValidateAggregateException( - result, - 1, - ErrorMessages.MissingInputError); - } - - [Fact] - public void AddNullInstanceAndTypeThrowsArgumentNullException() - { - Assert.Throws(() => new TestBuilder() - .AddDependencyInstance(null!)); - } - - [Fact] - public void AddNullInstanceThrowsArgumentNullException() - { - Assert.Throws(() => new TestBuilder() - .AddDependencyInstance(null!)); - } - } -} diff --git a/IntelliTect.TestTools.TestFramework/IntelliTect.TestTools.TestFramework.Tests/TestBuilderTests/PositiveConditions/LoggerTests.cs b/IntelliTect.TestTools.TestFramework/IntelliTect.TestTools.TestFramework.Tests/TestBuilderTests/PositiveConditions/LoggerTests.cs deleted file mode 100644 index 5e4e4531..00000000 --- a/IntelliTect.TestTools.TestFramework/IntelliTect.TestTools.TestFramework.Tests/TestBuilderTests/PositiveConditions/LoggerTests.cs +++ /dev/null @@ -1,188 +0,0 @@ -using Xunit; - -namespace IntelliTect.TestTools.TestFramework.Tests.TestBuilderTests -{ - public class LoggerTests - { - [Fact] - public void DefaultLoggerIsAddedOnCreate() - { - // Arrange - TestCase tc = new TestBuilder() - .AddTestBlock() - .Build(); - - // Act / Assert - tc.Execute(); - } - - [Fact] - public void RemovedLoggerDoesNotThrowWhenAttemptingToActivateProp() - { - // Arrange - TestCase tc = new TestBuilder() - .RemoveLogger() - .AddTestBlock() - .Build(); - - // Act / Assert - tc.Execute(); - } - - [Fact] - public void RemovedLoggerDoesNotThrowWhenAttemptingToActivateCtor() - { - // Arrange - TestCase tc = new TestBuilder() - .RemoveLogger() - .AddTestBlock() - .Build(); - - // Act / Assert - tc.Execute(); - } - - [Fact] - public void RemovedLoggerDoesNotThrowWhenAttemptingToActivateExecuteArg() - { - // Arrange - TestCase tc = new TestBuilder() - .RemoveLogger() - .AddTestBlock() - .Build(); - - // Act / Assert - tc.Execute(); - } - - [Fact] - public void CustomLoggerAddsWithoutError() - { - // Arrange - TestCase tc = new TestBuilder() - .AddLogger() - .AddTestBlock() - .Build(); - - // Act / Assert - tc.Execute(); - } - - [Fact] - public void RemovingLoggerTwiceDoesNotThrow() - { - // Arrange - TestCase tc = new TestBuilder() - .RemoveLogger() - .RemoveLogger() - .AddTestBlock() - .Build(); - - // Act / Assert - tc.Execute(); - } - - [Fact] - public void AddingLoggerThanRemovingDoesNotThrow() - { - // Arrange - TestCase tc = new TestBuilder() - .AddLogger() - .RemoveLogger() - .AddTestBlock() - .Build(); - - // Act / Assert - tc.Execute(); - } - } - - public class DefaultLogBlock : TestBlock - { - public void Execute() - { - Assert.NotNull(Log); - Assert.IsType(Log); - } - } - - public class RemovedLogBlockProp : TestBlock - { - public void Execute() - { - Assert.Null(Log); - } - } - - public class RemovedLogBlockCtor : TestBlock - { - public RemovedLogBlockCtor(ITestCaseLogger? log) - { - Log = log; - } - - public void Execute() - { - Assert.Null(Log); - } - } - - public class RemovedLogBlockExecuteArg : TestBlock - { - public void Execute(ITestCaseLogger? log) - { - Assert.Null(log); - } - } - - public class CustomLogBlock : TestBlock - { - public void Execute() - { - Assert.NotNull(Log); - Assert.IsType(Log); - CustomLogger cl = (CustomLogger)Log; - { - Assert.True(cl.Invoked); - } - } - } - - public class CustomLogger : ITestCaseLogger - { - public CustomLogger(TestCase tc) - { - TestCase = tc; - } - public TestCase TestCase { get; } - - public string? CurrentTestBlock { get; set; } - - public bool Invoked { get; set; } - - public void Critical(string message) - { - Invoked = true; - } - - public void Debug(string message) - { - Invoked = true; - } - - public void Info(string message) - { - Invoked = true; - } - - public void TestBlockInput(object input) - { - Invoked = true; - } - - public void TestBlockOutput(object output) - { - Invoked = true; - } - } -} diff --git a/IntelliTect.TestTools.TestFramework/IntelliTect.TestTools.TestFramework.Tests/TestBuilderTests/PositiveConditions/ResolverTests.cs b/IntelliTect.TestTools.TestFramework/IntelliTect.TestTools.TestFramework.Tests/TestBuilderTests/PositiveConditions/ResolverTests.cs deleted file mode 100644 index f5631ed6..00000000 --- a/IntelliTect.TestTools.TestFramework/IntelliTect.TestTools.TestFramework.Tests/TestBuilderTests/PositiveConditions/ResolverTests.cs +++ /dev/null @@ -1,80 +0,0 @@ -using IntelliTect.TestTools.TestFramework.Tests.TestData.Dependencies; -using System; -using Xunit; - -namespace IntelliTect.TestTools.TestFramework.Tests.TestBuilderTests.PositiveConditions -{ - public class ResolverTests - { - [Fact] - public void DiReturnsCorrectObjectWhenBlockAsksForInterface() - { - TestCase tc = new TestBuilder() - .AddDependencyService() - .AddTestBlock() - .Build(); - - tc.Execute(); - } - - [Fact] - public void DiReturnsCorrectObjectWhenBlockAsksForImplementation() - { - TestCase tc = new TestBuilder() - .AddDependencyService() - .AddTestBlock() - .Build(); - - tc.Execute(); - } - - [Fact] - public void TestCaseThrowsIfBuildingWithMismatchedImplementation() - { - var tb = new TestBuilder() - .AddDependencyService() - .AddTestBlock(); - - var ex = Assert.Throws(() => tb.Build()); - Assert.Single(ex.InnerExceptions); - } - - [Fact] - public void DiReturnsCorrectObjectWhenBlockAsksOneOfMultipleImplementations() - { - TestCase tc = new TestBuilder() - .AddDependencyService() - .AddDependencyService() - .AddTestBlock() - .Build(); - - tc.Execute(); - } - - // Need to also test a dependency that's implementing multiple interfaces - } - - public class InterfaceBlock : TestBlock - { - public void Execute(IExampleDataInterface iface) - { - Assert.NotNull(iface); - } - } - - public class ImplementationBlock : TestBlock - { - public void Execute(ExampleImplementation iface) - { - Assert.NotNull(iface); - } - } - - public class IncorrectInterfaceBlock : TestBlock - { - public void Execute(OtherExampleImplementation iface) - { - Assert.NotNull(iface); - } - } -} diff --git a/IntelliTect.TestTools.TestFramework/IntelliTect.TestTools.TestFramework.Tests/TestBuilderTests/PositiveConditions/TestCasePropertyTests.cs b/IntelliTect.TestTools.TestFramework/IntelliTect.TestTools.TestFramework.Tests/TestBuilderTests/PositiveConditions/TestCasePropertyTests.cs deleted file mode 100644 index 639f0c48..00000000 --- a/IntelliTect.TestTools.TestFramework/IntelliTect.TestTools.TestFramework.Tests/TestBuilderTests/PositiveConditions/TestCasePropertyTests.cs +++ /dev/null @@ -1,170 +0,0 @@ -using IntelliTect.TestTools.TestFramework.Tests.TestData.TestBlocks; -using System; -using System.Collections.Generic; -using System.Text; -using Xunit; - -namespace IntelliTect.TestTools.TestFramework.Tests.TestBuilderTests -{ - public class TestCasePropertyTests - { - private const string _Name = "New Name"; - - [Fact] - public void TestCaseNameCanBeChanged() - { - // Arrange / Act - TestCase tc = new TestBuilder() - .AddTestCaseName(_Name) - .Build(); - - // Assert - Assert.Equal(_Name, tc.TestCaseName); - } - - [Fact] - public void NullTestMethodNameIsOverriddenToGenericTestCaseName() - { - // Arrange / Act - TestBuilder tb = new(null); - TestCase tc = tb.Build(); - - // Assert - Assert.Equal("UndefinedTestMethodName", tc.TestCaseName); - } - - [Fact] - public void TestCaseNameIsOverriddenToCallingMethod() - { - // Arrange / Act - TestBuilder tb = new(); - TestCase tc = tb.Build(); - - // Assert - Assert.Equal(nameof(TestCaseNameIsOverriddenToCallingMethod), tc.TestCaseName); - } - - [Fact] - public void TestCaseNameIsOverriddenByConstructorArg() - { - // Arrange / Act - TestBuilder tb = new(_Name); - TestCase tc = tb.Build(); - - // Assert - Assert.Equal(_Name, tc.TestCaseName); - } - - [Fact] - public void NullTestMethodNameIsOverriddenToGenericTestMethodName() - { - // Arrange / Act - TestBuilder tb = new(null); - TestCase tc = tb.Build(); - - // Assert - Assert.Equal("UndefinedTestMethodName", tc.TestMethodName); - } - - [Fact] - public void TestMethodNameIsOverriddenToCallingMethod() - { - // Arrange / Act - TestBuilder tb = new(); - TestCase tc = tb.Build(); - - // Assert - Assert.Equal(nameof(TestMethodNameIsOverriddenToCallingMethod), tc.TestMethodName); - } - - [Fact] - public void TestMethodNameIsOverriddenByConstructorArg() - { - // Arrange / Act - TestBuilder tb = new(_Name); - TestCase tc = tb.Build(); - - // Assert - Assert.Equal(_Name, tc.TestMethodName); - } - - [Fact] - public void TestCaseIdDefaultsToZero() - { - // Arrange / Act - TestBuilder tb = new(); - TestCase tc = tb.Build(); - - // Assert - Assert.Equal(0, tc.TestCaseId); - } - - [Fact] - public void TestCaseIdCanBeOverridden() - { - // Arrange / Act - TestCase tc = new TestBuilder() - .AddTestCaseId(1) - .Build(); - - // Assert - Assert.Equal(1, tc.TestCaseId); - } - - // May not need below test. - // Still undecided if this should even be configurable. - [Fact] - public void ThrowOnFinallyBlockDefaultsToTrue() - { - // Arrange / Act - TestBuilder tb = new(); - TestCase tc = tb.Build(); - - // Assert - Assert.True(tc.ThrowOnFinallyBlockException); - } - - [Fact] - public void TestCasePassedDefaultsToFalse() - { - // Arrange / Act - TestBuilder tb = new(); - TestCase tc = tb.Build(); - - // Assert - Assert.False(tc.Passed); - } - - [Fact] - public void TestCasePassedRemainsFalseOnFailure() - { - // Arrange - TestCase tc = new TestBuilder() - .AddDependencyInstance("Fail") - .AddTestBlock() - .Build(); - - // Act - Assert.Throws(() => tc.Execute()); - - // Assert - Assert.False(tc.Passed); - } - - [Fact] - public void TestCasePassedTurnsTrueOnSuccessfulExecution() - { - // Arrange - TestCase tc = new TestBuilder() - .AddDependencyInstance("Testing") - .AddTestBlock() - .Build(); - - // Act - tc.Execute(); - - // Assert - Assert.True(tc.Passed); - } - } -} diff --git a/IntelliTect.TestTools.TestFramework/IntelliTect.TestTools.TestFramework.Tests/TestCaseTests/ExecuteArgumentOverrides.cs b/IntelliTect.TestTools.TestFramework/IntelliTect.TestTools.TestFramework.Tests/TestCaseTests/ExecuteArgumentOverrides.cs deleted file mode 100644 index b1c0b848..00000000 --- a/IntelliTect.TestTools.TestFramework/IntelliTect.TestTools.TestFramework.Tests/TestCaseTests/ExecuteArgumentOverrides.cs +++ /dev/null @@ -1,80 +0,0 @@ -using IntelliTect.TestTools.TestFramework.Tests.TestData.TestBlocks; -using System; -using System.Collections.Generic; -using System.Text; -using Xunit; - -namespace IntelliTect.TestTools.TestFramework.Tests.TestCaseTests -{ - public class ExecuteArgumentOverrides - { - // Test for... - // One execute override successfully overrides something from DI container - // Two different execute overrides successfully inject - - [Fact] - public void ExecuteOverrideInjectsCorrectDependency() - { - // Arrange - TestCase tc = new TestBuilder() - .AddDependencyInstance("This will fail.") - .AddTestBlock("Testing") - .Build(); - - // Act - tc.Execute(); - - // Assert - Assert.True(tc.Passed); - } - - [Fact] - public void ExecuteOverrideWithMultipleDependenciesInjectsCorrectDependency() - { - // Arrange - TestCase tc = new TestBuilder() - .AddDependencyInstance("This will fail.") - .AddDependencyInstance(1234) - .AddTestBlock("Testing") - .Build(); - - // Act - tc.Execute(); - - // Assert - Assert.True(tc.Passed); - } - - [Fact] - public void ExecuteMultipleOverridesWithMultipleDependenciesInjectsCorrectDependency() - { - // Arrange - TestCase tc = new TestBuilder() - .AddDependencyInstance("This will fail.") - .AddDependencyInstance(4321) - .AddTestBlock("Testing", 1234) - .Build(); - - // Act - tc.Execute(); - - // Assert - Assert.True(tc.Passed); - } - - [Fact] - public void ExecuteMultipleOverridesOutOfOrderInjectsCorrectDependency() - { - // Arrange - TestCase tc = new TestBuilder() - .AddTestBlock(1234, "Testing") - .Build(); - - // Act - tc.Execute(); - - // Assert - Assert.True(tc.Passed); - } - } -} diff --git a/IntelliTect.TestTools.TestFramework/IntelliTect.TestTools.TestFramework.Tests/TestCaseTests/FinallyExecutionTests.cs b/IntelliTect.TestTools.TestFramework/IntelliTect.TestTools.TestFramework.Tests/TestCaseTests/FinallyExecutionTests.cs deleted file mode 100644 index 9a13f9d2..00000000 --- a/IntelliTect.TestTools.TestFramework/IntelliTect.TestTools.TestFramework.Tests/TestCaseTests/FinallyExecutionTests.cs +++ /dev/null @@ -1,91 +0,0 @@ -using IntelliTect.TestTools.TestFramework.Tests.TestData.Dependencies; -using IntelliTect.TestTools.TestFramework.Tests.TestData.TestBlocks; -using System; -using Xunit; - -namespace IntelliTect.TestTools.TestFramework.Tests.TestCaseTests -{ - public class FinallyExecutionTests - { - - [Fact] - public void FinallyBlockThrowsExpectedExceptionWhenNotOverridingDefaultFinallyBehavior() - { - // Arrange - TestCase tc = new TestBuilder() - .AddDependencyInstance(true) - .AddTestBlock() - .AddFinallyBlock() - .Build(); - - // Act - var ex = Assert.Throws(() => tc.Execute()); - - // Assert - Assert.NotNull(ex.InnerExceptions); - Assert.Single(ex.InnerExceptions); - Assert.Contains("Test case succeeded", - ex.Message, - StringComparison.InvariantCultureIgnoreCase); - Assert.True(tc.Passed, "Test case did not get marked as Passed when we expected it."); - } - - [Fact] - public void TestBlockAndFinallyBlockThrowsExpectedExceptionWhenNotOverridingDefaultFinallyBehavior() - { - // Arrange - TestCase tc = new TestBuilder() - .AddDependencyInstance(false) - .AddTestBlock() - .AddFinallyBlock() - .Build(); - - // Act - var ex = Assert.Throws(() => tc.Execute()); - - // Assert - Assert.NotNull(ex.InnerExceptions); - Assert.Equal(2, ex.InnerExceptions.Count); - Assert.Contains("Test case failed and finally blocks failed", - ex.Message, - StringComparison.InvariantCultureIgnoreCase); - Assert.False(tc.Passed, "Test case did not get marked as Failed when we expected it."); - } - - [Fact] - public void FinallyBlockDoesNotThrowExceptionWhenOverridingDefaultFinallyBehavior() - { - // Arrange - TestCase tc = new TestBuilder() - .AddDependencyInstance(true) - .AddTestBlock() - .AddFinallyBlock() - .Build(); - tc.ThrowOnFinallyBlockException = false; - - // Act - tc.Execute(); - - // Assert - Assert.True(tc.Passed, "Test case did not get marked as Passed when we expected it."); - } - - [Fact] - public void OnlyTestBlockThrowsExpectedExceptionWhenOverridingDefaultFinallyBehavior() - { - // Arrange - TestCase tc = new TestBuilder() - .AddDependencyInstance(false) - .AddTestBlock() - .AddFinallyBlock() - .Build(); - tc.ThrowOnFinallyBlockException = false; - - // Act - Assert.Throws(() => tc.Execute()); - - // Assert - Assert.False(tc.Passed, "Test case did not get marked as Failed when we expected it."); - } - } -} diff --git a/IntelliTect.TestTools.TestFramework/IntelliTect.TestTools.TestFramework.Tests/TestCaseTests/MultipleDependencyTests.cs b/IntelliTect.TestTools.TestFramework/IntelliTect.TestTools.TestFramework.Tests/TestCaseTests/MultipleDependencyTests.cs deleted file mode 100644 index 56822df7..00000000 --- a/IntelliTect.TestTools.TestFramework/IntelliTect.TestTools.TestFramework.Tests/TestCaseTests/MultipleDependencyTests.cs +++ /dev/null @@ -1,42 +0,0 @@ -using IntelliTect.TestTools.TestFramework.Tests.TestData.Dependencies; -using IntelliTect.TestTools.TestFramework.Tests.TestData.TestBlocks; -using Xunit; - -namespace IntelliTect.TestTools.TestFramework.Tests.TestCaseTests -{ - public class MultipleDependencyTests - { - [Fact] - public void ReturnDuplicateTypesDoesNotThrow() - { - // Arrange - TestCase tc = new TestBuilder() - .AddTestBlock(true) - .AddTestBlock(true) - .Build(); - - // Act - tc.Execute(); - - // Assert - Assert.True(tc.Passed); - } - - [Fact] - public void FetchByObjectInstanceForMultipleDependencies() - { - // Arrange - TestCase tc = new TestBuilder() - .AddDependencyInstance("Testing") - .AddDependencyInstance(1234) - .AddTestBlock() - .Build(); - - // Act - tc.Execute(); - - // Assert - Assert.True(tc.Passed); - } - } -} diff --git a/IntelliTect.TestTools.TestFramework/IntelliTect.TestTools.TestFramework.Tests/TestCaseTests/SingleDependencyTests.cs b/IntelliTect.TestTools.TestFramework/IntelliTect.TestTools.TestFramework.Tests/TestCaseTests/SingleDependencyTests.cs deleted file mode 100644 index fd066240..00000000 --- a/IntelliTect.TestTools.TestFramework/IntelliTect.TestTools.TestFramework.Tests/TestCaseTests/SingleDependencyTests.cs +++ /dev/null @@ -1,146 +0,0 @@ -using IntelliTect.TestTools.TestFramework.Tests.TestData.Dependencies; -using IntelliTect.TestTools.TestFramework.Tests.TestData.TestBlocks; -using Xunit; - -namespace IntelliTect.TestTools.TestFramework.Tests.TestCaseTests -{ - public class SingleDependencyTests - { - // Test for... - // Adding a dependency that itself does not have a satisfied dependency - // A test block output is successfully used in a subsequent test block - // Do we need to test asking for a null type? - // Do we need to test returning a null type? - - [Fact] - public void ExecuteTestWithAvailableInstanceForExecuteArg() - { - // Arrange - TestCase tc = new TestBuilder() - .AddDependencyInstance("Testing") - .AddTestBlock() - .Build(); - - // Act - tc.Execute(); - - // Assert - Assert.True(tc.Passed); - } - - [Fact] - public void ExecuteTestWithAvailableInstanceForTestBlockProperty() - { - // Arrange - TestCase tc = new TestBuilder() - .AddDependencyInstance("Testing") - .AddTestBlock() - .Build(); - - // Act - tc.Execute(); - - // Assert - Assert.True(tc.Passed); - } - - [Fact] - public void ExecuteTestWithAvailableInstanceForTestBlockConstructor() - { - // Arrange - TestCase tc = new TestBuilder() - .AddDependencyInstance("Testing") - .AddTestBlock() - .Build(); - - // Act - tc.Execute(); - - // Assert - Assert.True(tc.Passed); - } - - [Fact] - public void ExecuteTestBlockWitNonSettablePropertyDoesNotThrow() - { - // Arrange - TestCase tc = new TestBuilder() - .AddDependencyInstance("Testing") - .AddTestBlock() - .Build(); - - // Act - tc.Execute(); - - // Assert - Assert.True(tc.Passed); - } - - // Note: the following tests should be exercising out of the box MS DI functionality. - // The purpose is just to ensure that these methods don't ever accidentally get decoupled from the underlying MS service provider. - // That is also why we aren't extensively testing the same scenarios as above for the AddDependencyService method - [Fact] - public void ExecuteTestWithAvailableServiceForExecuteArg() - { - // Arrange - TestCase tc = new TestBuilder() - .AddDependencyService() - .AddTestBlock() - .Build(); - - // Act - tc.Execute(); - - // Assert - Assert.True(tc.Passed); - } - - [Fact] - public void ExecuteTestWithAvailableGenericArgumentAndInstanceForExecuteArg() - { - // Arrange - TestCase tc = new TestBuilder() - .AddDependencyInstance(new ExampleImplementation()) - .AddTestBlock() - .Build(); - - // Act - tc.Execute(); - - // Assert - Assert.True(tc.Passed); - } - - [Fact] - public void ExecuteTestWithAvailableGenericArgumentsForExecuteArg() - { - // Arrange - TestCase tc = new TestBuilder() - .AddDependencyService() - .AddTestBlock() - .Build(); - - // Act - tc.Execute(); - - // Assert - Assert.True(tc.Passed); - } - - [Fact] - public void ExecuteTestWithAvailableFactoryForExecuteArg() - { - // Arrange - TestCase tc = new TestBuilder() - .AddDependencyService(new ExampleFactory().DoesNotThrow) - .AddTestBlock() - .Build(); - - // Act - tc.Execute(); - - // Assert - Assert.True(tc.Passed); - } - } -} diff --git a/IntelliTect.TestTools.TestFramework/IntelliTect.TestTools.TestFramework.Tests/TestCaseTests/TestFailureTests.cs b/IntelliTect.TestTools.TestFramework/IntelliTect.TestTools.TestFramework.Tests/TestCaseTests/TestFailureTests.cs deleted file mode 100644 index 8fa9a0a2..00000000 --- a/IntelliTect.TestTools.TestFramework/IntelliTect.TestTools.TestFramework.Tests/TestCaseTests/TestFailureTests.cs +++ /dev/null @@ -1,44 +0,0 @@ -using IntelliTect.TestTools.TestFramework.Tests.TestData.Dependencies; -using IntelliTect.TestTools.TestFramework.Tests.TestData.TestBlocks; -using System; -using Xunit; - -namespace IntelliTect.TestTools.TestFramework.Tests.TestCaseTests -{ - public class TestFailureTests - { - [Fact] - public void TestFailureThrowsImmediatelyWithOriginalException() - { - TestBuilder builder = new(); - TestCase tc = builder - .AddDependencyInstance(false) - .AddDependencyInstance("Testing") - .AddTestBlock() - .AddTestBlock(1) - .Build(); - - var ex = Assert.Throws(() => tc.Execute()); - Assert.False(tc.Passed); - Assert.NotNull(ex.InnerException); - Assert.IsType(ex.InnerException); - Assert.Equal("test failure", ex.InnerException!.Message, ignoreCase: true); - } - - [Fact] - public void DependencyWithMissingDependencyThrowsOriginalError() - { - TestCase tc = new TestBuilder() - .AddDependencyService(new ExampleFactory().Throws) - .AddDependencyService() - .AddTestBlock() - .Build(); - - var ex = Assert.Throws(() => tc.Execute()); - Assert.False(tc.Passed); - Assert.NotNull(ex.InnerException); - Assert.IsType(ex.InnerException); - Assert.Contains("oops", ex.InnerException!.Message, StringComparison.InvariantCultureIgnoreCase); - } - } -} diff --git a/IntelliTect.TestTools.TestFramework/IntelliTect.TestTools.TestFramework.Tests/TestData/Dependencies/ExampleFactory.cs b/IntelliTect.TestTools.TestFramework/IntelliTect.TestTools.TestFramework.Tests/TestData/Dependencies/ExampleFactory.cs deleted file mode 100644 index ba719c64..00000000 --- a/IntelliTect.TestTools.TestFramework/IntelliTect.TestTools.TestFramework.Tests/TestData/Dependencies/ExampleFactory.cs +++ /dev/null @@ -1,44 +0,0 @@ -using System; - -namespace IntelliTect.TestTools.TestFramework.Tests.TestData.Dependencies -{ - public class ExampleFactory - { - public ExampleFactory() - { - DoesNotThrow = GetExampleObject; - Throws = GetAlwaysThrow; - } - - public Func Throws { get; } - public Func DoesNotThrow { get; private set; } - - private ExampleImplementation GetExampleObject(IServiceProvider service) - { - return new ExampleImplementation { Testing = "TestingOverride" }; - } - - private AlwaysThrow GetAlwaysThrow(IServiceProvider provider) - { - return new AlwaysThrow(); - } - } - - public class AlwaysThrow - { - public AlwaysThrow() - { - throw new InvalidOperationException("Oops"); - } - } - - public class SomeDependency - { - public SomeDependency(AlwaysThrow alwaysThrow) - { - AlwaysThrow = alwaysThrow; - } - - public AlwaysThrow AlwaysThrow { get; } - } -} diff --git a/IntelliTect.TestTools.TestFramework/IntelliTect.TestTools.TestFramework.Tests/TestData/Dependencies/ExampleInterface.cs b/IntelliTect.TestTools.TestFramework/IntelliTect.TestTools.TestFramework.Tests/TestData/Dependencies/ExampleInterface.cs deleted file mode 100644 index c0e94965..00000000 --- a/IntelliTect.TestTools.TestFramework/IntelliTect.TestTools.TestFramework.Tests/TestData/Dependencies/ExampleInterface.cs +++ /dev/null @@ -1,17 +0,0 @@ -namespace IntelliTect.TestTools.TestFramework.Tests.TestData.Dependencies -{ - public interface IExampleDataInterface - { - string Testing { get; set; } - } - - public class ExampleImplementation : IExampleDataInterface - { - public string Testing { get; set; } = "Testing"; - } - - public class OtherExampleImplementation : IExampleDataInterface - { - public string Testing { get; set; } = "Testing"; - } -} diff --git a/IntelliTect.TestTools.TestFramework/IntelliTect.TestTools.TestFramework.Tests/TestData/Dependencies/SimulatorClasses.cs b/IntelliTect.TestTools.TestFramework/IntelliTect.TestTools.TestFramework.Tests/TestData/Dependencies/SimulatorClasses.cs deleted file mode 100644 index 304be67e..00000000 --- a/IntelliTect.TestTools.TestFramework/IntelliTect.TestTools.TestFramework.Tests/TestData/Dependencies/SimulatorClasses.cs +++ /dev/null @@ -1,111 +0,0 @@ -using System; -using Xunit; - -namespace IntelliTect.TestTools.TestFramework.Tests.TestData.Dependencies -{ - // BREAK OUT INTO OWN FILES AS NEEDED - - public class ExampleTestBlockWithExecuteArgForOwnType : TestBlock - { - public void Execute(ExampleImplementation input) - { - if (input is null) throw new ArgumentNullException(nameof(input)); - Assert.Equal("Testing", input.Testing); - } - } - - public class ExampleTestBlockWithExecuteArgForInterface : TestBlock - { - public void Execute(IExampleDataInterface input) - { - if (input is null) throw new ArgumentNullException(nameof(input)); - Assert.Equal("Testing", input.Testing); - } - } - - public class ExampleTestBlockWithPropertyForOwnType : TestBlock - { - public ExampleImplementation Input { get; set; } = new(); - - public void Execute() - { - Assert.Equal("Testing", Input.Testing); - } - } - - public class ExampleTestBlockWithConstructorForOwnType : TestBlock - { - public ExampleTestBlockWithConstructorForOwnType(ExampleImplementation input) - { - Input = input; - } - - public void Execute() - { - Assert.Equal("Testing", Input.Testing); - } - - private ExampleImplementation Input { get; } - } - - public class ExampleTestBlockForFactoryWithExecuteArg : TestBlock - { - public void Execute(ExampleImplementation input) - { - if (input is null) throw new ArgumentNullException(nameof(input)); - Assert.Equal("TestingOverride", input.Testing); - } - } - - public class ExampleTestBlockForFactoryWithProperty : TestBlock - { - public ExampleImplementation Input { get; set; } = new(); - - public void Execute() - { - Assert.Equal("TestingOverride", Input.Testing); - } - } - - public class ExampleTestBlockForFactoryWithConstructor : TestBlock - { - public ExampleTestBlockForFactoryWithConstructor(ExampleImplementation input) - { - Input = input; - } - - public void Execute() - { - Assert.Equal("TestingOverride", Input.Testing); - } - - private ExampleImplementation Input { get; } - } - - public class ExampleTestBlockWithPropertyWithNoSetter : TestBlock - { - public string Input { get; } = "Not Set"; - - public void Execute() - { - Assert.Equal("Not Set", Input); - } - } - - public class ExampleLoggerUsage : TestBlock - { - public void Execute(ITestCaseLogger log) - { - if (log is null) throw new ArgumentNullException(nameof(log)); - log.Debug("This should throw"); - } - } - - public class ExampleFinallyBlock : TestBlock - { - public void Execute(bool result) - { - Assert.True(result, "This is an expected failure."); - } - } -} diff --git a/IntelliTect.TestTools.TestFramework/IntelliTect.TestTools.TestFramework.Tests/TestData/TestBlocks/MultipleDependencyBlocks.cs b/IntelliTect.TestTools.TestFramework/IntelliTect.TestTools.TestFramework.Tests/TestData/TestBlocks/MultipleDependencyBlocks.cs deleted file mode 100644 index 21dc1ba3..00000000 --- a/IntelliTect.TestTools.TestFramework/IntelliTect.TestTools.TestFramework.Tests/TestData/TestBlocks/MultipleDependencyBlocks.cs +++ /dev/null @@ -1,24 +0,0 @@ -using Xunit; - -namespace IntelliTect.TestTools.TestFramework.Tests.TestData.TestBlocks -{ - public class ExampleTestBlockWithMultipleDependencies : TestBlock - { - public string? InputText { get; set; } - - public void Execute(int inputNumber) - { - Assert.Equal("Testing", InputText); - Assert.Equal(1234, inputNumber); - } - } - - public class ExampleTestBlockWithMultipleExecuteArgs : TestBlock - { - public void Execute(string inputText, int inputNumber) - { - Assert.Equal("Testing", inputText); - Assert.Equal(1234, inputNumber); - } - } -} diff --git a/IntelliTect.TestTools.TestFramework/IntelliTect.TestTools.TestFramework.Tests/TestData/TestBlocks/SingleDependencyBlocks.cs b/IntelliTect.TestTools.TestFramework/IntelliTect.TestTools.TestFramework.Tests/TestData/TestBlocks/SingleDependencyBlocks.cs deleted file mode 100644 index b26c1c8d..00000000 --- a/IntelliTect.TestTools.TestFramework/IntelliTect.TestTools.TestFramework.Tests/TestData/TestBlocks/SingleDependencyBlocks.cs +++ /dev/null @@ -1,73 +0,0 @@ -using IntelliTect.TestTools.TestFramework.Tests.TestData.Dependencies; -using System; -using Xunit; - -namespace IntelliTect.TestTools.TestFramework.Tests.TestData.TestBlocks -{ - public class ExampleTestBlockWithExecuteArg : TestBlock - { - public void Execute(string input) - { - Assert.Equal("Testing", input); - } - } - - public class ExampleTestBlockWithProperty : TestBlock - { - public string? Input { get; set; } - - public void Execute() - { - Assert.Equal("Testing", Input); - } - } - - public class ExampleTestBlockWithConstructor : TestBlock - { - public ExampleTestBlockWithConstructor(string input) - { - Input = input; - } - - private string Input { get; } - - public void Execute() - { - Assert.Equal("Testing", Input); - } - } - - public class ExampleTestBlockWithStringReturn : TestBlock - { - public string Execute() - { - return "Testing"; - } - } - - public class ExampleTestBlockWithBoolReturn : TestBlock - { - public bool Execute(bool arg) - { - if (!arg) - { - throw new DivideByZeroException("Test failure"); - } - else - { - return false; - } - } - } - - public class SomeTestBlock : ITestBlock - { - public ITestCaseLogger? Log { get; } - - public bool Execute(SomeDependency dep) - { - Assert.NotNull(dep); - return true; - } - } -} diff --git a/IntelliTect.TestTools.TestFramework/IntelliTect.TestTools.TestFramework/Block.cs b/IntelliTect.TestTools.TestFramework/IntelliTect.TestTools.TestFramework/Block.cs deleted file mode 100644 index c0b3d2ff..00000000 --- a/IntelliTect.TestTools.TestFramework/IntelliTect.TestTools.TestFramework/Block.cs +++ /dev/null @@ -1,23 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Reflection; - -namespace IntelliTect.TestTools.TestFramework -{ - internal class Block - { - public Block(Type type, MethodInfo execute) - { - Type = type; - ExecuteMethod = execute; - } - - internal Type Type { get; set; } - internal bool IsFinallyBlock { get; set; } - internal ParameterInfo[] ConstructorParams { get; set; } = Array.Empty(); - internal MethodInfo ExecuteMethod { get; set; } - internal ParameterInfo[] ExecuteParams { get; set; } = Array.Empty(); - internal Dictionary ExecuteArgumentOverrides { get; set; } = new(); - internal PropertyInfo[] PropertyParams { get; set; } = Array.Empty(); - } -} diff --git a/IntelliTect.TestTools.TestFramework/IntelliTect.TestTools.TestFramework/DebugLogger.cs b/IntelliTect.TestTools.TestFramework/IntelliTect.TestTools.TestFramework/DebugLogger.cs deleted file mode 100644 index 7f640d37..00000000 --- a/IntelliTect.TestTools.TestFramework/IntelliTect.TestTools.TestFramework/DebugLogger.cs +++ /dev/null @@ -1,68 +0,0 @@ -using System; -using System.Text.Json; -using System.Text.Json.Serialization; - -namespace IntelliTect.TestTools.TestFramework -{ - public class DebugLogger : ITestCaseLogger - { - public DebugLogger(TestCase testCase) - { - TestCase = testCase; - } - - public TestCase TestCase { get; } - public string? CurrentTestBlock { get; set; } - - public void Debug(string message) - { - LogToDebug($"{TestCase.TestMethodName} - {CurrentTestBlock} - Debug: {message}"); - } - - public void Critical(string message) - { - LogToDebug($"{TestCase.TestMethodName} - {CurrentTestBlock} - Error: {message}"); - } - - public void Info(string message) - { - LogToDebug($"{TestCase.TestMethodName} - {CurrentTestBlock} - Info: {message}"); - } - - public void TestBlockInput(object input) - { - string inputString = Serialize(input); - LogToDebug($"{TestCase.TestMethodName} - {CurrentTestBlock} - Input arguments: {inputString}"); - } - - public void TestBlockOutput(object output) - { - string outputString = Serialize(output); - LogToDebug($"{TestCase.TestMethodName} - {CurrentTestBlock} - Output returns: {outputString}"); - } - - private void LogToDebug(object message) - { - System.Diagnostics.Debug.WriteLine(message); - } - - private string Serialize(object objectToParse) - { - if(objectToParse is null) throw new ArgumentNullException(nameof(objectToParse)); - // JsonSerializer.Serialize has some different throw behavior between versions. - // One version threw an exception that occurred on a property, which happened to be a Selenium WebDriverException. - // In this one specific case, catch all exceptions and move on to provide standard behavior to all package consumers. - // TL;DR: we don't want logging failures to interrupt the test run. - try - { - return JsonSerializer.Serialize(objectToParse, new JsonSerializerOptions { WriteIndented = true }); - } -#pragma warning disable CA1031 // Do not catch general exception types - catch (Exception e) -#pragma warning restore CA1031 // Do not catch general exception types - { - return $"Unable to serialize object {objectToParse.GetType()} to JSON. Mark the relevant property with the [{nameof(JsonIgnoreAttribute)}] attribute: {e}"; - } - } - } -} diff --git a/IntelliTect.TestTools.TestFramework/IntelliTect.TestTools.TestFramework/ITestBlock.cs b/IntelliTect.TestTools.TestFramework/IntelliTect.TestTools.TestFramework/ITestBlock.cs deleted file mode 100644 index dc386d4f..00000000 --- a/IntelliTect.TestTools.TestFramework/IntelliTect.TestTools.TestFramework/ITestBlock.cs +++ /dev/null @@ -1,7 +0,0 @@ -namespace IntelliTect.TestTools.TestFramework -{ - public interface ITestBlock - { - ITestCaseLogger? Log { get; } - } -} \ No newline at end of file diff --git a/IntelliTect.TestTools.TestFramework/IntelliTect.TestTools.TestFramework/ITestCaseLogger.cs b/IntelliTect.TestTools.TestFramework/IntelliTect.TestTools.TestFramework/ITestCaseLogger.cs deleted file mode 100644 index d3c72dd2..00000000 --- a/IntelliTect.TestTools.TestFramework/IntelliTect.TestTools.TestFramework/ITestCaseLogger.cs +++ /dev/null @@ -1,13 +0,0 @@ -namespace IntelliTect.TestTools.TestFramework -{ - public interface ITestCaseLogger - { - TestCase TestCase { get; } - string? CurrentTestBlock { get; set; } - void Debug(string message); - void Info(string message); - void Critical(string message); - void TestBlockInput(object input); - void TestBlockOutput(object output); - } -} diff --git a/IntelliTect.TestTools.TestFramework/IntelliTect.TestTools.TestFramework/IntelliTect.TestTools.TestFramework.csproj b/IntelliTect.TestTools.TestFramework/IntelliTect.TestTools.TestFramework/IntelliTect.TestTools.TestFramework.csproj deleted file mode 100644 index 12071ac1..00000000 --- a/IntelliTect.TestTools.TestFramework/IntelliTect.TestTools.TestFramework/IntelliTect.TestTools.TestFramework.csproj +++ /dev/null @@ -1,25 +0,0 @@ - - - - netstandard2.0 - 11.0 - enable - - CA1303; - - - - - - all - - - - - - - - - - - \ No newline at end of file diff --git a/IntelliTect.TestTools.TestFramework/IntelliTect.TestTools.TestFramework/TestBlock.cs b/IntelliTect.TestTools.TestFramework/IntelliTect.TestTools.TestFramework/TestBlock.cs deleted file mode 100644 index 99906341..00000000 --- a/IntelliTect.TestTools.TestFramework/IntelliTect.TestTools.TestFramework/TestBlock.cs +++ /dev/null @@ -1,7 +0,0 @@ -namespace IntelliTect.TestTools.TestFramework -{ - public class TestBlock : ITestBlock - { - public ITestCaseLogger? Log { get; set; } - } -} \ No newline at end of file diff --git a/IntelliTect.TestTools.TestFramework/IntelliTect.TestTools.TestFramework/TestBuilder.cs b/IntelliTect.TestTools.TestFramework/IntelliTect.TestTools.TestFramework/TestBuilder.cs deleted file mode 100644 index ed9ed9f8..00000000 --- a/IntelliTect.TestTools.TestFramework/IntelliTect.TestTools.TestFramework/TestBuilder.cs +++ /dev/null @@ -1,327 +0,0 @@ -using Microsoft.Extensions.DependencyInjection; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Reflection; -using System.Runtime.CompilerServices; - -namespace IntelliTect.TestTools.TestFramework -{ - public class TestBuilder - { - /// - /// Constructs a TestBuilder instance with a given test name. - /// - /// The name for the test method, defaults to the calling member. - public TestBuilder([CallerMemberName] string? testMethodName = null) - { - TestMethodName = testMethodName ?? "UndefinedTestMethodName"; - AddLogger(); - } - - private string? TestCaseName { get; set; } - private string TestMethodName { get; set; } - private int TestCaseId { get; set; } - private List TestBlocks { get; } = new(); - private List FinallyBlocks { get; } = new(); - private IServiceCollection Services { get; } = new ServiceCollection(); - private bool HasLogger { get; set; } = true; - private List ValidationExceptions { get; } = new(); - - /// - /// Used when a test case may be associated to a unique ID. - /// - /// The key associated to this test. - /// - public TestBuilder AddTestCaseId(int testCaseKey) - { - TestCaseId = testCaseKey; - return this; - } - - /// - /// Used to give a friendly name to the test case. Defaults to the test method name. - /// - /// A friendly name associated to the test case. - /// - public TestBuilder AddTestCaseName(string testCaseName) - { - TestCaseName = testCaseName; - return this; - } - - /// - /// Adds a test block (some related group of test actions) with an optional list of arguments.
- /// Any argument passed here will override all other matched arguments for the blocks TestBlock.Execute() method. - ///
- /// The type of dependency a test block needs to execute. - /// The list of arguments to fulfill a set of Execute(params object[]) parameters. - /// This - public TestBuilder AddTestBlock(params object[] testBlockArgs) where T : ITestBlock - { - Block tb = CreateBlock(false, testBlockArgs); - TestBlocks.Add(tb); - return this; - } - - /// - /// Adds a finally block, a special test block that will always run after all test blocks, regardless of if a prior test block fails. - /// - /// The type of dependency a test block needs to execute. - /// The list of arguments to fulfill a set of Execute(params object[]) parameters. - /// - public TestBuilder AddFinallyBlock(params object[] finallyBlockArgs) where T : ITestBlock - { - Block fb = CreateBlock(true, finallyBlockArgs); - FinallyBlocks.Add(fb); - return this; - } - - /// - /// Adds a service as a factory a container that is used to fulfill TestBlock dependencies. - /// - /// The type of dependency a test block needs to execute. - /// The factory to provide an instance of the type needed for a test block to execute. - /// - public TestBuilder AddDependencyService(Func serviceFactory) - { - Services.AddSingleton(typeof(T), serviceFactory); - return this; - } - - /// - /// Adds a service as a Type to the container that is used to fulfill TestBlock dependencies. - /// - /// The type of test block, as an ITestBlock, to run - /// This - public TestBuilder AddDependencyService() - { - Services.AddSingleton(typeof(T)); - return this; - } - - /// - /// Adds a service as a Type with an Implementation that is used to fulfill TestBlock dependencies. - /// - /// The type of the service to add. - /// A specific implementation of the type. - /// This - public TestBuilder AddDependencyService() - { - Services.AddSingleton(typeof(TServiceType), typeof(TImplementationType)); - return this; - } - - /// - /// Adds an instance of a Type to the container that is needed for a TestBlock to execute. - /// - /// The instance of a Type that a TestBlock needs - /// this - public TestBuilder AddDependencyInstance(object objToAdd) - { - if (objToAdd is null) throw new ArgumentNullException(nameof(objToAdd)); - Services.AddSingleton(objToAdd.GetType(), objToAdd); - return this; - } - - /// - /// Adds an instance of a Type to the container that is needed for a TestBlock to execute. - /// - /// The type of the object. - /// The object to add. - /// - public TestBuilder AddDependencyInstance(object objToAdd) - { - if (objToAdd is null) throw new ArgumentNullException(nameof(objToAdd)); - Services.AddSingleton(typeof(T), objToAdd); - return this; - } - - /// - /// Adds a new logger to be used during test execution. This will remove any existing loggers. - /// - /// Type of logger. - /// - public TestBuilder AddLogger() where T : ITestCaseLogger - { - RemoveLogger(); - Services.AddSingleton(typeof(ITestCaseLogger), typeof(T)); - HasLogger = true; - return this; - } - - /// - /// Removes the current logger from the test case dependency registration.
- /// NOTE: if you remove the logger but have a test block or dependency that needs it, an error will occur. - ///
- /// this - public TestBuilder RemoveLogger() - { - ServiceDescriptor? logger = Services.FirstOrDefault(d => d.ServiceType == typeof(ITestCaseLogger)); - if (logger is { }) Services.Remove(logger); - HasLogger = false; - return this; - } - - /// - /// Builds the test case. This will validate that test block dependencies are satisfied. - /// - /// An object that can be used to execute a test case. - /// - public TestCase Build() - { - if (string.IsNullOrWhiteSpace(TestCaseName)) - { - TestCaseName = TestMethodName; - } - - TestCase testCase = new(TestCaseName!, TestMethodName, TestCaseId, Services); - testCase.HasLogger = HasLogger; - Services.AddSingleton(testCase); - - // Probably need to profile all of this for performance at some point. - // Need to make sure if we're running hundreds or thousands of tests that we're not adding significant amount of time to that. - - List outputs = new(); - foreach (Block tb in TestBlocks) - { - GatherDependencies(tb, outputs); - testCase.TestBlocks.Add(tb); - } - - foreach (Block fb in FinallyBlocks) - { - GatherDependencies(fb, outputs); - testCase.FinallyBlocks.Add(fb); - } - - if (ValidationExceptions.Count > 0) - { - throw new AggregateException(ValidationExceptions); - } - - return testCase; - } - - private Block CreateBlock(bool isFinally, params object[] args) - { - Services.AddTransient(typeof(T)); - - MethodInfo execute = FindExecuteMethod(typeof(T)); - Block b = new(typeof(T), execute); - foreach (object a in args) - { - if(b.ExecuteArgumentOverrides.ContainsKey(a.GetType())) - { - ValidationExceptions.Add(new ArgumentException($"TestBlock: {typeof(T)} - Multiple execute argument overrides of the same type are not allowed: {a.GetType()}")); - } - else - { - b.ExecuteArgumentOverrides.Add(a.GetType(), a); - } - } - b.IsFinallyBlock = isFinally; - return b; - } - - private static MethodInfo FindExecuteMethod(Type type) - { - List? executeMethod = type.GetMethods().Where(m => m.Name.ToUpperInvariant() == "EXECUTE").ToList(); - if (executeMethod.Count is not 1) - { - // Don't add to validation messages we don't have any reasonable assurance what the dependencies should be. - throw new InvalidOperationException( - $"TestBlock: {type} - There must be one and only one Execute method on a test block."); - } - - return executeMethod[0]; - } - - private void GatherDependencies( - Block tb, - List outputs) - { - ConstructorInfo[]? constructors = tb.Type.GetConstructors(); - - if (constructors.Length > 1) - { - // Don't add to validation messages we don't have any reasonable assurance what the dependencies should be. - throw new InvalidOperationException( - $"TestBlock: {tb.Type} - TestFramework supports zero or one constructors on test blocks."); - } - - tb.ConstructorParams = constructors[0].GetParameters(); - tb.PropertyParams = tb.Type.GetProperties(); - tb.ExecuteParams = tb.ExecuteMethod.GetParameters(); - // Currently do not support Fields. Should we check for them anyway at least to throw? - - HashSet inputs = new(); - foreach (var c in tb.ConstructorParams) - { - inputs.Add(c.ParameterType); - } - foreach (var p in tb.PropertyParams) - { - if(p.CanWrite) - { - inputs.Add(p.PropertyType); - } - } - foreach (var e in tb.ExecuteParams) - { - inputs.Add(e.ParameterType); - } - - if (!HasLogger) inputs.RemoveWhere(i => i == typeof(ITestCaseLogger)); - if (tb.ExecuteArgumentOverrides.Count is not 0) - { - if (tb.ExecuteArgumentOverrides.Count > tb.ExecuteParams.Length) - { - ValidationExceptions.Add(new ArgumentException($"TestBlock: {tb.Type} - Too many execute overrides were provided. More were handed in than parameters on Execute method.")); - } - else - { - foreach (KeyValuePair eao in tb.ExecuteArgumentOverrides) - { - if (!tb.ExecuteParams.Any(ep => ep.ParameterType == eao.Key)) - { - ValidationExceptions.Add(new ArgumentException($"TestBlock: {tb.Type} - Unable to find corresponding Execute parameter for override argument {eao}")); - } - else - { - // Input is satisfied by execute argument override. - // No need to check later. - inputs.Remove(eao.Key); - } - } - } - } - - foreach (Type i in inputs) - { - CheckContainerForFirstLevelDependency(i, outputs, $"TestBlock: {tb.Type} - Unable to satisfy test block input: {i}."); - } - - Type executeReturns = tb.ExecuteMethod.ReturnType; - if (executeReturns != typeof(void)) - { - outputs.Add(executeReturns); - } - } - - private void CheckContainerForFirstLevelDependency(Type type, List outputs, string errorMessage) - { - ServiceDescriptor? obj = Services.FirstOrDefault(x => x.ServiceType == type || x.ImplementationType == type); - if (obj is null) - { - Type? output = outputs.FirstOrDefault(o => o == type || o == type); - - if (output is null) - { - if (type is ITestCaseLogger) return; - ValidationExceptions.Add(new InvalidOperationException(errorMessage)); - } - } - } - } -} diff --git a/IntelliTect.TestTools.TestFramework/IntelliTect.TestTools.TestFramework/TestCase.cs b/IntelliTect.TestTools.TestFramework/IntelliTect.TestTools.TestFramework/TestCase.cs deleted file mode 100644 index ee3f18ce..00000000 --- a/IntelliTect.TestTools.TestFramework/IntelliTect.TestTools.TestFramework/TestCase.cs +++ /dev/null @@ -1,432 +0,0 @@ -using Microsoft.Extensions.DependencyInjection; -using System; -using System.Collections.Generic; -using System.Globalization; -using System.Linq; -using System.Reflection; - -namespace IntelliTect.TestTools.TestFramework -{ - public class TestCase - { - public TestCase(string testCaseName, string testMethodName, int testCaseId, IServiceCollection services) - { - TestCaseName = testCaseName; - TestMethodName = testMethodName; - TestCaseId = testCaseId; - ServiceCollection = services; - } - // Switch to get; init; when this can be updated to .net5 - // Maybe target .net5 support for v3? - /// - /// The friendly name for the test case. - /// - public string TestCaseName { get; } - /// - /// The unit test method name. Defaults to the calling member for new TestBuilder(). - /// - public string TestMethodName { get; } - /// - /// Any ID associated with the test case, otherwise 0. - /// - public int TestCaseId { get; } - /// - /// If this test case should throw if a finally block has an exception. Defaults to true. - ///
- /// If a finally block fails and this property is true, the test case is still considered passed internally, but most unit test frameworks will mark the test failed. - ///
- public bool ThrowOnFinallyBlockException { get; set; } = true; - - // May make sense to make some of the below public if it's needed for debugging. - // If so, definitely need to change them to internal or private sets. - - internal List TestBlocks { get; set; } = new(); - internal List FinallyBlocks { get; set; } = new(); - internal bool HasLogger { get; set; } = true; - - private ITestCaseLogger? Log { get; set; } - private IServiceCollection ServiceCollection { get; } - private Dictionary BlockOutput { get; } = new(); - private Exception? TestBlockException { get; set; } - private List FinallyBlockExceptions { get; } = new(); - - // Has this test case passed? Will only be true if every regular test block succeeds. - public bool Passed { get; set; } - - /// - /// Executes the test case. - /// - /// The exception describing a test failure. - /// Occurs when finally blocks fail, or the test fails and at least one finally block fails. - public void Execute() - { - ServiceProvider services = ServiceCollection.BuildServiceProvider(); - using (var testCaseScope = services.CreateScope()) - { - Log = testCaseScope.ServiceProvider.GetService(); - if (Log is not null) - { - Log.CurrentTestBlock = "N/A"; - } - - Log?.Info($"Starting test case: {TestCaseName}"); - - foreach (var tb in TestBlocks) - { - if (Log is not null) Log.CurrentTestBlock = tb.Type.ToString(); - Log?.Debug($"Starting test block: {tb.Type}"); - - if (!TryGetBlock(testCaseScope, tb, out object testBlockInstance)) break; - if (!TrySetBlockProperties(testCaseScope, tb, testBlockInstance)) break; - if (!TryGetExecuteArguments(testCaseScope, tb, out List executeArgs)) break; - - if (!TryRunBlock(tb, testBlockInstance, executeArgs)) - { - if (TestBlockException is null) - { - TestBlockException = new( - $"Unknown error occurred while running test block {tb}. " + - "Please file an issue: https://github.com/IntelliTect/TestTools/issues"); - } - break; - } - } - - foreach (var fb in FinallyBlocks) - { - if (Log is not null) Log.CurrentTestBlock = fb.Type.ToString(); - Log?.Debug($"Starting finally block: {fb.Type}"); - - if (!TryGetBlock(testCaseScope, fb, out var finallyBlockInstance)) continue; - if (!TrySetBlockProperties(testCaseScope, fb, finallyBlockInstance)) continue; - if (!TryGetExecuteArguments(testCaseScope, fb, out List executeArgs)) continue; - - if (!TryRunBlock(fb, finallyBlockInstance, executeArgs)) - { - Log?.Critical($"Finally block failed: {FinallyBlockExceptions.LastOrDefault()}"); - } - } - - if (TestBlockException is null) - { - Passed = true; - Log?.Info("Test case finished successfully."); - } - else - { - Log?.Critical($"Test case failed: {TestBlockException}"); - } - } - - services.Dispose(); - - // This seems... gross. Revisit after sleeping. - // Maybe call out in a code review. - if (TestBlockException is not null - && (!ThrowOnFinallyBlockException - || !FinallyBlockExceptions.Any())) - { - throw new TestCaseException("Test case failed.", TestBlockException); - } - else if(TestBlockException is not null - && ThrowOnFinallyBlockException - && FinallyBlockExceptions.Any()) - { - FinallyBlockExceptions.Insert(0, TestBlockException); - throw new AggregateException("Test case failed and finally blocks failed.", - FinallyBlockExceptions); - } - else if(TestBlockException is null - && ThrowOnFinallyBlockException - && FinallyBlockExceptions.Any()) - { - throw new AggregateException("Test case succeeded, but one or more finally blocks failed.", - FinallyBlockExceptions); - } - - //if (tce is not null) throw tce; - } - - // Does it make sense for testBlock to be nullable? - // On one hand, a return of 'true' implies it will never be null. - // On the other hand, if we modify this code and accidentaly remove/forgot a 'false' check, - // it would be nice to be forced to null check. - // Might be worth setting testBlock to be non-nullable and use temp vars as the nullable type? - private bool TryGetBlock(IServiceScope scope, Block block, out object blockInstance) - { - HandleFinallyBlock( - block, - () => Log?.Debug($"Attempting to activate test block: {block.Type}"), - () => Log?.Debug($"Attempting to activate finally block: {block.Type}") - ); - bool result = false; - object? foundBlock = null; - try - { - foundBlock = scope.ServiceProvider.GetService(block.Type); - // What happens in the below scenario? - //blockInstance = scope.ServiceProvider.GetService(block.Type); - if (foundBlock is null) - { - HandleFinallyBlock( - block, - () => TestBlockException = new InvalidOperationException($"Unable to find test block: {block.Type}"), - () => FinallyBlockExceptions.Add(new InvalidOperationException($"Unable to find finally block: {block.Type}")) - ); - } - } - catch (InvalidOperationException e) - { - // Only try to re-build the test block if we get an InvalidOperationException. - // That implies the block was found but could not be activated. - // Also... can this message be clearer? Not sure what will make sense to people. - Log?.Debug($"Unable to activate from DI service, attempting to re-build block: {block.Type}. Original error: {e}"); - - _ = TryBuildBlock(scope, block, out foundBlock); - } - - if(foundBlock is not null) - { - blockInstance = foundBlock; - result = true; - } - else - { - // Is this the best way to do this? - // Or should blockInstance be nullable? - blockInstance = new object(); - } - - return result; - } - - // Notes for documentation: - // ... First level dependencies should be validated at build time. - // ... Second level dependencies are not and can fail. - // ... This mainly affects objects returned by test blocks. - // ... Best practice is to add as much as possible via AddDependency methods and *only* return items from test blocks that *have* to be. - // ... E.G. this is fine: - // ... ... TestBlock1 - returns bool - // ... ... TestBlock2 - needs bool - // ... This starts to get problematic and requires extra attention to ensure it's absolutely necesssary: - // ... ... TestBlock1 - returns bool - // ... ... TestBlock2 - needs ObjectA which needs bool - private bool TryBuildBlock(IServiceScope scope, Block block, out object? blockInstance) - { - List blockParams = new(); - foreach (ParameterInfo? c in block.ConstructorParams) - { - object? obj = ActivateObject(scope, block, c.ParameterType, "constructor argument"); - if (obj is null) - { - if(!CheckForITestLogger(c.ParameterType)) - { - blockInstance = null; - return false; - } - } - - blockParams.Add(obj); - } - blockInstance = Activator.CreateInstance(block.Type, - BindingFlags.CreateInstance | - BindingFlags.Public | - BindingFlags.Instance | - BindingFlags.OptionalParamBinding, - null, - blockParams.ToArray(), - CultureInfo.CurrentCulture); - - return true; - } - - private bool TrySetBlockProperties(IServiceScope scope, Block block, object blockInstance) - { - foreach (PropertyInfo? prop in block.PropertyParams) - { - if (!prop.CanWrite) - { - Log?.Debug($"Skipping property {prop}. No setter found."); - continue; - } - - object? obj = ActivateObject(scope, block, prop.PropertyType, "property"); - if (obj is null) - { - if(CheckForITestLogger(prop.PropertyType)) - { - continue; - } - - return false; - } - - prop.SetValue(blockInstance, obj); - Log?.TestBlockInput(obj); - } - - return true; - } - - private bool TryGetExecuteArguments(IServiceScope scope, Block block, out List executeArgs) - { - executeArgs = new List(); - foreach (ParameterInfo? ep in block.ExecuteParams) - { - object? obj = null; - if(block.ExecuteArgumentOverrides.Count > 0) - { - block.ExecuteArgumentOverrides.TryGetValue(ep.ParameterType, out obj); - } - - if(obj is null) - { - obj = ActivateObject(scope, block, ep.ParameterType, "execute method argument"); - if (obj is null) - { - if (CheckForITestLogger(ep.ParameterType)) - { - executeArgs.Add(null); - continue; - } - - return false; - } - } - - executeArgs.Add(obj); - Log?.TestBlockInput(obj); - } - - return true; - } - - private object? ActivateObject(IServiceScope scope, Block block, Type objectType, string targetMember) // Probably need to come up with a better name than 'targetMember'. - { - if (!BlockOutput.TryGetValue(objectType, out object? obj)) - { - try - { - obj = scope.ServiceProvider.GetService(objectType); - // Is the below check worth it? - // It is avoided if the test block asks for an interface if the dependency is implementing an interface. - // HOWEVER, this would facilitate injecting multiple different implementations in a test. - if(obj is null) - { - foreach(var i in objectType.GetInterfaces()) - { - IEnumerable objs = scope.ServiceProvider.GetServices(i); - obj = objs.FirstOrDefault(o => o?.GetType() == objectType); - if (obj is not null) break; - } - } - } - catch (InvalidOperationException e) - { - HandleFinallyBlock( - block, - () => TestBlockException = new InvalidOperationException( - $"Test Block - {block.Type} - Error attempting to activate {targetMember}: {objectType}: {e}"), - () => FinallyBlockExceptions.Add(new InvalidOperationException( - $"Finally Block = {block.Type} - Error attempting to activate {targetMember}: {objectType}: {e}")) - ); - } - } - - // If we've already set an exception, i.e. the GetService call above failed, don't override it. - // This is to account for two different scenarios: a dependency is not present (below) vs. a dependency is present but failed to activate (above). - if (obj is null && TestBlockException is null) - { - HandleFinallyBlock( - block, - () => TestBlockException = new InvalidOperationException( - $"Test Block - {block.Type} - Unable to find {targetMember}: {objectType}"), - () => FinallyBlockExceptions.Add(new InvalidOperationException( - $"Finally Block = {block.Type} - Unable to find {targetMember}: {objectType}")) - ); - } - - return obj; - } - - private bool TryRunBlock(Block block, object blockInstance, List executeArgs) - { - bool result = false; - - HandleFinallyBlock( - block, - () => Log?.Debug($"Executing test block: {block.Type}"), - () => Log?.Debug($"Executing finally block: {block.Type}") - ); - - try - { - object? output = block.ExecuteMethod.Invoke(blockInstance, executeArgs.ToArray()); - if (output is not null) - { - Log?.TestBlockOutput(output); - BlockOutput.Remove(output.GetType()); - BlockOutput.Add(output.GetType(), output); - } - result = true; - } - catch (TargetInvocationException ex) - { - HandleFinallyBlock( - block, - () => TestBlockException = ex.InnerException, - () => FinallyBlockExceptions.Add(ex.InnerException) - ); - } - catch (ArgumentException ex) - { - HandleFinallyBlock( - block, - () => TestBlockException = ex, - () => FinallyBlockExceptions.Add(ex) - ); - } - catch (TargetParameterCountException ex) - { - ex.Data.Add("AdditionalInfo", "Test block failed: Mismatched count between Execute method arguments and supplied dependencies."); - HandleFinallyBlock( - block, - () => TestBlockException = ex, - () => FinallyBlockExceptions.Add(ex) - ); - } - - if (result) Log?.Debug($"Test block completed successfully."); - return result; - } - - private static void HandleFinallyBlock(Block block, Action testBlockAction, Action finallyBlockAction) - { - if (block.IsFinallyBlock) - { - finallyBlockAction(); - } - else - { - testBlockAction(); - } - } - - // Type checking every single time we find no dependency seems a bit inefficient. - // Call this out specifically in a code review. - private bool CheckForITestLogger(Type type) - { - bool isLogger = false; - if (!HasLogger && type == typeof(ITestCaseLogger)) - { - TestBlockException = null; - if (FinallyBlockExceptions.Count > 0) - { - FinallyBlockExceptions.Remove(FinallyBlockExceptions.Last()); - } - isLogger = true; - } - return isLogger; - } - } -} diff --git a/IntelliTect.TestTools.TestFramework/IntelliTect.TestTools.TestFramework/TestCaseException.cs b/IntelliTect.TestTools.TestFramework/IntelliTect.TestTools.TestFramework/TestCaseException.cs deleted file mode 100644 index 59e6d1fd..00000000 --- a/IntelliTect.TestTools.TestFramework/IntelliTect.TestTools.TestFramework/TestCaseException.cs +++ /dev/null @@ -1,36 +0,0 @@ -using System; -using System.Runtime.Serialization; -using System.Security.Permissions; - -namespace IntelliTect.TestTools.TestFramework -{ - public class TestCaseException : Exception - { - public TestCaseException() : base() - { - } - - public TestCaseException(string message) : base(message) - { - } - - public TestCaseException(string message, Exception innerException) : base(message, innerException) - { - } - - public TestCaseException(SerializationInfo info, StreamingContext context) : base(info, context) - { - ResourceReferenceProperty = info.GetString("ResourceReferenceProperty"); - } - - public string ResourceReferenceProperty { get; set; } = ""; - - [SecurityPermission(SecurityAction.Demand, SerializationFormatter = true)] - public override void GetObjectData(SerializationInfo info, StreamingContext context) - { - if (info is null) throw new ArgumentNullException(nameof(info)); - info.AddValue("ResourceReferenceProperty", ResourceReferenceProperty); - base.GetObjectData(info, context); - } - } -} diff --git a/IntelliTect.TestTools.sln b/IntelliTect.TestTools.sln index 1f3106fe..3307420a 100644 --- a/IntelliTect.TestTools.sln +++ b/IntelliTect.TestTools.sln @@ -39,14 +39,6 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Examples", "Examples", "{BD EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "IntelliTect.TestTools.Selenate.Examples", "Examples\IntelliTect.TestTools.Selenate.Examples\IntelliTect.TestTools.Selenate.Examples.csproj", "{6F64DE3F-6220-4302-BA3D-25D1C783B673}" EndProject -Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "IntelliTect.TestTools.TestFramework", "IntelliTect.TestTools.TestFramework", "{8F72C043-0341-4FB9-8503-78C4C0CE1F15}" -EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ExampleTests", "IntelliTect.TestTools.TestFramework\ExampleTests\ExampleTests\ExampleTests.csproj", "{B5389BCD-0919-4A7C-859F-064C19F17258}" -EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "IntelliTect.TestTools.TestFramework", "IntelliTect.TestTools.TestFramework\IntelliTect.TestTools.TestFramework\IntelliTect.TestTools.TestFramework.csproj", "{DB59B933-DCF8-4A27-968C-AD4D13F72987}" -EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "IntelliTect.TestTools.TestFramework.Tests", "IntelliTect.TestTools.TestFramework\IntelliTect.TestTools.TestFramework.Tests\IntelliTect.TestTools.TestFramework.Tests.csproj", "{B23739CA-39AF-4721-A40A-FCA06F418FF5}" -EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{3E09C5DD-F7B4-4542-AC13-0EE22DCC230C}" ProjectSection(SolutionItems) = preProject .editorconfig = .editorconfig @@ -59,7 +51,6 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution README.md = README.md selenate-pipeline.yml = selenate-pipeline.yml Test-NuGetPackage.ps1 = Test-NuGetPackage.ps1 - testframework-pipeline.yml = testframework-pipeline.yml EndProjectSection EndProject Global @@ -120,18 +111,6 @@ Global {6F64DE3F-6220-4302-BA3D-25D1C783B673}.Debug|Any CPU.Build.0 = Debug|Any CPU {6F64DE3F-6220-4302-BA3D-25D1C783B673}.Release|Any CPU.ActiveCfg = Release|Any CPU {6F64DE3F-6220-4302-BA3D-25D1C783B673}.Release|Any CPU.Build.0 = Release|Any CPU - {B5389BCD-0919-4A7C-859F-064C19F17258}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {B5389BCD-0919-4A7C-859F-064C19F17258}.Debug|Any CPU.Build.0 = Debug|Any CPU - {B5389BCD-0919-4A7C-859F-064C19F17258}.Release|Any CPU.ActiveCfg = Release|Any CPU - {B5389BCD-0919-4A7C-859F-064C19F17258}.Release|Any CPU.Build.0 = Release|Any CPU - {DB59B933-DCF8-4A27-968C-AD4D13F72987}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {DB59B933-DCF8-4A27-968C-AD4D13F72987}.Debug|Any CPU.Build.0 = Debug|Any CPU - {DB59B933-DCF8-4A27-968C-AD4D13F72987}.Release|Any CPU.ActiveCfg = Release|Any CPU - {DB59B933-DCF8-4A27-968C-AD4D13F72987}.Release|Any CPU.Build.0 = Release|Any CPU - {B23739CA-39AF-4721-A40A-FCA06F418FF5}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {B23739CA-39AF-4721-A40A-FCA06F418FF5}.Debug|Any CPU.Build.0 = Debug|Any CPU - {B23739CA-39AF-4721-A40A-FCA06F418FF5}.Release|Any CPU.ActiveCfg = Release|Any CPU - {B23739CA-39AF-4721-A40A-FCA06F418FF5}.Release|Any CPU.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE @@ -146,9 +125,6 @@ Global {A0D98D56-D48E-42E4-8E1E-6EA3EA0D7860} = {D13DE286-8B5D-45A4-B7A9-EA62E7AF98A5} {B5D26863-D696-4D64-B281-FC118B370FEA} = {EEA49773-F788-4051-8C66-30B90839FCFD} {6F64DE3F-6220-4302-BA3D-25D1C783B673} = {BDBFEAA3-FBC6-48C1-8988-9D6F64875831} - {B5389BCD-0919-4A7C-859F-064C19F17258} = {8F72C043-0341-4FB9-8503-78C4C0CE1F15} - {DB59B933-DCF8-4A27-968C-AD4D13F72987} = {8F72C043-0341-4FB9-8503-78C4C0CE1F15} - {B23739CA-39AF-4721-A40A-FCA06F418FF5} = {8F72C043-0341-4FB9-8503-78C4C0CE1F15} EndGlobalSection GlobalSection(ExtensibilityGlobals) = postSolution SolutionGuid = {06F0B25C-E18B-44E5-9FD1-CD362B8626FF} diff --git a/testframework-pipeline.yml b/testframework-pipeline.yml deleted file mode 100644 index 7d546266..00000000 --- a/testframework-pipeline.yml +++ /dev/null @@ -1,55 +0,0 @@ -trigger: - branches: - include: - - main - paths: - include: - - IntelliTect.TestTools.TestFramework/* - - testframework-pipeline.yml - -pool: - vmImage: 'windows-2022' - -variables: - solution: '**/IntelliTect.TestTools.TestFramework.slnf' - buildPlatform: 'Any CPU' - buildConfiguration: 'Release' - version: '2.0.0-beta' - -steps: -- task: NuGetToolInstaller@1 - displayName: 'Use latest NuGet' - -- task: NuGetCommand@2 - displayName: 'Restore Solution' - inputs: - restoreSolution: '**/IntelliTect.TestTools.sln' - -- task: VSBuild@1 - displayName: 'Build Solution' - inputs: - solution: '$(solution)' - platform: '$(buildPlatform)' - configuration: '$(buildConfiguration)' - msbuildArgs: '/p:Version=$(version)' - -- task: DotNetCoreCLI@2 - displayName: 'Unit Test' - inputs: - command: 'test' - projects: '**/IntelliTect.TestTools.TestFramework.Tests' - -- task: DotNetCoreCLI@2 - displayName: 'Pack TestFramework Project' - inputs: - command: 'custom' - projects: '**/IntelliTect.TestTools.TestFramework.csproj' - custom: 'pack' - arguments: '-p:Version="$(version)-ci-$(Build.BuildId)" -c Release -o $(Build.ArtifactStagingDirectory)' - -- task: PublishBuildArtifacts@1 - displayName: 'Stage Package' - inputs: - PathtoPublish: '$(Build.ArtifactStagingDirectory)' - ArtifactName: 'TestFramework' - publishLocation: 'Container' \ No newline at end of file