playing around with testing

This commit is contained in:
Michael Becker 2024-08-31 00:45:32 -04:00
parent fd624152ba
commit cf870659d2
4 changed files with 37 additions and 3 deletions

@ -1 +1 @@
Subproject commit be11f42a37a0845286dc522c47d802ac2977a7ee
Subproject commit 12ac9ab8c068f850ec7a3850e95562accbe91725

View File

@ -204,7 +204,8 @@ namespace Mocha.Core
}
public static class ConditionalSelectAttribute
{
public static Guid Method__get__Method_Abbreviation { get; } = new Guid("{f0c64709-385d-481b-8f58-83e507fb261c}");
// public static Guid Method__get__Method_Abbreviation { get; } = new Guid("{f0c64709-385d-481b-8f58-83e507fb261c}");
public static Guid Method__get__Method_Abbreviation { get; } = new Guid("{ddb62bd1-df5a-4c9d-9991-ff9a827717e9}");
public static Guid Method_Binding__get__Method_Binding_Abbreviation { get; } = new Guid("{7154cb08-0f80-4af4-bca5-c2c12e54479a}");
}
public static class GetAttributeBySystemRoutine

View File

@ -258,7 +258,7 @@ public abstract class Oms
{
return ih;
}
throw new KeyNotFoundException();
throw new KeyNotFoundException("inst not found: " + globalIdentifier.ToString("b"));
}
protected abstract IReadOnlyCollection<InstanceHandle> GetRelatedInstancesInternal(InstanceHandle source, InstanceHandle relationship, DateTime effectiveDate);

View File

@ -22,6 +22,39 @@ namespace Mocha.Core.Tests.MethodTests;
public class ConditionalSelectAttributeMethodTests : MethodTestsBase
{
public static IEnumerable<TestCaseData> Get_Method_Abbreviation__Cases
{
get
{
yield return new TestCaseData(KnownInstanceGuids.MethodClasses.AssignAttributeMethod).Returns("AA");
yield return new TestCaseData(KnownInstanceGuids.MethodClasses.GetRelationshipMethod).Returns("GR");
}
}
[TestCaseSource(nameof(Get_Method_Abbreviation__Cases))]
public string Get_Method_Abbreviation(Guid instanceGuid)
{
InstanceHandle c_Method = Oms.GetInstance(KnownInstanceGuids.Classes.Method);
ConditionalSelectAttributeMethod sac = Oms.GetInstance<ConditionalSelectAttributeMethod>(KnownInstanceGuids.Methods.ConditionalSelectAttribute.Method__get__Method_Abbreviation);
ReturnAttributeMethodBinding ramb = sac.CreateMethodBinding(Oms);
OmsContext context = Oms.CreateContext();
context.SetWorkData(c_Method, sac);
InstanceHandle wd = Oms.Execute(context, ramb);
object? value = context.GetWorkData(wd);
if (value is string)
{
return (string)value;
}
return String.Empty;
}
[Test]
public void Test__Get_Method_Abbreviation__SAC()
{