public void It_rebuilds_with_logging_assets_message() { var testAsset = _testAssetsManager .CopyTestAsset("HelloWorld", "RebuildHelloWorld") .WithSource() .Restore(Log); var lockFilePath = Path.Combine(testAsset.TestRoot, "obj", "project.assets.json"); LockFile lockFile = LockFileUtilities.GetLockFile(lockFilePath, NullLogger.Instance); lockFile.LogMessages.Add( new AssetsLogMessage( LogLevel.Warning, NuGetLogCode.NU1500, "a test warning", null)); new LockFileFormat().Write(lockFilePath, lockFile); var rebuildCommand = new RebuildCommand(Log, testAsset.TestRoot); rebuildCommand .ExecuteWithoutRestore() .Should() .Pass() .And .HaveStdOutContaining("warning"); }
private void DisableCommands() { BuildCommand.Disable(); RebuildCommand.Disable(); CleanCommand.Disable(); StopCommand.Enable(); }
public MainViewModel() { DrawCommand = new DrawCommand(this); ClearCommand = new ClearCommand(this); RebuildCommand = new RebuildCommand(this); OpenFileCommand = new OpenFileCommand(this); ExitCommand = new ExitCommand(); }
private void EnableCommands() { _requestStopOperation = false; BuildCommand.Enable(); RebuildCommand.Enable(); CleanCommand.Enable(); StopCommand.Disable(); }
public void Rebuild_RegeneratesJsonManifestAndCopiesItToOutputFolder() { var testAsset = "RazorComponentApp"; ProjectDirectory = CreateAspNetSdkTestAsset(testAsset); var build = new BuildCommand(ProjectDirectory); build.Execute().Should().Pass(); var intermediateOutputPath = build.GetIntermediateDirectory(DefaultTfm, "Debug").ToString(); var outputPath = build.GetOutputDirectory(DefaultTfm, "Debug").ToString(); // GenerateStaticWebAssetsManifest should generate the manifest file. var path = Path.Combine(intermediateOutputPath, "StaticWebAssets.build.json"); var originalObjFile = new FileInfo(path); originalObjFile.Should().Exist(); var objManifestContents = File.ReadAllText(path); AssertManifest(StaticWebAssetsManifest.FromJsonString(objManifestContents), LoadBuildManifest()); // GenerateStaticWebAssetsManifest should copy the file to the output folder. var finalPath = Path.Combine(outputPath, "ComponentApp.staticwebassets.json"); var originalFile = new FileInfo(finalPath); originalFile.Should().Exist(); var binManifestContents = File.ReadAllText(finalPath); binManifestContents.Should().Be(objManifestContents); // rebuild build var rebuild = new RebuildCommand(Log, ProjectDirectory.Path); rebuild.Execute().Should().Pass(); var secondPath = Path.Combine(intermediateOutputPath, "StaticWebAssets.build.json"); var secondObjFile = new FileInfo(secondPath); secondObjFile.Should().Exist(); var secondObjManifest = File.ReadAllText(secondPath); AssertManifest( StaticWebAssetsManifest.FromJsonString(secondObjManifest), LoadBuildManifest("Rebuild"), "Rebuild"); secondObjManifest.Should().Be(objManifestContents); // GenerateStaticWebAssetsManifest should copy the file to the output folder. var secondFinalPath = Path.Combine(outputPath, "ComponentApp.staticwebassets.json"); var secondFinalFile = new FileInfo(secondFinalPath); secondFinalFile.Should().Exist(); var secondBinManifest = File.ReadAllText(secondFinalPath); secondBinManifest.Should().Be(binManifestContents); secondBinManifest.Should().Be(secondObjManifest); secondObjFile.LastWriteTimeUtc.Should().NotBe(originalObjFile.LastWriteTimeUtc); secondFinalFile.LastWriteTimeUtc.Should().NotBe(originalFile.LastWriteTimeUtc); AssertBuildAssets( StaticWebAssetsManifest.FromJsonBytes(File.ReadAllBytes(finalPath)), outputPath, intermediateOutputPath, "Rebuild"); }