public void SaveScript(Script script, string path) { Profiler.Start("ScriptManager_SafeScript"); AssetManager.CreateAsset(script, path); script.Path = Paths.GetProjectRelativePath(path); ScriptSaved?.Invoke(script); Profiler.Stop("ScriptManager_SafeScript"); }
public void TestRunnerManager_CorrectlyLoadsTestsFixtures_IfSavedViaAssetManager() { var lightFixture = LightTestFixture; lightFixture.AddScript(new Script() { Name = "Test" }); AssetManager.CreateAsset(lightFixture, k_TestAPath); Assert.AreEqual(1, TestRunnerManager.TestFixtures.Count, "Only one test fixture should be present"); Assert.AreEqual(1, TestRunnerManager.TestFixtures[0].Tests.Count, "Only one test should be present"); }
public void SaveTestFixture(TestFixture fixture, string path) { Profiler.Start("TestFixtureManager_SaveFixture"); fixture.Name = Paths.GetName(path); fixture.Path = Paths.GetProjectRelativePath(path); AssetManager.CreateAsset(fixture.ToLightTestFixture(), path); fixture.IsDirty = false; // This will fire callback which will update UI dirty flag if needed. FixtureSaved?.Invoke(fixture, path); Profiler.Stop("TestFixtureManager_SaveFixture"); }
private void CreateNewAsset(Bitmap bmp) { while (true) { if (AssetManager.GetAsset(GetPathForID(LastCropImageIndex)) != null) { LastCropImageIndex++; continue; } break; } AssetManager.CreateAsset(bmp, GetPathForID(LastCropImageIndex)); }
public async Task <IActionResult> Post([FromForm] GlobalAssetViewModel request) { try { Asset asset = new Asset(); asset = request.Map(request); asset = _manager.CreateAsset(asset, request.File, request.DriveName); var response = await base.PostEntity(asset); await _webhookPublisher.PublishAsync("Assets.NewAssetCreated", asset.Id.ToString(), asset.Name).ConfigureAwait(false); return(response); } catch (Exception ex) { return(ex.GetActionResult()); } }
public void TwoIdenticalAssets_HaveTheSameHash_ButDifferentGuids() { var asset = AssetManager.CreateAsset(new Script(guid), k_ScriptAPath); var asset2 = AssetManager.CreateAsset(new Script(guid), k_ScriptBPath); Assert.AreEqual(asset.Hash, asset2.Hash, "Identical assets should have same hash"); Assert.AreNotEqual(asset.Guid, asset2.Guid, "Identical assets should have different GUIDs"); }
public void RenamedAssets_UponRefresh_AreRenamedInGuidTable() { var assetA = AssetManager.CreateAsset(new Script(guid), k_ScriptAPath); var assetB = AssetManager.CreateAsset(new Script(guid), k_ScriptBPath); File.Move(k_ScriptBPath, k_ScriptCPath); AssetManager.Refresh(); Assert.AreEqual(2, AssetGuidManager.Paths.Count(), "Asset count missmatch"); Assert.AreEqual(default(Guid), AssetGuidManager.GetGuid(k_ScriptBPath), "B asset was renamed"); Assert.AreEqual(assetA.Guid, AssetGuidManager.GetGuid(k_ScriptAPath), "A path gives correct guid"); Assert.AreEqual(assetB.Guid, AssetGuidManager.GetGuid(k_ScriptCPath), "C path gives correct guid"); Assert.AreEqual(k_ScriptAPath, AssetGuidManager.GetPath(assetA.Guid), "A still has same path"); Assert.AreEqual(k_ScriptCPath, AssetGuidManager.GetPath(assetB.Guid), "B gives different path"); }
public void AssetIsCreated_For_LightTestFixture() { var asset = AssetManager.CreateAsset(LightTestFixture, k_FixturePath); Assert.IsTrue(File.Exists(asset.Path), "Test fixture asset should have been created at path: " + k_FixturePath); }