2019-09-04 22:29:23 +02:00
|
|
|
|
using System;
|
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
using System.Linq;
|
|
|
|
|
|
|
|
|
|
namespace Capnpc.Csharp.MsBuild.Generation
|
|
|
|
|
{
|
|
|
|
|
public class TestFileGeneratorResult
|
|
|
|
|
{
|
|
|
|
|
public TestFileGeneratorResult(TestGeneratorResult generatorResult, string fileName)
|
|
|
|
|
{
|
|
|
|
|
if (generatorResult == null)
|
|
|
|
|
{
|
|
|
|
|
throw new ArgumentNullException(nameof(generatorResult));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
Filename = fileName ?? throw new ArgumentNullException(nameof(fileName));
|
|
|
|
|
|
|
|
|
|
Errors = generatorResult.Errors;
|
|
|
|
|
IsUpToDate = generatorResult.IsUpToDate;
|
2019-09-05 21:59:25 +02:00
|
|
|
|
GeneratedCode = generatorResult.GeneratedTestCode;
|
2019-09-04 22:29:23 +02:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// The errors, if any.
|
|
|
|
|
/// </summary>
|
|
|
|
|
public IEnumerable<TestGenerationError> Errors { get; }
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// The generated file was up-to-date.
|
|
|
|
|
/// </summary>
|
|
|
|
|
public bool IsUpToDate { get; }
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
2019-09-05 21:59:25 +02:00
|
|
|
|
/// The generated code.
|
2019-09-04 22:29:23 +02:00
|
|
|
|
/// </summary>
|
2019-09-05 21:59:25 +02:00
|
|
|
|
public string GeneratedCode { get; }
|
2019-09-04 22:29:23 +02:00
|
|
|
|
|
|
|
|
|
public bool Success => Errors == null || !Errors.Any();
|
|
|
|
|
|
|
|
|
|
public string Filename { get; }
|
|
|
|
|
}
|
|
|
|
|
}
|