🐛 Fix bug while searching for the user sid
This commit is contained in:
parent
c7d2a2c4fe
commit
5a460e1ba0
16 changed files with 350 additions and 45 deletions
|
|
@ -45,6 +45,7 @@ namespace AmagnoVirtualPrinter.Delivery
|
|||
|
||||
if (ghostScriptExe == null)
|
||||
{
|
||||
logger.Error("Can not find Ghostscript.");
|
||||
throw new FileNotFoundException("Can not find Ghostscript.");
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -40,6 +40,12 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Installer", "Installer", "{
|
|||
EndProject
|
||||
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Common", "Common", "{95284260-12AD-4C69-BF4B-6B3A7BA5627C}"
|
||||
EndProject
|
||||
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Tests", "Tests", "{CD57AFC1-AD22-4A86-A9D9-26D2074BF75D}"
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "AmagnoVirtualPrinter.Utils.UnitTests", "Tests\AmagnoVirtualPrinter.Utils.UnitTests\AmagnoVirtualPrinter.Utils.UnitTests.csproj", "{2349BD8A-03E5-4226-B3C6-56C2F718B7CB}"
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "AmagnoVirtualPrinter.Agent.Lib.Tests", "Tests\AmagnoVirtualPrinter.Agent.Lib.Tests\AmagnoVirtualPrinter.Agent.Lib.Tests.csproj", "{36CD25FD-B1E2-4C87-970F-A40CCC961390}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|Any CPU = Debug|Any CPU
|
||||
|
|
@ -218,6 +224,30 @@ Global
|
|||
{CD1C8E9D-5335-41AC-B0C0-88FD7C7C55F3}.Release|x64.Build.0 = Release|Any CPU
|
||||
{CD1C8E9D-5335-41AC-B0C0-88FD7C7C55F3}.Release|x86.ActiveCfg = Release|Any CPU
|
||||
{CD1C8E9D-5335-41AC-B0C0-88FD7C7C55F3}.Release|x86.Build.0 = Release|Any CPU
|
||||
{2349BD8A-03E5-4226-B3C6-56C2F718B7CB}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{2349BD8A-03E5-4226-B3C6-56C2F718B7CB}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{2349BD8A-03E5-4226-B3C6-56C2F718B7CB}.Debug|x64.ActiveCfg = Debug|Any CPU
|
||||
{2349BD8A-03E5-4226-B3C6-56C2F718B7CB}.Debug|x64.Build.0 = Debug|Any CPU
|
||||
{2349BD8A-03E5-4226-B3C6-56C2F718B7CB}.Debug|x86.ActiveCfg = Debug|Any CPU
|
||||
{2349BD8A-03E5-4226-B3C6-56C2F718B7CB}.Debug|x86.Build.0 = Debug|Any CPU
|
||||
{2349BD8A-03E5-4226-B3C6-56C2F718B7CB}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{2349BD8A-03E5-4226-B3C6-56C2F718B7CB}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{2349BD8A-03E5-4226-B3C6-56C2F718B7CB}.Release|x64.ActiveCfg = Release|Any CPU
|
||||
{2349BD8A-03E5-4226-B3C6-56C2F718B7CB}.Release|x64.Build.0 = Release|Any CPU
|
||||
{2349BD8A-03E5-4226-B3C6-56C2F718B7CB}.Release|x86.ActiveCfg = Release|Any CPU
|
||||
{2349BD8A-03E5-4226-B3C6-56C2F718B7CB}.Release|x86.Build.0 = Release|Any CPU
|
||||
{36CD25FD-B1E2-4C87-970F-A40CCC961390}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{36CD25FD-B1E2-4C87-970F-A40CCC961390}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{36CD25FD-B1E2-4C87-970F-A40CCC961390}.Debug|x64.ActiveCfg = Debug|Any CPU
|
||||
{36CD25FD-B1E2-4C87-970F-A40CCC961390}.Debug|x64.Build.0 = Debug|Any CPU
|
||||
{36CD25FD-B1E2-4C87-970F-A40CCC961390}.Debug|x86.ActiveCfg = Debug|Any CPU
|
||||
{36CD25FD-B1E2-4C87-970F-A40CCC961390}.Debug|x86.Build.0 = Debug|Any CPU
|
||||
{36CD25FD-B1E2-4C87-970F-A40CCC961390}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{36CD25FD-B1E2-4C87-970F-A40CCC961390}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{36CD25FD-B1E2-4C87-970F-A40CCC961390}.Release|x64.ActiveCfg = Release|Any CPU
|
||||
{36CD25FD-B1E2-4C87-970F-A40CCC961390}.Release|x64.Build.0 = Release|Any CPU
|
||||
{36CD25FD-B1E2-4C87-970F-A40CCC961390}.Release|x86.ActiveCfg = Release|Any CPU
|
||||
{36CD25FD-B1E2-4C87-970F-A40CCC961390}.Release|x86.Build.0 = Release|Any CPU
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
|
|
@ -237,6 +267,8 @@ Global
|
|||
{A668846E-54C7-483D-9CF7-48F77EA398CA} = {5EE0067B-1ED5-44FB-941D-8F4B039FDD2E}
|
||||
{AA25364D-22D5-44B0-86A5-6FB14C686308} = {95284260-12AD-4C69-BF4B-6B3A7BA5627C}
|
||||
{CD1C8E9D-5335-41AC-B0C0-88FD7C7C55F3} = {95284260-12AD-4C69-BF4B-6B3A7BA5627C}
|
||||
{2349BD8A-03E5-4226-B3C6-56C2F718B7CB} = {CD57AFC1-AD22-4A86-A9D9-26D2074BF75D}
|
||||
{36CD25FD-B1E2-4C87-970F-A40CCC961390} = {CD57AFC1-AD22-4A86-A9D9-26D2074BF75D}
|
||||
EndGlobalSection
|
||||
GlobalSection(ExtensibilityGlobals) = postSolution
|
||||
SolutionGuid = {52642DB4-40BC-4C37-880C-73F24AE287ED}
|
||||
|
|
|
|||
|
|
@ -2,12 +2,14 @@
|
|||
|
||||
namespace AmagnoVirtualPrinter.Agent.Core.Model
|
||||
{
|
||||
public struct SessionInfo : ISessionInfo
|
||||
public class SessionInfo : ISessionInfo
|
||||
{
|
||||
public int Id { get; set; }
|
||||
|
||||
public string Desktop { get; set; }
|
||||
|
||||
public string Sid { get; set; }
|
||||
|
||||
public bool FoundDomain { get; set; }
|
||||
}
|
||||
}
|
||||
|
|
@ -41,6 +41,7 @@
|
|||
<Compile Include="Misc\Job.cs" />
|
||||
<Compile Include="Misc\JobFactory.cs" />
|
||||
<Compile Include="Misc\JobService.cs" />
|
||||
<Compile Include="Misc\PrintJobReader.cs" />
|
||||
<Compile Include="Misc\VirtualTcpInputPrinter.cs" />
|
||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||
<Compile Include="AmagnoVirtualPrinterService.cs" />
|
||||
|
|
|
|||
|
|
@ -62,6 +62,7 @@ namespace AmagnoVirtualPrinter.Agent.Lib.Misc
|
|||
|
||||
if (ghostScriptExe == null)
|
||||
{
|
||||
_logger.Error("GhostScript not found.");
|
||||
throw new PostScriptConversionException("GhostScript not found. Please place local variable.");
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -2,7 +2,6 @@
|
|||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Printing;
|
||||
using System.Security.Principal;
|
||||
using AmagnoVirtualPrinter.Agent.Core.Enums;
|
||||
using AmagnoVirtualPrinter.Agent.Core.Interfaces;
|
||||
|
|
@ -67,13 +66,15 @@ namespace AmagnoVirtualPrinter.Agent.Lib.Misc
|
|||
{
|
||||
var now = DateTime.Now;
|
||||
|
||||
var jobInfo = GetCurrentPrintJobs(printerName).FirstOrDefault();
|
||||
var jobInfo = PrintJobReader.GetCurrentPrintJobs(printerName).FirstOrDefault();
|
||||
if (jobInfo == null)
|
||||
{
|
||||
throw new InvalidOperationException();
|
||||
}
|
||||
|
||||
var session = GetCurrentSessions(jobInfo).FirstOrDefault();
|
||||
var sessions = GetCurrentSessions(jobInfo).ToArray();
|
||||
var session = sessions.FirstOrDefault(s => s.FoundDomain) ?? sessions.FirstOrDefault();
|
||||
|
||||
var config = _registryRepository.GetRegistryConfig();
|
||||
var userConfig = _registryRepository.GetUserRegistryConfig(session.Sid);
|
||||
var root = _directoryHelper.GetOutputDirectory(userConfig);
|
||||
|
|
@ -144,11 +145,11 @@ namespace AmagnoVirtualPrinter.Agent.Lib.Misc
|
|||
{
|
||||
var domain = job.DomainName;
|
||||
var machine = job.MachineName?.TrimStart('\\');
|
||||
var user = job.UserName;
|
||||
var username = job.UserName;
|
||||
|
||||
LogDebug($"Searching for session of {domain}\\{user} on {machine} !");
|
||||
LogDebug($"Searching for session of {domain}\\{username} on {machine} !");
|
||||
|
||||
if (domain == null || machine == null || user == null)
|
||||
if (domain == null || machine == null || username == null)
|
||||
{
|
||||
yield break;
|
||||
}
|
||||
|
|
@ -159,7 +160,7 @@ namespace AmagnoVirtualPrinter.Agent.Lib.Misc
|
|||
var sessions = server.GetSessions().Where(s => s.UserName != null && s.DomainName != null);
|
||||
foreach (var session in sessions)
|
||||
{
|
||||
if (!session.UserName.Equals(user, cmp))
|
||||
if (!session.UserName.Equals(username, cmp))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
|
@ -168,7 +169,7 @@ namespace AmagnoVirtualPrinter.Agent.Lib.Misc
|
|||
var isDomainUser = session.DomainName.Equals(domain, cmp);
|
||||
if (!isSingleUser && !isDomainUser)
|
||||
{
|
||||
continue;
|
||||
LogWarn("Found Session {sessionId} for {username} but its not of domain {domain} or {machine}", session.SessionId, username, domain, machine);
|
||||
}
|
||||
|
||||
var sessionId = session.SessionId;
|
||||
|
|
@ -178,47 +179,13 @@ namespace AmagnoVirtualPrinter.Agent.Lib.Misc
|
|||
{
|
||||
Id = sessionId,
|
||||
Desktop = desktopName,
|
||||
Sid = account.Translate(typeof(SecurityIdentifier)).Value
|
||||
Sid = account.Translate(typeof(SecurityIdentifier)).Value,
|
||||
FoundDomain = isSingleUser || isDomainUser
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
[ItemNotNull]
|
||||
private IEnumerable<IJobInfo> GetCurrentPrintJobs(string printerName)
|
||||
{
|
||||
using (var server = new LocalPrintServer())
|
||||
{
|
||||
using (var queue = server.GetPrintQueue(printerName))
|
||||
{
|
||||
using (var jobs = queue.GetPrintJobInfoCollection())
|
||||
{
|
||||
foreach (var job in jobs)
|
||||
{
|
||||
using (job)
|
||||
{
|
||||
var id = job.JobIdentifier;
|
||||
var machine = server.Name;
|
||||
var domain = Environment.UserDomainName;
|
||||
var user = job.Submitter;
|
||||
var name = job.Name;
|
||||
yield return new JobInfo
|
||||
{
|
||||
JobId = id,
|
||||
Name = name,
|
||||
DomainName = domain,
|
||||
MachineName = machine,
|
||||
UserName = user,
|
||||
Status = job.JobStatus,
|
||||
DeviceName = queue.Name
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
[NotNull]
|
||||
private string GetRawFileExtension(IntermediateFormat format)
|
||||
{
|
||||
|
|
@ -242,5 +209,10 @@ namespace AmagnoVirtualPrinter.Agent.Lib.Misc
|
|||
{
|
||||
_logger.Error(exception, message, args);
|
||||
}
|
||||
|
||||
private void LogWarn(string message, params object[] args)
|
||||
{
|
||||
_logger.Warn(message, args);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
47
Common/AmagnoVirtualPrinter.Agent.Lib/Misc/PrintJobReader.cs
Normal file
47
Common/AmagnoVirtualPrinter.Agent.Lib/Misc/PrintJobReader.cs
Normal file
|
|
@ -0,0 +1,47 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Printing;
|
||||
using AmagnoVirtualPrinter.Agent.Core.Interfaces;
|
||||
using AmagnoVirtualPrinter.Agent.Core.Model;
|
||||
using JetBrains.Annotations;
|
||||
|
||||
namespace AmagnoVirtualPrinter.Agent.Lib.Misc
|
||||
{
|
||||
public class PrintJobReader
|
||||
{
|
||||
[ItemNotNull]
|
||||
public static IEnumerable<IJobInfo> GetCurrentPrintJobs(string printerName)
|
||||
{
|
||||
using (var server = new LocalPrintServer())
|
||||
{
|
||||
using (var queue = server.GetPrintQueue(printerName))
|
||||
{
|
||||
using (var jobs = queue.GetPrintJobInfoCollection())
|
||||
{
|
||||
foreach (var job in jobs)
|
||||
{
|
||||
using (job)
|
||||
{
|
||||
var id = job.JobIdentifier;
|
||||
var machine = server.Name;
|
||||
var domain = Environment.UserDomainName;
|
||||
var user = job.Submitter;
|
||||
var name = job.Name;
|
||||
yield return new JobInfo
|
||||
{
|
||||
JobId = id,
|
||||
Name = name,
|
||||
DomainName = domain,
|
||||
MachineName = machine,
|
||||
UserName = user,
|
||||
Status = job.JobStatus,
|
||||
DeviceName = queue.Name
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -4,6 +4,7 @@ using System.Linq;
|
|||
using AmagnoVirtualPrinter.Agent.Core.Enums;
|
||||
using AmagnoVirtualPrinter.Agent.Core.Interfaces;
|
||||
using AmagnoVirtualPrinter.Agent.Core.Model;
|
||||
using AmagnoVirtualPrinter.Logging;
|
||||
using JetBrains.Annotations;
|
||||
|
||||
using Microsoft.Win32;
|
||||
|
|
@ -14,6 +15,8 @@ namespace AmagnoVirtualPrinter.Utils
|
|||
{
|
||||
private const short DefaultServerPort = 9101;
|
||||
|
||||
private static readonly IVirtualPrinterLogger<RegistryRepository> Logger = new VirtualPrinterLogger<RegistryRepository>();
|
||||
|
||||
public bool TryGetGhostscriptPath(out string path)
|
||||
{
|
||||
path = null;
|
||||
|
|
@ -104,6 +107,8 @@ namespace AmagnoVirtualPrinter.Utils
|
|||
|
||||
public IUserConfig GetUserRegistryConfig(string sid)
|
||||
{
|
||||
Logger.Trace("GetUserRegistryConfig for {sid}", sid);
|
||||
|
||||
var regView = GetRegistryView();
|
||||
var userConfig = new UserRegistryConfig();
|
||||
|
||||
|
|
|
|||
|
|
@ -0,0 +1,67 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
|
||||
<PropertyGroup>
|
||||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
||||
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
|
||||
<ProjectGuid>{36CD25FD-B1E2-4C87-970F-A40CCC961390}</ProjectGuid>
|
||||
<ProjectTypeGuids>{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
|
||||
<OutputType>Library</OutputType>
|
||||
<AppDesignerFolder>Properties</AppDesignerFolder>
|
||||
<RootNamespace>AmagnoVirtualPrinter.Agent.Lib.Tests</RootNamespace>
|
||||
<AssemblyName>AmagnoVirtualPrinter.Agent.Lib.Tests</AssemblyName>
|
||||
<TargetFrameworkVersion>v4.7.2</TargetFrameworkVersion>
|
||||
<FileAlignment>512</FileAlignment>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
||||
<PlatformTarget>AnyCPU</PlatformTarget>
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
<DebugType>full</DebugType>
|
||||
<Optimize>false</Optimize>
|
||||
<OutputPath>bin\Debug\</OutputPath>
|
||||
<DefineConstants>DEBUG;TRACE</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
|
||||
<PlatformTarget>AnyCPU</PlatformTarget>
|
||||
<DebugType>pdbonly</DebugType>
|
||||
<Optimize>true</Optimize>
|
||||
<OutputPath>bin\Release\</OutputPath>
|
||||
<DefineConstants>TRACE</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="System" />
|
||||
<Reference Include="System.Core" />
|
||||
<Reference Include="System.Data" />
|
||||
<Reference Include="System.Xml" />
|
||||
<Reference Include="nunit.framework, Version=3.5.0.0, Culture=neutral, PublicKeyToken=2638cd05610744eb">
|
||||
<HintPath>..\..\packages\NUnit.3.5.0\lib\net45\nunit.framework.dll</HintPath>
|
||||
</Reference>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="PrintJobReaderTests.cs" />
|
||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\..\Common\AmagnoVirtualPrinter.Agent.Core\AmagnoVirtualPrinter.Agent.Core.csproj">
|
||||
<Project>{135c85eb-2116-4cc4-8ccb-b6804b9d6467}</Project>
|
||||
<Name>AmagnoVirtualPrinter.Agent.Core</Name>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\..\Common\AmagnoVirtualPrinter.Agent.Lib\AmagnoVirtualPrinter.Agent.Lib.csproj">
|
||||
<Project>{94e8105f-5001-403b-b9f1-b0b0b236ad65}</Project>
|
||||
<Name>AmagnoVirtualPrinter.Agent.Lib</Name>
|
||||
</ProjectReference>
|
||||
</ItemGroup>
|
||||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
||||
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
|
||||
Other similar extension points exist, see Microsoft.Common.targets.
|
||||
<Target Name="BeforeBuild">
|
||||
</Target>
|
||||
<Target Name="AfterBuild">
|
||||
</Target>
|
||||
-->
|
||||
|
||||
</Project>
|
||||
|
|
@ -0,0 +1,17 @@
|
|||
using AmagnoVirtualPrinter.Agent.Lib.Misc;
|
||||
using NUnit.Framework;
|
||||
|
||||
namespace AmagnoVirtualPrinter.Agent.Lib.Tests
|
||||
{
|
||||
[TestFixture]
|
||||
public class PrintJobReaderTests
|
||||
{
|
||||
[Test]
|
||||
public void GetCurrentPrintJobs_ReturnsJobs()
|
||||
{
|
||||
var jobs = PrintJobReader.GetCurrentPrintJobs("Amagno");
|
||||
|
||||
Assert.IsNull(jobs);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,35 @@
|
|||
using System.Reflection;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
// General Information about an assembly is controlled through the following
|
||||
// set of attributes. Change these attribute values to modify the information
|
||||
// associated with an assembly.
|
||||
[assembly: AssemblyTitle("AmagnoVirtualPrinter.Agent.Lib.Tests")]
|
||||
[assembly: AssemblyDescription("")]
|
||||
[assembly: AssemblyConfiguration("")]
|
||||
[assembly: AssemblyCompany("")]
|
||||
[assembly: AssemblyProduct("AmagnoVirtualPrinter.Agent.Lib.Tests")]
|
||||
[assembly: AssemblyCopyright("Copyright © 2023")]
|
||||
[assembly: AssemblyTrademark("")]
|
||||
[assembly: AssemblyCulture("")]
|
||||
|
||||
// Setting ComVisible to false makes the types in this assembly not visible
|
||||
// to COM components. If you need to access a type in this assembly from
|
||||
// COM, set the ComVisible attribute to true on that type.
|
||||
[assembly: ComVisible(false)]
|
||||
|
||||
// The following GUID is for the ID of the typelib if this project is exposed to COM
|
||||
[assembly: Guid("36CD25FD-B1E2-4C87-970F-A40CCC961390")]
|
||||
|
||||
// Version information for an assembly consists of the following four values:
|
||||
//
|
||||
// Major Version
|
||||
// Minor Version
|
||||
// Build Number
|
||||
// Revision
|
||||
//
|
||||
// You can specify all the values or you can default the Build and Revision Numbers
|
||||
// by using the '*' as shown below:
|
||||
// [assembly: AssemblyVersion("1.0.*")]
|
||||
[assembly: AssemblyVersion("1.0.0.0")]
|
||||
[assembly: AssemblyFileVersion("1.0.0.0")]
|
||||
|
|
@ -0,0 +1,4 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<packages>
|
||||
<package id="NUnit" version="3.5.0" targetFramework="net45" />
|
||||
</packages>
|
||||
|
|
@ -0,0 +1,63 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
|
||||
<PropertyGroup>
|
||||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
||||
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
|
||||
<ProjectGuid>{2349BD8A-03E5-4226-B3C6-56C2F718B7CB}</ProjectGuid>
|
||||
<ProjectTypeGuids>{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
|
||||
<OutputType>Library</OutputType>
|
||||
<AppDesignerFolder>Properties</AppDesignerFolder>
|
||||
<RootNamespace>AmagnoVirtualPrinter.Utils.UnitTests</RootNamespace>
|
||||
<AssemblyName>AmagnoVirtualPrinter.Utils.UnitTests</AssemblyName>
|
||||
<TargetFrameworkVersion>v4.7.2</TargetFrameworkVersion>
|
||||
<FileAlignment>512</FileAlignment>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
||||
<PlatformTarget>AnyCPU</PlatformTarget>
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
<DebugType>full</DebugType>
|
||||
<Optimize>false</Optimize>
|
||||
<OutputPath>bin\Debug\</OutputPath>
|
||||
<DefineConstants>DEBUG;TRACE</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
|
||||
<PlatformTarget>AnyCPU</PlatformTarget>
|
||||
<DebugType>pdbonly</DebugType>
|
||||
<Optimize>true</Optimize>
|
||||
<OutputPath>bin\Release\</OutputPath>
|
||||
<DefineConstants>TRACE</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="System" />
|
||||
<Reference Include="System.Core" />
|
||||
<Reference Include="System.Data" />
|
||||
<Reference Include="System.Xml" />
|
||||
<Reference Include="nunit.framework, Version=3.5.0.0, Culture=neutral, PublicKeyToken=2638cd05610744eb">
|
||||
<HintPath>..\..\packages\NUnit.3.5.0\lib\net45\nunit.framework.dll</HintPath>
|
||||
</Reference>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="RegistryRepositoryTests.cs" />
|
||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\..\Common\AmagnoVirtualPrinter.Utils\AmagnoVirtualPrinter.Utils.csproj">
|
||||
<Project>{cd1c8e9d-5335-41ac-b0c0-88fd7c7c55f3}</Project>
|
||||
<Name>AmagnoVirtualPrinter.Utils</Name>
|
||||
</ProjectReference>
|
||||
</ItemGroup>
|
||||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
||||
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
|
||||
Other similar extension points exist, see Microsoft.Common.targets.
|
||||
<Target Name="BeforeBuild">
|
||||
</Target>
|
||||
<Target Name="AfterBuild">
|
||||
</Target>
|
||||
-->
|
||||
|
||||
</Project>
|
||||
|
|
@ -0,0 +1,35 @@
|
|||
using System.Reflection;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
// General Information about an assembly is controlled through the following
|
||||
// set of attributes. Change these attribute values to modify the information
|
||||
// associated with an assembly.
|
||||
[assembly: AssemblyTitle("AmagnoVirtualPrinter.Utils.UnitTests")]
|
||||
[assembly: AssemblyDescription("")]
|
||||
[assembly: AssemblyConfiguration("")]
|
||||
[assembly: AssemblyCompany("")]
|
||||
[assembly: AssemblyProduct("AmagnoVirtualPrinter.Utils.UnitTests")]
|
||||
[assembly: AssemblyCopyright("Copyright © 2023")]
|
||||
[assembly: AssemblyTrademark("")]
|
||||
[assembly: AssemblyCulture("")]
|
||||
|
||||
// Setting ComVisible to false makes the types in this assembly not visible
|
||||
// to COM components. If you need to access a type in this assembly from
|
||||
// COM, set the ComVisible attribute to true on that type.
|
||||
[assembly: ComVisible(false)]
|
||||
|
||||
// The following GUID is for the ID of the typelib if this project is exposed to COM
|
||||
[assembly: Guid("2349BD8A-03E5-4226-B3C6-56C2F718B7CB")]
|
||||
|
||||
// Version information for an assembly consists of the following four values:
|
||||
//
|
||||
// Major Version
|
||||
// Minor Version
|
||||
// Build Number
|
||||
// Revision
|
||||
//
|
||||
// You can specify all the values or you can default the Build and Revision Numbers
|
||||
// by using the '*' as shown below:
|
||||
// [assembly: AssemblyVersion("1.0.*")]
|
||||
[assembly: AssemblyVersion("1.0.0.0")]
|
||||
[assembly: AssemblyFileVersion("1.0.0.0")]
|
||||
|
|
@ -0,0 +1,19 @@
|
|||
using NUnit.Framework;
|
||||
|
||||
namespace AmagnoVirtualPrinter.Utils.UnitTests
|
||||
{
|
||||
[TestFixture]
|
||||
public class RegistryRepositoryTests
|
||||
{
|
||||
[Test]
|
||||
public void TryGetGhostscriptPath_FindsGhostScriptPath()
|
||||
{
|
||||
var sut = new RegistryRepository();
|
||||
|
||||
var result = sut.TryGetGhostscriptPath(out var path);
|
||||
|
||||
Assert.True(result);
|
||||
Assert.IsNotNull(path);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,4 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<packages>
|
||||
<package id="NUnit" version="3.5.0" targetFramework="net45" />
|
||||
</packages>
|
||||
Loading…
Add table
Add a link
Reference in a new issue