Esempio n. 1
0
    private async Task FindReplacementsIfNecessaryAsync()
    {
        if (Replacements.Any())
        {
            return;
        }

        var errorsAndInfos      = new ErrorsAndInfos();
        var machineDrivesSecret = new MachineDrivesSecret();
        var machineDrives       = await SecretRepository.GetAsync(machineDrivesSecret, errorsAndInfos);

        if (errorsAndInfos.AnyErrors())
        {
            throw new Exception(errorsAndInfos.ErrorsToString());
        }
        machineDrives.DrivesOnThisMachine().ToList().ForEach(AddReplacement);

        var logicalFoldersSecret = new LogicalFoldersSecret();
        var logicalFolders       = await SecretRepository.GetAsync(logicalFoldersSecret, errorsAndInfos);

        if (errorsAndInfos.AnyErrors())
        {
            throw new Exception(errorsAndInfos.ErrorsToString());
        }
        logicalFolders.ForEach(AddReplacement);

        var keys = Replacements.Keys.ToList();

        foreach (var key in keys)
        {
            Replacements[key] = ResolveIterative(Replacements[key]).FullName;
        }
    }
Esempio n. 2
0
    public async Task CanGetMachineDrives()
    {
        var secretRepository    = Container.Resolve <ISecretRepository>();
        var machineDrivesSecret = new MachineDrivesSecret();
        var errorsAndInfos      = new ErrorsAndInfos();
        var machineDrives       = await secretRepository.GetAsync(machineDrivesSecret, errorsAndInfos);

        Assert.IsFalse(errorsAndInfos.AnyErrors(), errorsAndInfos.ErrorsToString());
        Assert.IsTrue(machineDrives.Any(m => m.Name == "CSharpDrive"));
        var drivesOnThisMachine = machineDrives.DrivesOnThisMachine();

        Assert.AreEqual(1, drivesOnThisMachine.Count(m => m.Name == "CSharpDrive"));
    }