private void CheckTypeScriptInterfaceFile(string interfaceFileSubPath)
        {
            var contractFile = new FileInfo(GetTypeScriptContractFullPath(interfaceFileSubPath));

            contractFile.Exists.Should().BeTrue(
                $"The Typescript contract file {interfaceFileSubPath} does not exist. Please run the `src/interface-generator` tool with option --out-file {contractFile.FullName}.");

            var actual   = File.ReadAllText(contractFile.FullName);
            var expected = InterfaceGenerator.Generate();

            var compareResult = new DefaultStringComparer(true).Compare(actual, expected);

            compareResult
            .Error
            .Should()
            .BeNullOrEmpty(
                because:
                $@"{contractFile.Name} should match the checked-in version.

If the contract change is deliberate, then the TypeScript contracts file '{interfaceFileSubPath}' needs to be regenerated.

Please run the following:

dotnet run -p src/interface-generator --  --out-file {contractFile.FullName}

");
        }
Ejemplo n.º 2
0
        public static AndWhichConstraint <StringAssertions, string> BeEquivalentHtmlTo(
            this StringAssertions assertions,
            string expected)
        {
            var subject = assertions.Subject;

            var actual = subject.IndentHtml();

            var diff = new DefaultStringComparer(true).Compare(
                actual,
                expected.IndentHtml()).Error;

            (diff ?? "")
            .Replace("Received:", "\nActual:\n")
            .Replace("Approved:", "\nExpected:\n")
            .Should()
            .BeNullOrEmpty(because: "HTML doesn't match. Unexpected output was: \n\n" + actual);

            return(new AndWhichConstraint <StringAssertions, string>(
                       subject.Should(),
                       subject));
        }