protected override void beforeEach()
        {
            AssetDeclarationVerificationActivator.Latched = false;

            var logs = new AssetLogsCache();

            logs.FindByName(theAssetName)
            .Add(_provenance, "Test log message 1");
            logs.FindByName(theAssetName)
            .Add(_provenance, "Test log message 2");

            Services.Inject(logs);
        }
        // TODO -- would be nice if we could log the provenance of the file dependency.
        // i.e. -- which file had the wrong stuff
        public void VerifyFileDependency(string name)
        {
            var file = _pipeline.Find(name);

            if (file == null)
            {
                // Guard clause to allow automated tests with faked up data work
                if (AssetDeclarationVerificationActivator.Latched)
                {
                    return;
                }
                var assetLog = _assetLogs.FindByName(name);
                _log.MarkFailure(GetErrorMessage(name, _assetLogs));
            }
        }
Example #3
0
        // For testing purposes only
        public static string GetErrorMessage(string name, AssetLogsCache logs)
        {
            var logsBuilder = new StringBuilder("Unable to locate asset named {0}".ToFormat(name));

            logsBuilder.AppendLine(Environment.NewLine + "Asset logs:");
            logs.FindByName(name).Logs.GroupBy(l => l.Provenance)
            .Each((grouped) =>
            {
                logsBuilder.AppendLine("    {0}".ToFormat(grouped.Key));
                foreach (var assetLogEntry in grouped)
                {
                    logsBuilder.AppendLine("        {0}".ToFormat(assetLogEntry.Message));
                }
            });

            return(logsBuilder.ToString());
        }
 public void AddFile(AssetPath path, AssetFile file)
 {
     _assetLogsCache.FindByName(file.Name).Add(path.Package, "Adding {0} to IAssetPipeline".ToFormat(file.FullPath));
     _inner.AddFile(path, file);
 }