Esempio n. 1
0
        public static void ValidateContractContainBreakingChanges(
            string dllName,
            string baselinePath,
            string breakingChangesPath)
        {
            string localJson = GetCurrentContract(dllName);

            File.WriteAllText($"Contracts/{breakingChangesPath}", localJson);

            string baselineJson = GetBaselineContract(baselinePath);

            ContractEnforcement.ValidateJsonAreSame(localJson, baselineJson);
        }
Esempio n. 2
0
        public static void ValidatePreviewContractContainBreakingChanges(
            string dllName,
            string officialBaselinePath,
            string previewBaselinePath,
            string previewBreakingChangesPath)
        {
            string currentPreviewJson = ContractEnforcement.GetCurrentContract(
                dllName);

            JObject currentJObject          = JObject.Parse(currentPreviewJson);
            JObject officialBaselineJObject = JObject.Parse(File.ReadAllText("Contracts/" + officialBaselinePath));

            string currentJsonNoOfficialContract = ContractEnforcement.RemoveDuplicateContractElements(
                localContract: currentJObject,
                officialContract: officialBaselineJObject);

            Assert.IsNotNull(currentJsonNoOfficialContract);

            string baselinePreviewJson = ContractEnforcement.GetBaselineContract(previewBaselinePath);

            File.WriteAllText($"Contracts/{previewBreakingChangesPath}", currentJsonNoOfficialContract);

            ContractEnforcement.ValidateJsonAreSame(baselinePreviewJson, currentJsonNoOfficialContract);
        }