-
Notifications
You must be signed in to change notification settings - Fork 108
Expand file tree
/
Copy pathContainerProviderStub.cs
More file actions
66 lines (54 loc) · 1.92 KB
/
ContainerProviderStub.cs
File metadata and controls
66 lines (54 loc) · 1.92 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE.txt file in the project root for more information.
using Microsoft.Extensions.Logging;
using Moq;
namespace Sign.Core.Test
{
internal sealed class ContainerProviderStub : IContainerProvider
{
private readonly ContainerProvider _containerProvider;
internal IEnumerable<ContainerSpy> Containers { get; set; } = Enumerable.Empty<ContainerSpy>();
internal ContainerProviderStub()
{
_containerProvider = new ContainerProvider(
Mock.Of<ICertificateProvider>(),
Mock.Of<IDirectoryService>(),
Mock.Of<IFileMatcher>(),
Mock.Of<IMakeAppxCli>(),
Mock.Of<ILogger<IContainerProvider>>());
}
public bool IsAppxBundleContainer(FileInfo file)
{
return _containerProvider.IsAppxBundleContainer(file);
}
public bool IsAppxContainer(FileInfo file)
{
return _containerProvider.IsAppxContainer(file);
}
public bool IsNuGetContainer(FileInfo file)
{
return _containerProvider.IsNuGetContainer(file);
}
public bool IsZipContainer(FileInfo file)
{
return _containerProvider.IsZipContainer(file);
}
public bool IsCabContainer(FileInfo file)
{
return _containerProvider.IsCabContainer(file);
}
public IContainer? GetContainer(FileInfo file)
{
ArgumentNullException.ThrowIfNull(file, nameof(file));
foreach (ContainerSpy container in Containers)
{
if (FileInfoComparer.Instance.Equals(container.File, file))
{
return container;
}
}
return null;
}
}
}