diff options
Diffstat (limited to 'Software/Visual_Studio/Tango.UnitTesting')
| -rw-r--r-- | Software/Visual_Studio/Tango.UnitTesting/Logging/SessionLoging_TST.cs | 38 | ||||
| -rw-r--r-- | Software/Visual_Studio/Tango.UnitTesting/Tango.UnitTesting.csproj | 3 |
2 files changed, 40 insertions, 1 deletions
diff --git a/Software/Visual_Studio/Tango.UnitTesting/Logging/SessionLoging_TST.cs b/Software/Visual_Studio/Tango.UnitTesting/Logging/SessionLoging_TST.cs new file mode 100644 index 000000000..873fcca57 --- /dev/null +++ b/Software/Visual_Studio/Tango.UnitTesting/Logging/SessionLoging_TST.cs @@ -0,0 +1,38 @@ +using System; +using System.Collections.Generic; +using System.IO; +using System.Linq; +using System.Text; +using System.Threading; +using System.Threading.Tasks; +using Microsoft.VisualStudio.TestTools.UnitTesting; +using Tango.Logging; + +namespace Tango.UnitTesting.Logging +{ + [TestClass] + [TestCategory("Logging")] + public class SessionLoging_TST + { + [TestMethod] + public void Create_Session_File_Logger() + { + SessionFileLogger sessionlogger = new SessionFileLogger(); + LogManager.Default.RegisterLogger(sessionlogger); + sessionlogger.CreateSession(); + var manager = LogManager.Default; + + manager.Log($"This is a test 1"); + Thread.Sleep(300); + SessionFileLogger slogger = LogManager.Default.RegisteredLoggers.FirstOrDefault(x => x.GetType() == typeof(SessionFileLogger)) as SessionFileLogger; + string[] fileEntries = Directory.GetFiles(slogger.Folder, "*.log"); + Assert.AreEqual(1, fileEntries.Count()); + + sessionlogger.CreateSession(); + manager.Log($"This is a test 2"); + Thread.Sleep(300); + fileEntries = Directory.GetFiles(slogger.Folder, "*.log"); + Assert.AreEqual(1, fileEntries.Count()); + } + } +} diff --git a/Software/Visual_Studio/Tango.UnitTesting/Tango.UnitTesting.csproj b/Software/Visual_Studio/Tango.UnitTesting/Tango.UnitTesting.csproj index 05daac6c7..01e639a75 100644 --- a/Software/Visual_Studio/Tango.UnitTesting/Tango.UnitTesting.csproj +++ b/Software/Visual_Studio/Tango.UnitTesting/Tango.UnitTesting.csproj @@ -140,6 +140,7 @@ <Compile Include="BL\HardwareConfiguration_TST.cs" /> <Compile Include="Integration\JobDescriptionFile_TST.cs" /> <Compile Include="Logging\Parsing_TST.cs" /> + <Compile Include="Logging\SessionLoging_TST.cs" /> <Compile Include="MachineService\PPC_Controller_TST.cs" /> <Compile Include="MachineStudio\MachineStudio_TST.cs" /> <Compile Include="Pulse\Pulse_TST.cs" /> @@ -309,7 +310,7 @@ <Import Project="..\packages\System.Data.SQLite.Core.1.0.108.0\build\net46\System.Data.SQLite.Core.targets" Condition="Exists('..\packages\System.Data.SQLite.Core.1.0.108.0\build\net46\System.Data.SQLite.Core.targets')" /> <ProjectExtensions> <VisualStudio> - <UserProperties BuildVersion_StartDate="2000/1/1" BuildVersion_UseGlobalSettings="False" BuildVersion_BuildVersioningStyle="None.None.Increment.TimeStamp" BuildVersion_UpdateAssemblyVersion="True" BuildVersion_AssemblyInfoFilename="Properties\AssemblyInfo.cs" /> + <UserProperties BuildVersion_AssemblyInfoFilename="Properties\AssemblyInfo.cs" BuildVersion_UpdateAssemblyVersion="True" BuildVersion_BuildVersioningStyle="None.None.Increment.TimeStamp" BuildVersion_UseGlobalSettings="False" BuildVersion_StartDate="2000/1/1" /> </VisualStudio> </ProjectExtensions> </Project>
\ No newline at end of file |
