Exemple #1
0
        public void Should_Reset_PackageState_On_PostProcess()
        {
            PackageManagerState.ForPackage("com.unity.test1").SetTest(true);
            PackageManagerState.ForPackage("com.unity.test2").SetTest(true);

            Assert.IsTrue(PackageManagerState.ForPackage("com.unity.test1").IsTestSuccess, "Package state has been set");
            PackageAssetPostprocessor.OnPostprocessAllAssets(new[] { "Packages/com.unity.test1/anyfile" }, new string[0], new string[0], new string[0]);

            Assert.IsFalse(PackageManagerState.ForPackage("com.unity.test1").IsTestSuccess, "Package 1 state is reset");
            Assert.IsTrue(PackageManagerState.ForPackage("com.unity.test2").IsTestSuccess, "Package 2 state remains unchanged");
        }
        public void Setup()
        {
            OriginalStateInstance = PackageManagerState.PackageManagerStateInstance;
            PackageManagerState   = ScriptableObject.CreateInstance <PackageManagerState>();
            PackageManagerState.PackageManagerStateInstance = PackageManagerState;

            Mock = new MockTestRunnerApi();
            PackageTestRunner = new PackageTestRunner();
            PackageTestRunner.TestCompleteMessage = "Mock test completed.";
            PackageTestRunner._Api = Mock;
            Mock.packageTestRunner = PackageTestRunner;
            Extension = new ToolbarExtension();
            Extension.PackageTestRunner = PackageTestRunner;
            mockPackageVersion          = new MockPackageVersion("com.unity.upm.develop");
        }
 public void TearDown()
 {
     PackageManagerState.PackageManagerStateInstance = OriginalStateInstance;
     OriginalStateInstance = null;
 }