public void Generator_NormalMinPreviewTest() { string str; GeneratorTests.SetMinFileIO("MinBlazor"); Options CurrentOptions = CreateMinOptions("MinBlazor", Type_Options.BlazorServer); DataInfo info = DlgSupport.GenerateData(CurrentOptions, true, false); Assert.IsNotNull(info, "DataInfo is null"); str = "BLAZOR Project Type " + info.ProjectType.ToString() + " is not Blazor Project"; Compare.LogFailure(info.ProjectType == Type_Options.BlazorServer, true, str); Assert.IsTrue(info.ProjectType == Type_Options.BlazorServer, str); str = "BLAZOR Preview Generate is not successful"; Compare.LogFailure(info.IsGenerateSuccessfull, true, str); Assert.IsTrue(info.IsGenerateSuccessfull, str); str = "BLAZOR Preview is not created"; Compare.LogFailure(info.IsPreviewCreated, true, str); Assert.IsTrue(info.IsPreviewCreated, str); str = "BLAZOR Preview Modifications should not happen"; Compare.LogFailure(info.IsModificationsSuccessfull, false, str); Assert.IsFalse(info.IsModificationsSuccessfull, str); bool flag = false; if (info.ScriptAssets.Count == 2) { flag = true; } str = "BLAZOR Scripts should be 2, and has value of " + info.ScriptAssets.Count.ToString(); Compare.LogFailure(flag, true, str); Assert.IsTrue(flag, str); if (info.MultiLineScriptCount == 0) { flag = true; } else { flag = false; } str = "BLAZOR Embedded Scripts should be 0, and has value of " + info.MultiLineScriptCount.ToString(); Compare.LogFailure(flag, true, str); Assert.IsTrue(flag, str); GeneratorTests.SetDefaultFileIO(); }
public void Generator_NormalMinRazorOutputTest() { string str; string dir = "MinRazor"; string dataDir = @"\MinRazor\"; GeneratorTests.SetMinFileIO(dir); Options CurrentOptions = CreateMinOptions(dir, Type_Options.ASPNetRazor); DataInfo info = DlgSupport.GenerateData(CurrentOptions, false, true); Assert.IsNotNull(info, "DataInfo is null for Min Razor"); str = "RAZOR Project Type " + info.ProjectType.ToString() + " is not a Razor Project"; Compare.LogFailure(info.ProjectType == Type_Options.ASPNetRazor, true, str); Assert.IsTrue(info.ProjectType == Type_Options.ASPNetRazor, str); str = "RAZOR Generate is not successful for Min Razor"; Compare.LogFailure(info.IsGenerateSuccessfull, true, str); Assert.IsTrue(info.IsGenerateSuccessfull, str); str = "RAZOR Preview is not created for Min Blazor Razor"; Compare.LogFailure(info.IsPreviewCreated, true, str); Assert.IsTrue(info.IsPreviewCreated, str); str = "RAZOR Modifications is not successfull for Min Razor"; Compare.LogFailure(info.IsModificationsSuccessfull, true, str); Assert.IsTrue(info.IsModificationsSuccessfull, str); bool flag = false; if (info.ScriptAssets.Count == 2) { flag = true; } str = "RAZOR Scripts should be 2, and has value of " + info.ScriptAssets.Count.ToString(); Compare.LogFailure(flag, true, str); Assert.IsTrue(flag, str); if (info.MultiLineScriptCount == 0) { flag = true; } else { flag = false; } str = "RAZOR Embedded Scripts should be 0, and has value of " + info.MultiLineScriptCount.ToString(); Compare.LogFailure(flag, true, str); Assert.IsTrue(flag, str); CompareResult result = Compare.CompareGeneratedFile("_layout.cshtml", "Razor", dataDir); str = "RAZOR _layout.cshtml count is different Actual Count=" + result.File1Count.ToString() + " Expected Count=" + result.File2Count.ToString(); Compare.LogFailure(result.CountDifferent, false, str); Assert.IsFalse(result.CountDifferent, str); str = "RAZOR _layout.cshtml contents is different for Min Razor"; Compare.LogFailure(result.ContentsDifferent, false, str); Assert.IsFalse(result.ContentsDifferent, str); result = Compare.CompareGeneratedFile("Razor_layout.cshtml", "Razor", dataDir); str = "RAZOR Razor_layout.cshtml count is different Actual Count=" + result.File1Count.ToString() + " Expected Count=" + result.File2Count.ToString(); Compare.LogFailure(result.CountDifferent, false, str); Assert.IsFalse(result.CountDifferent, str); str = "RAZOR Razor_layout.cshtml contents is different for Min Razor"; Compare.LogFailure(result.ContentsDifferent, false, str); Assert.IsFalse(result.ContentsDifferent, str); result = Compare.CompareGeneratedFile("Razor.cshtml", "Razor", dataDir); str = "RAZOR Razor.cshtml count is different Actual Count=" + result.File1Count.ToString() + " Expected Count=" + result.File2Count.ToString(); Compare.LogFailure(result.CountDifferent, false, str); Assert.IsFalse(result.CountDifferent, str); str = "RAZOR Razor.cshtml contents is different for Razor"; Compare.LogFailure(result.ContentsDifferent, false, str); Assert.IsFalse(result.ContentsDifferent, str); GeneratorTests.SetDefaultFileIO(); }
public void Generator_NormalMinBlazorWasmPWAOutputTest() { string str; string dir = "MinWasmPWA"; string dataDir = @"\MinWasmPWA\"; GeneratorTests.SetMinFileIO(dir); Options CurrentOptions = CreateMinOptions(dir, Type_Options.BlazorWebassemblyPWA); DataInfo info = DlgSupport.GenerateData(CurrentOptions, false, true); Assert.IsNotNull(info, "DataInfo is null for Min Blazor PWA Wasm"); str = "WASM PWA Project Type " + info.ProjectType.ToString() + " is not Blazor Wasm PWA Project"; Compare.LogFailure(info.ProjectType == Type_Options.BlazorWebassemblyPWA, true, str); Assert.IsTrue(info.ProjectType == Type_Options.BlazorWebassemblyPWA, str); str = "WASM PWA Generate is not successful for Min Blazor Wasm PWA"; Compare.LogFailure(info.IsGenerateSuccessfull, true, str); Assert.IsTrue(info.IsGenerateSuccessfull, str); str = "WASM PWA Preview is not created for Min Blazor Wasm PWA"; Compare.LogFailure(info.IsPreviewCreated, true, str); Assert.IsTrue(info.IsPreviewCreated, str); str = "WASM PWA Modifications is not successfull for Min Blazor Wasm PWA"; Compare.LogFailure(info.IsModificationsSuccessfull, true, str); Assert.IsTrue(info.IsModificationsSuccessfull, str); bool flag = false; if (info.ScriptAssets.Count == 2) { flag = true; } str = "WASM PWA Scripts should be 2, and has value of " + info.ScriptAssets.Count.ToString(); Compare.LogFailure(flag, true, str); Assert.IsTrue(flag, str); if (info.MultiLineScriptCount == 0) { flag = true; } else { flag = false; } str = "WASM PWA Embedded Scripts should be 0, and has value of " + info.MultiLineScriptCount.ToString(); Compare.LogFailure(flag, true, str); Assert.IsTrue(flag, str); CompareResult result = Compare.CompareGeneratedFile("index.html", "WasmPWA", dataDir); str = "WASM PWA index.html count is different Actual Count=" + result.File1Count.ToString() + " Expected Count=" + result.File2Count.ToString(); Compare.LogFailure(result.CountDifferent, false, str); Assert.IsFalse(result.CountDifferent, str); str = "WASM PWA index.html contents is different for Min Blazor Wasm"; Compare.LogFailure(result.ContentsDifferent, false, str); Assert.IsFalse(result.ContentsDifferent, str); result = Compare.CompareGeneratedFile("NavMenu.Razor", "WasmPWA", dataDir); str = "WASM PWA NavMenu.Razor count is different for Min Blazor Wasm"; Assert.IsFalse(result.CountDifferent, str); Compare.LogFailure(result.CountDifferent, false, str); str = "WASM PWA NavMenu.Razor contents is different for Min Blazor Wasm"; Compare.LogFailure(result.ContentsDifferent, false, str); Assert.IsFalse(result.ContentsDifferent, str); result = Compare.CompareGeneratedFile("WasmPWA.Razor", "WasmPWA", dataDir); str = "WASM PWA WasmPWA.Razor count is different Actual Count=" + result.File1Count.ToString() + " Expected Count=" + result.File2Count.ToString(); Compare.LogFailure(result.CountDifferent, false, str); Assert.IsFalse(result.CountDifferent, str); str = "WASM PWA WasmPWA.Razor contents is different for Blazor Wasm PWA"; Compare.LogFailure(result.ContentsDifferent, false, str); Assert.IsFalse(result.ContentsDifferent, str); GeneratorTests.SetDefaultFileIO(); }