Skip to content

Commit

Permalink
fix up tests
Browse files Browse the repository at this point in the history
  • Loading branch information
JFriel committed Oct 29, 2024
1 parent 08b2ca1 commit 4fe2f66
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 4 deletions.
6 changes: 5 additions & 1 deletion Rdmp.Core/Curation/Data/Overview/OverviewModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,10 @@ public OverviewModel(IBasicActivateItems activator, ICatalogue catalogue)
{
_activator = activator;
_catalogue = catalogue;
Regen("");
if (catalogue != null)
{
Regen("");
}
}

public void Regen(string whereClause)
Expand All @@ -55,6 +58,7 @@ public void Regen(string whereClause)
column = _catalogue.CatalogueItems.FirstOrDefault();
hasExtractionIdentifier = false;
}
if (column is null) return;
var discoveredColumn = column.ColumnInfo.Discover(DataAccessContext.InternalDataProcessing);
var server = discoveredColumn.Table.Database.Server;
using var con = server.GetConnection();
Expand Down
12 changes: 12 additions & 0 deletions Rdmp.UI.Tests/ForEachUITests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@

using NUnit.Framework;
using Rdmp.Core.CommandExecution.AtomicCommands;
using Rdmp.Core.Curation.Data;
using Rdmp.UI.Overview;
using Tests.Common;

namespace Rdmp.UI.Tests;
Expand All @@ -29,4 +31,14 @@ public void ForEachUI_Test_GetTabName()
});
});
}

[Test, UITimeout(20000)]
public void Test_ViewCatalogueOverviewUI_Constructor()
{
var o = WhenIHaveA<Catalogue>();
var ui = AndLaunch<ViewCatalogueOverviewUI>(o);
//Assert.IsNotNull(ui);
//AssertNoErrors(ExpectedErrorType.Fatal);
//AssertNoErrors(ExpectedErrorType.KilledForm);
}
}
13 changes: 10 additions & 3 deletions Rdmp.UI/Overview/ViewCatalogueOverviewUI.cs
Original file line number Diff line number Diff line change
Expand Up @@ -77,10 +77,17 @@ private void UpdateCatalogueData()
{
lblLatestExtraction.Text = "Catalogue has not been extracted";
}
var syntaxHelper = _catalogue.GetDistinctLiveDatabaseServer(DataAccessContext.InternalDataProcessing, false).GetQuerySyntaxHelper();
var dateTypeString = syntaxHelper.TypeTranslater.GetSQLDBTypeForCSharpType(new TypeGuesser.DatabaseTypeRequest(typeof(DateTime)));

try
{
var syntaxHelper = _catalogue.GetDistinctLiveDatabaseServer(DataAccessContext.InternalDataProcessing, false)?.GetQuerySyntaxHelper();
var dateTypeString = syntaxHelper.TypeTranslater.GetSQLDBTypeForCSharpType(new TypeGuesser.DatabaseTypeRequest(typeof(DateTime)));

_dateColumns = _catalogue.CatalogueItems.Where(ci => ci.ColumnInfo.Data_type == dateTypeString).ToList();
}
catch
{
return;
}
cbTimeColumns.Items.Clear();
cbTimeColumns.Items.AddRange(_dateColumns.ToArray());
var pks = _dateColumns.Where(ci => ci.ColumnInfo.IsPrimaryKey).ToList();
Expand Down

0 comments on commit 4fe2f66

Please sign in to comment.