DisplayTestMethodNameAttribute.cs (1330B)
1 // ----------------------------------------------------------------------------- 2 // <copyright file="DisplayTestMethodNameAttribute.cs" company="Microsoft Corporation"> 3 // Copyright (c) Microsoft Corporation. Licensed under the MIT License. 4 // </copyright> 5 // ----------------------------------------------------------------------------- 6 7 namespace Microsoft.WinGetUtil.UnitTests.Common.Logging 8 { 9 using System; 10 using System.Reflection; 11 using Microsoft.Msix.Utils.Logger; 12 using Xunit.Sdk; 13 14 /// <summary> 15 /// This will log the name the method in OWC utils logger. 16 /// </summary> 17 internal class DisplayTestMethodNameAttribute : BeforeAfterTestAttribute 18 { 19 /// <inheritdoc/> 20 public override void Before(MethodInfo methodUnderTest) 21 { 22 Logger.Info("-----------------------------------------------------------------------"); 23 Logger.Info($"Starting test {methodUnderTest.Name}{Environment.NewLine}"); 24 } 25 26 /// <inheritdoc/> 27 public override void After(MethodInfo methodUnderTest) 28 { 29 Logger.Info($"{Environment.NewLine}Finish test {methodUnderTest.Name}"); 30 Logger.Info("-----------------------------------------------------------------------\n"); 31 } 32 } 33 }