public void NotFound()
    {
        var loggerMock = new Mock <BuildLogger>();

        loggerMock.Setup(x => x.LogDebug(It.IsAny <string>()));
        var logger           = loggerMock.Object;
        var testDirectory    = TestContext.CurrentContext.TestDirectory;
        var weavingException = Assert.Throws <WeavingException>(() => ConfigFileFinder.FindWeaverConfigs(testDirectory, testDirectory, logger));

        Approvals.Verify(weavingException.Message.Replace(testDirectory, ""));
    }
Esempio n. 2
0
    public bool ReadShouldVerifyAssembly(out List <string> ignoreCodes)
    {
        var weaverConfigs = ConfigFileFinder.FindWeaverConfigs(SolutionDirectory, ProjectDirectory, Logger);

        ignoreCodes = ExtractVerifyIgnoreCodesConfigs(weaverConfigs).ToList();
        if (DefineConstants.Any(x => x == "FodyVerifyAssembly"))
        {
            return(true);
        }
        return(ExtractVerifyAssemblyFromConfigs(weaverConfigs));
    }
Esempio n. 3
0
    public void NotFound()
    {
        var loggerMock = new Mock <BuildLogger>();

        loggerMock.Setup(x => x.LogDebug(It.IsAny <string>()));
        var logger      = loggerMock.Object;
        var configFiles = ConfigFileFinder.FindWeaverConfigs(Environment.CurrentDirectory, Environment.CurrentDirectory, logger);

        Assert.IsEmpty(configFiles);
        loggerMock.Verify();
    }
Esempio n. 4
0
    public void NotFound()
    {
        var loggerMock = new Mock <BuildLogger>();

        loggerMock.Setup(x => x.LogDebug(It.IsAny <string>()));
        var logger          = loggerMock.Object;
        var searchDirectory = Path.Combine(AssemblyLocation.CurrentDirectory, "FodyWeavers.xml");

        var weavingException = Assert.Throws <WeavingException>(
            () => ConfigFileFinder.FindWeaverConfigs(AssemblyLocation.CurrentDirectory, AssemblyLocation.CurrentDirectory, logger));

        Approvals.Verify(weavingException.Message.Replace(searchDirectory, "SearchDirectory"));
    }
Esempio n. 5
0
    void Inner()
    {
        ValidateProjectPath();

        ValidateAssemblyPath();

        ConfigFiles = ConfigFileFinder.FindWeaverConfigs(SolutionDirectory, ProjectDirectory, Logger);

        if (!ShouldStartSinceFileChanged())
        {
            if (!CheckForWeaversXmlChanged())
            {
                FindWeavers();

                if (WeaversHistory.HasChanged(Weavers.Select(x => x.AssemblyPath)))
                {
                    Logger.LogError("A re-build is required because a weaver has changed.");
                }
            }
            return;
        }

        ValidateSolutionPath();

        FindWeavers();

        if (Weavers.Count == 0)
        {
            Logger.LogWarning(@"No configured weavers. It is possible no weavers have been installed or a weaver has been installed into a project type that does not support install.ps1. It may be necessary to manually add that weaver to FodyWeavers.xm;. eg.
<Weavers>
    <WeaverName/>
</Weavers>
see https://github.com/Fody/Fody/wiki/SampleUsage");
            return;
        }
        lock (locker)
        {
            ExecuteInOwnAssemblyLoadContext();
        }

        FlushWeaversXmlHistory();
    }
Esempio n. 6
0
    void Inner()
    {
        ValidateProjectPath();

        ValidateAssemblyPath();

        ConfigFiles = ConfigFileFinder.FindWeaverConfigs(SolutionDirectory, ProjectDirectory, Logger);

        if (!ShouldStartSinceFileChanged())
        {
            if (!CheckForWeaversXmlChanged())
            {
                FindWeavers();

                if (WeaversHistory.HasChanged(Weavers.Select(x => x.AssemblyPath)))
                {
                    Logger.LogError("A re-build is required because a weaver has changed.");
                }
            }
            return;
        }

        ValidateSolutionPath();

        FindWeavers();

        if (Weavers.Count == 0)
        {
            Logger.LogError("No configured weavers. It is possible you have not installed a weaver or have installed a fody weaver nuget into a project type that does not support install.ps1. You may need to add that weaver to FodyWeavers.xml manually. eg. <Weavers><WeaverName/></Weavers>. see https://github.com/Fody/Fody/wiki/SampleUsage");
            return;
        }
        lock (locker)
        {
            ExecuteInOwnAppDomain();
        }

        FlushWeaversXmlHistory();
    }