MET08DDUPSP1TBI - v2.43.4 - MethodBaseName
This commit is contained in:
67
Adaptation/_Tests/Static/txt.cs
Normal file
67
Adaptation/_Tests/Static/txt.cs
Normal file
@ -0,0 +1,67 @@
|
||||
using Adaptation._Tests.Shared;
|
||||
using Microsoft.Extensions.Logging;
|
||||
using Microsoft.VisualStudio.TestTools.UnitTesting;
|
||||
using System;
|
||||
using System.Diagnostics;
|
||||
using System.Reflection;
|
||||
|
||||
namespace Adaptation._Tests.Static;
|
||||
|
||||
[TestClass]
|
||||
public class TXT : LoggingUnitTesting, IDisposable
|
||||
{
|
||||
|
||||
#pragma warning disable CA2254
|
||||
#pragma warning disable IDE0060
|
||||
|
||||
internal static TXT LoggingUnitTesting { get; private set; }
|
||||
|
||||
public TXT() : base(testContext: null, declaringType: null)
|
||||
{
|
||||
if (LoggingUnitTesting is null)
|
||||
throw new Exception();
|
||||
}
|
||||
|
||||
public TXT(TestContext testContext) : base(testContext, new StackFrame().GetMethod().DeclaringType)
|
||||
{
|
||||
}
|
||||
|
||||
[ClassInitialize]
|
||||
public static void ClassInitialize(TestContext testContext)
|
||||
{
|
||||
if (LoggingUnitTesting is null)
|
||||
LoggingUnitTesting = new TXT(testContext);
|
||||
}
|
||||
|
||||
[ClassCleanup()]
|
||||
public static void ClassCleanup()
|
||||
{
|
||||
if (LoggingUnitTesting.Logger is not null)
|
||||
LoggingUnitTesting.Logger.LogInformation("Cleanup");
|
||||
if (LoggingUnitTesting is not null)
|
||||
LoggingUnitTesting.Dispose();
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
public void TestDescriptor()
|
||||
{
|
||||
FileHandlers.txt.Descriptor descriptor;
|
||||
MethodBase methodBase = new StackFrame().GetMethod();
|
||||
LoggingUnitTesting.Logger.LogInformation(string.Concat(methodBase.Name, " - Getting configuration"));
|
||||
descriptor = FileHandlers.txt.ProcessData.GetDescriptor("12-123456-1234");
|
||||
Assert.IsTrue(descriptor.Reactor is "12");
|
||||
Assert.IsTrue(descriptor.RDS is "123456");
|
||||
Assert.IsTrue(descriptor.PSN is "1234");
|
||||
descriptor = FileHandlers.txt.ProcessData.GetDescriptor("123456");
|
||||
Assert.IsTrue(descriptor.Reactor is "00");
|
||||
Assert.IsTrue(descriptor.RDS is "123456");
|
||||
Assert.IsTrue(descriptor.PSN is "0000");
|
||||
descriptor = FileHandlers.txt.ProcessData.GetDescriptor("MP");
|
||||
Assert.IsTrue(descriptor.Reactor is "00");
|
||||
Assert.IsTrue(descriptor.RDS is "000000");
|
||||
Assert.IsTrue(descriptor.PSN is "0000");
|
||||
Assert.IsTrue(descriptor.Employee is "MP");
|
||||
LoggingUnitTesting.Logger.LogInformation(string.Concat(methodBase.Name, " - Exit"));
|
||||
}
|
||||
|
||||
}
|
Reference in New Issue
Block a user