From b2b3bd0add73e62ea02722f0e411cf83535e9fa5 Mon Sep 17 00:00:00 2001 From: bingenito <28159742+bingenito@users.noreply.github.com> Date: Mon, 6 Nov 2023 14:23:08 -0500 Subject: [PATCH 01/31] Added MalformedContext error to OpenError, ChannelError and ResolveError --- src/Fdc3/Errors.cs | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/Fdc3/Errors.cs b/src/Fdc3/Errors.cs index 0bcbfe2..fdb5429 100644 --- a/src/Fdc3/Errors.cs +++ b/src/Fdc3/Errors.cs @@ -20,6 +20,7 @@ public static class OpenError public static readonly string ErrorOnLaunch = nameof(ErrorOnLaunch); public static readonly string AppTimeout = nameof(AppTimeout); public static readonly string ResolverUnavailable = nameof(ResolverUnavailable); + public static readonly string MalformedContext = nameof(MalformedContext); } public static class ResolveError @@ -31,6 +32,7 @@ public static class ResolveError public static readonly string TargetAppUnavailable = nameof(TargetAppUnavailable); public static readonly string TargetInstanceUnavailable = nameof(TargetInstanceUnavailable); public static readonly string IntentDeliveryFailed = nameof(IntentDeliveryFailed); + public static readonly string MalformedContext = nameof(MalformedContext); } public static class ResultError @@ -44,5 +46,6 @@ public static class ChannelError public static readonly string NoChannelFound = nameof(NoChannelFound); public static readonly string AccessDenied = nameof(AccessDenied); public static readonly string CreationFailed = nameof(CreationFailed); + public static readonly string MalformedContext = nameof(MalformedContext); } } From f5eddd29163dff8649a9c8c760b1c37ade299bb5 Mon Sep 17 00:00:00 2001 From: bingenito <28159742+bingenito@users.noreply.github.com> Date: Tue, 7 Nov 2023 06:32:14 -0500 Subject: [PATCH 02/31] Updated definition of the instrument context type to include optional market identifiers --- src/Fdc3/Context/Instrument.cs | 10 ++++++++++ .../Context/InstrumentTests.cs | 11 ++++++++++- .../Finos.Fdc3.Tests/Context/InstrumentTests.cs | 15 ++++++++++++++- 3 files changed, 34 insertions(+), 2 deletions(-) diff --git a/src/Fdc3/Context/Instrument.cs b/src/Fdc3/Context/Instrument.cs index 788f56f..797e7d1 100644 --- a/src/Fdc3/Context/Instrument.cs +++ b/src/Fdc3/Context/Instrument.cs @@ -21,6 +21,8 @@ public Instrument(InstrumentID? id = null, string? name = null) { } + public MarketSource? Market { get; set; } + object? IContext.ID => base.ID; } @@ -36,4 +38,12 @@ public class InstrumentID public string? SEDOL { get; set; } public string? Ticker { get; set; } } + + public class MarketSource + { + public string? BBG { get; set; } + public string? COUNTRY_ISOALPHA2 { get; set; } + public string? MIC { get; set; } + public string? Name { get; set; } + } } diff --git a/src/Tests/Finos.Fdc3.NewtonsoftJson.Tests/Context/InstrumentTests.cs b/src/Tests/Finos.Fdc3.NewtonsoftJson.Tests/Context/InstrumentTests.cs index 51a71b8..730e720 100644 --- a/src/Tests/Finos.Fdc3.NewtonsoftJson.Tests/Context/InstrumentTests.cs +++ b/src/Tests/Finos.Fdc3.NewtonsoftJson.Tests/Context/InstrumentTests.cs @@ -38,7 +38,16 @@ public async void Instrument_SerializedJsonMatchesSchema() RIC = "RIC", SEDOL = "SEDOL", Ticker = "TICKER" - }, "Instrument"); + }, "Instrument") + { + Market = new MarketSource + { + BBG = "BBG", + COUNTRY_ISOALPHA2 = "COUNTRY_ISOALPHA2", + MIC = "MIC", + Name = "Name" + } + }; await this.ValidateSchema(instrument); } diff --git a/src/Tests/Finos.Fdc3.Tests/Context/InstrumentTests.cs b/src/Tests/Finos.Fdc3.Tests/Context/InstrumentTests.cs index 9a6dc58..15c2ead 100644 --- a/src/Tests/Finos.Fdc3.Tests/Context/InstrumentTests.cs +++ b/src/Tests/Finos.Fdc3.Tests/Context/InstrumentTests.cs @@ -33,7 +33,16 @@ public void Instrument_PropertiesMatchParams() RIC = "RIC", SEDOL = "SEDOL", Ticker = "TICKER" - }, "Instrument"); + }, "Instrument") + { + Market = new MarketSource + { + BBG = "BBG", + COUNTRY_ISOALPHA2 = "COUNTRY_ISOALPHA2", + MIC = "MIC", + Name = "Name" + } + }; Assert.Same("BBG", instrument?.ID?.BBG); Assert.Same("CUSIP", instrument?.ID?.CUSIP); @@ -45,6 +54,10 @@ public void Instrument_PropertiesMatchParams() Assert.Same("SEDOL", instrument?.ID?.SEDOL); Assert.Same("TICKER", instrument?.ID?.Ticker); Assert.Same("Instrument", instrument?.Name); + Assert.Same("BBG", instrument?.Market?.BBG); + Assert.Same("COUNTRY_ISOALPHA2", instrument?.Market?.COUNTRY_ISOALPHA2); + Assert.Same("MIC", instrument?.Market?.MIC); + Assert.Same("Name", instrument?.Market?.Name); Assert.Same(ContextTypes.Instrument, instrument?.Type); } } \ No newline at end of file From d5c2b04d045d8c677b286c755f95fa391fb14fb8 Mon Sep 17 00:00:00 2001 From: bingenito <28159742+bingenito@users.noreply.github.com> Date: Mon, 6 Nov 2023 14:23:08 -0500 Subject: [PATCH 03/31] Added MalformedContext error to OpenError, ChannelError and ResolveError --- src/Fdc3/Errors.cs | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/Fdc3/Errors.cs b/src/Fdc3/Errors.cs index 0bcbfe2..fdb5429 100644 --- a/src/Fdc3/Errors.cs +++ b/src/Fdc3/Errors.cs @@ -20,6 +20,7 @@ public static class OpenError public static readonly string ErrorOnLaunch = nameof(ErrorOnLaunch); public static readonly string AppTimeout = nameof(AppTimeout); public static readonly string ResolverUnavailable = nameof(ResolverUnavailable); + public static readonly string MalformedContext = nameof(MalformedContext); } public static class ResolveError @@ -31,6 +32,7 @@ public static class ResolveError public static readonly string TargetAppUnavailable = nameof(TargetAppUnavailable); public static readonly string TargetInstanceUnavailable = nameof(TargetInstanceUnavailable); public static readonly string IntentDeliveryFailed = nameof(IntentDeliveryFailed); + public static readonly string MalformedContext = nameof(MalformedContext); } public static class ResultError @@ -44,5 +46,6 @@ public static class ChannelError public static readonly string NoChannelFound = nameof(NoChannelFound); public static readonly string AccessDenied = nameof(AccessDenied); public static readonly string CreationFailed = nameof(CreationFailed); + public static readonly string MalformedContext = nameof(MalformedContext); } } From f01ab52d6a6ac91f6bdacce3db7e6eb9be64b4dc Mon Sep 17 00:00:00 2001 From: bingenito <28159742+bingenito@users.noreply.github.com> Date: Tue, 7 Nov 2023 06:32:14 -0500 Subject: [PATCH 04/31] Updated definition of the instrument context type to include optional market identifiers --- src/Fdc3/Context/Instrument.cs | 10 ++++++++++ .../Context/InstrumentTests.cs | 11 ++++++++++- .../Finos.Fdc3.Tests/Context/InstrumentTests.cs | 15 ++++++++++++++- 3 files changed, 34 insertions(+), 2 deletions(-) diff --git a/src/Fdc3/Context/Instrument.cs b/src/Fdc3/Context/Instrument.cs index 788f56f..797e7d1 100644 --- a/src/Fdc3/Context/Instrument.cs +++ b/src/Fdc3/Context/Instrument.cs @@ -21,6 +21,8 @@ public Instrument(InstrumentID? id = null, string? name = null) { } + public MarketSource? Market { get; set; } + object? IContext.ID => base.ID; } @@ -36,4 +38,12 @@ public class InstrumentID public string? SEDOL { get; set; } public string? Ticker { get; set; } } + + public class MarketSource + { + public string? BBG { get; set; } + public string? COUNTRY_ISOALPHA2 { get; set; } + public string? MIC { get; set; } + public string? Name { get; set; } + } } diff --git a/src/Tests/Finos.Fdc3.NewtonsoftJson.Tests/Context/InstrumentTests.cs b/src/Tests/Finos.Fdc3.NewtonsoftJson.Tests/Context/InstrumentTests.cs index 51a71b8..730e720 100644 --- a/src/Tests/Finos.Fdc3.NewtonsoftJson.Tests/Context/InstrumentTests.cs +++ b/src/Tests/Finos.Fdc3.NewtonsoftJson.Tests/Context/InstrumentTests.cs @@ -38,7 +38,16 @@ public async void Instrument_SerializedJsonMatchesSchema() RIC = "RIC", SEDOL = "SEDOL", Ticker = "TICKER" - }, "Instrument"); + }, "Instrument") + { + Market = new MarketSource + { + BBG = "BBG", + COUNTRY_ISOALPHA2 = "COUNTRY_ISOALPHA2", + MIC = "MIC", + Name = "Name" + } + }; await this.ValidateSchema(instrument); } diff --git a/src/Tests/Finos.Fdc3.Tests/Context/InstrumentTests.cs b/src/Tests/Finos.Fdc3.Tests/Context/InstrumentTests.cs index 9a6dc58..15c2ead 100644 --- a/src/Tests/Finos.Fdc3.Tests/Context/InstrumentTests.cs +++ b/src/Tests/Finos.Fdc3.Tests/Context/InstrumentTests.cs @@ -33,7 +33,16 @@ public void Instrument_PropertiesMatchParams() RIC = "RIC", SEDOL = "SEDOL", Ticker = "TICKER" - }, "Instrument"); + }, "Instrument") + { + Market = new MarketSource + { + BBG = "BBG", + COUNTRY_ISOALPHA2 = "COUNTRY_ISOALPHA2", + MIC = "MIC", + Name = "Name" + } + }; Assert.Same("BBG", instrument?.ID?.BBG); Assert.Same("CUSIP", instrument?.ID?.CUSIP); @@ -45,6 +54,10 @@ public void Instrument_PropertiesMatchParams() Assert.Same("SEDOL", instrument?.ID?.SEDOL); Assert.Same("TICKER", instrument?.ID?.Ticker); Assert.Same("Instrument", instrument?.Name); + Assert.Same("BBG", instrument?.Market?.BBG); + Assert.Same("COUNTRY_ISOALPHA2", instrument?.Market?.COUNTRY_ISOALPHA2); + Assert.Same("MIC", instrument?.Market?.MIC); + Assert.Same("Name", instrument?.Market?.Name); Assert.Same(ContextTypes.Instrument, instrument?.Type); } } \ No newline at end of file From 74016c75385c0200ffacee194c3a9018d66514e2 Mon Sep 17 00:00:00 2001 From: bingenito <28159742+bingenito@users.noreply.github.com> Date: Mon, 15 Jul 2024 11:22:28 -0400 Subject: [PATCH 05/31] Update Chart otherConfig to array of Context --- src/Fdc3/Context/Chart.cs | 4 ++-- .../Finos.Fdc3.NewtonsoftJson.Tests/Context/ChartTests.cs | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/Fdc3/Context/Chart.cs b/src/Fdc3/Context/Chart.cs index 0a39e05..eded89e 100644 --- a/src/Fdc3/Context/Chart.cs +++ b/src/Fdc3/Context/Chart.cs @@ -16,7 +16,7 @@ namespace Finos.Fdc3.Context { public class Chart : Context, IContext { - public Chart(Instrument[] instruments, TimeRange? range = null, object? otherConfig = null, string? style = null, object? id = null, string? name = null) + public Chart(Instrument[] instruments, TimeRange? range = null, IContext[]? otherConfig = null, string? style = null, object? id = null, string? name = null) : base(ContextTypes.Chart, id, name) { this.Instruments = instruments; @@ -27,7 +27,7 @@ public Chart(Instrument[] instruments, TimeRange? range = null, object? otherCon public Instrument[] Instruments { get; set; } public TimeRange? Range { get; set; } - public object? OtherConfig { get; set; } + public IContext[]? OtherConfig { get; set; } public string? Style { get; set; } object? IContext.ID => base.ID; diff --git a/src/Tests/Finos.Fdc3.NewtonsoftJson.Tests/Context/ChartTests.cs b/src/Tests/Finos.Fdc3.NewtonsoftJson.Tests/Context/ChartTests.cs index d00eb04..5a89ecb 100644 --- a/src/Tests/Finos.Fdc3.NewtonsoftJson.Tests/Context/ChartTests.cs +++ b/src/Tests/Finos.Fdc3.NewtonsoftJson.Tests/Context/ChartTests.cs @@ -19,7 +19,7 @@ namespace Finos.Fdc3.NewtonsoftJson.Tests.Context; public class ChartTests : ContextSchemaTest { public ChartTests() - : base("https://fdc3.finos.org/schemas/2.0/chart.schema.json") + : base("https://fdc3.finos.org/schemas/2.1/context/chart.schema.json") { } @@ -28,7 +28,7 @@ public async void Chart_SerializedJsonMatchesSchema() { Instrument instrument = new Instrument(new InstrumentID { Ticker = "TICKER" }); TimeRange timeRange = new TimeRange(DateTime.Now.ToString("o"), DateTime.Now.ToString("o")); - var otherConfig = new { A = "Foo", B = "Bar" }; + IContext[] otherConfig = new[] { instrument }; Chart chart = new Chart(new Instrument[] { instrument }, timeRange, otherConfig, ChartStyle.Line, null, "chart"); await this.ValidateSchema(chart); } From a00d372fdae5b0e2f6bea709a36b333da1cb07c9 Mon Sep 17 00:00:00 2001 From: bingenito <28159742+bingenito@users.noreply.github.com> Date: Mon, 15 Jul 2024 11:23:29 -0400 Subject: [PATCH 06/31] Correct inconsistent casing of fdc3.timeRange --- src/Fdc3/Context/ContextTypes.cs | 2 +- .../Finos.Fdc3.NewtonsoftJson.Tests/Context/TimeRangeTests.cs | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Fdc3/Context/ContextTypes.cs b/src/Fdc3/Context/ContextTypes.cs index 50f56da..af23837 100644 --- a/src/Fdc3/Context/ContextTypes.cs +++ b/src/Fdc3/Context/ContextTypes.cs @@ -32,7 +32,7 @@ public static class ContextTypes public static readonly string Organization = "fdc3.organization"; public static readonly string Portfolio = "fdc3.portfolio"; public static readonly string Position = "fdc3.position"; - public static readonly string TimeRange = "fdc3.timerange"; + public static readonly string TimeRange = "fdc3.timeRange"; public static readonly string Valuation = "fdc3.valuation"; public static IDictionary Map = new Dictionary() diff --git a/src/Tests/Finos.Fdc3.NewtonsoftJson.Tests/Context/TimeRangeTests.cs b/src/Tests/Finos.Fdc3.NewtonsoftJson.Tests/Context/TimeRangeTests.cs index 73efb1f..1b7af6e 100644 --- a/src/Tests/Finos.Fdc3.NewtonsoftJson.Tests/Context/TimeRangeTests.cs +++ b/src/Tests/Finos.Fdc3.NewtonsoftJson.Tests/Context/TimeRangeTests.cs @@ -19,7 +19,7 @@ namespace Finos.Fdc3.NewtonsoftJson.Tests.Context; public class TimeRangeTests : ContextSchemaTest { public TimeRangeTests() - : base("https://fdc3.finos.org/schemas/2.0/timerange.schema.json") + : base("https://fdc3.finos.org/schemas/2.1/context/timerange.schema.json") { } From 9e64b3e7e87e4f835578bb55fda91b234e0f82ef Mon Sep 17 00:00:00 2001 From: bingenito <28159742+bingenito@users.noreply.github.com> Date: Mon, 15 Jul 2024 12:31:32 -0400 Subject: [PATCH 07/31] Update Chart tests to pass aray of Context --- src/Tests/Finos.Fdc3.Tests/Context/ChartTests.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Tests/Finos.Fdc3.Tests/Context/ChartTests.cs b/src/Tests/Finos.Fdc3.Tests/Context/ChartTests.cs index 5626e37..41f93a7 100644 --- a/src/Tests/Finos.Fdc3.Tests/Context/ChartTests.cs +++ b/src/Tests/Finos.Fdc3.Tests/Context/ChartTests.cs @@ -23,7 +23,7 @@ public void Chart_PropertiesMatchParams() { Instrument instrument = new Instrument(new InstrumentID { Ticker = "TICKER" }); TimeRange timeRange = new TimeRange(DateTime.Now.ToString("o"), DateTime.Now.ToString("o")); - var otherConfig = new { A = "Foo", B = "Bar" }; + var otherConfig = new [] { instrument }; Chart chart = new Chart(new Instrument[] { instrument }, timeRange, otherConfig, ChartStyle.Line, null, "chart"); Assert.Same("TICKER", chart?.Instruments?.First()?.ID?.Ticker); From 8d7cdc7a6d7bd72e7141f4811b27efbe1da5e57f Mon Sep 17 00:00:00 2001 From: bingenito <28159742+bingenito@users.noreply.github.com> Date: Mon, 15 Jul 2024 12:31:56 -0400 Subject: [PATCH 08/31] Rename ChatInitSettings.InitMessage to Message --- src/Fdc3/Context/ChatInitSettings.cs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/Fdc3/Context/ChatInitSettings.cs b/src/Fdc3/Context/ChatInitSettings.cs index a37143f..f0cfa55 100644 --- a/src/Fdc3/Context/ChatInitSettings.cs +++ b/src/Fdc3/Context/ChatInitSettings.cs @@ -16,17 +16,17 @@ namespace Finos.Fdc3.Context { public class ChatInitSettings : Context, IContext { - public ChatInitSettings(ContactList? members = null, string? initMessage = null, string? chatName = null, object? options = null, object? id = null, string? name = null) + public ChatInitSettings(ContactList? members = null, string? message = null, string? chatName = null, object? options = null, object? id = null, string? name = null) : base(ContextTypes.ChatInitSettings, id, name) { this.Members = members; - this.InitMessage = initMessage; + this.Message = message; this.ChatName = chatName; this.Options = options; } public string? ChatName { get; set; } - public string? InitMessage { get; set; } + public string? Message { get; set; } public ContactList? Members { get; set; } public object? Options { get; set; } From 414a9a82ddf95817e6227d4cd7962d9e68a28527 Mon Sep 17 00:00:00 2001 From: bingenito <28159742+bingenito@users.noreply.github.com> Date: Mon, 15 Jul 2024 12:32:58 -0400 Subject: [PATCH 09/31] Fix tests to use valid email and rename Fdsid to FDS_ID --- src/Fdc3/Context/Contact.cs | 2 +- .../Context/ChatInitSettingsTests.cs | 6 +++--- .../Context/ContactListTests.cs | 4 ++-- .../Context/ContactTests.cs | 4 ++-- .../Context/EmailTests.cs | 14 +++++++------- .../Context/Examples/email-contact.json | 4 ++-- .../Context/Examples/email-contactList.json | 4 ++-- .../Finos.Fdc3.SystemTextJson.Tests/EmailTests.cs | 8 ++++---- .../Context/ChatInitSettingsTests.cs | 6 +++--- .../Finos.Fdc3.Tests/Context/ContactListTests.cs | 4 ++-- src/Tests/Finos.Fdc3.Tests/Context/ContactTests.cs | 4 ++-- src/Tests/Finos.Fdc3.Tests/Context/EmailTests.cs | 8 ++++---- 12 files changed, 34 insertions(+), 34 deletions(-) diff --git a/src/Fdc3/Context/Contact.cs b/src/Fdc3/Context/Contact.cs index b3c257c..5027321 100644 --- a/src/Fdc3/Context/Contact.cs +++ b/src/Fdc3/Context/Contact.cs @@ -28,6 +28,6 @@ public class ContactID { public string? Email { get; set; } - public string? FdsId { get; set; } + public string? FDS_ID { get; set; } } } diff --git a/src/Tests/Finos.Fdc3.NewtonsoftJson.Tests/Context/ChatInitSettingsTests.cs b/src/Tests/Finos.Fdc3.NewtonsoftJson.Tests/Context/ChatInitSettingsTests.cs index 802fa9f..405573e 100644 --- a/src/Tests/Finos.Fdc3.NewtonsoftJson.Tests/Context/ChatInitSettingsTests.cs +++ b/src/Tests/Finos.Fdc3.NewtonsoftJson.Tests/Context/ChatInitSettingsTests.cs @@ -19,7 +19,7 @@ namespace Finos.Fdc3.NewtonsoftJson.Tests.Context; public class ChatInitSettingsTests : ContextSchemaTest { public ChatInitSettingsTests() - : base("https://fdc3.finos.org/schemas/2.0/chatInitSettings.schema.json") + : base("https://fdc3.finos.org/schemas/2.1/context/chatInitSettings.schema.json") { } @@ -27,10 +27,10 @@ public ChatInitSettingsTests() public async void ChatInitSettings_SerializedJsonMatchesSchema() { ChatInitSettings chatInitSettings = new ChatInitSettings( - new ContactList(new Contact[] { new Contact(new ContactID() { Email = "email", FdsId = "fdsid" }) }), + new ContactList(new Contact[] { new Contact(new ContactID() { Email = "email@test.com", FDS_ID = "fdsid" }) }), "initMessage", "chatName", - new { GroupRecipients = true, @Public = true, AllowHistoryBrowsing = true, AllowMessageCopy = true, AllowAddUser = true }, + new { GroupRecipients = true, IsPublic = true, AllowHistoryBrowsing = true, AllowMessageCopy = true, AllowAddUser = true }, null, "chatInitSettings" ); diff --git a/src/Tests/Finos.Fdc3.NewtonsoftJson.Tests/Context/ContactListTests.cs b/src/Tests/Finos.Fdc3.NewtonsoftJson.Tests/Context/ContactListTests.cs index 88a73dc..899e49d 100644 --- a/src/Tests/Finos.Fdc3.NewtonsoftJson.Tests/Context/ContactListTests.cs +++ b/src/Tests/Finos.Fdc3.NewtonsoftJson.Tests/Context/ContactListTests.cs @@ -19,14 +19,14 @@ namespace Finos.Fdc3.NewtonsoftJson.Tests.Context; public class ContactListTests : ContextSchemaTest { public ContactListTests() - : base("https://fdc3.finos.org/schemas/2.0/contactList.schema.json") + : base("https://fdc3.finos.org/schemas/2.1/context/contactList.schema.json") { } [Fact] public async void ContactList_SerializedJsonMatchesSchema() { - ContactList contactList = new ContactList(new Contact[] { new Contact(new ContactID { Email = "email", FdsId = "fdsid" }, "contact") }, "contactList"); + ContactList contactList = new ContactList(new Contact[] { new Contact(new ContactID { Email = "email@email.com", FDS_ID = "fdsid" }, "contact") }, "contactList"); await this.ValidateSchema(contactList); } } \ No newline at end of file diff --git a/src/Tests/Finos.Fdc3.NewtonsoftJson.Tests/Context/ContactTests.cs b/src/Tests/Finos.Fdc3.NewtonsoftJson.Tests/Context/ContactTests.cs index 18bf9b5..de78945 100644 --- a/src/Tests/Finos.Fdc3.NewtonsoftJson.Tests/Context/ContactTests.cs +++ b/src/Tests/Finos.Fdc3.NewtonsoftJson.Tests/Context/ContactTests.cs @@ -18,14 +18,14 @@ namespace Finos.Fdc3.NewtonsoftJson.Tests.Context; public class ContactTests : ContextSchemaTest { public ContactTests() - : base("https://fdc3.finos.org/schemas/2.0/contact.schema.json") + : base("https://fdc3.finos.org/schemas/2.1/context/contact.schema.json") { } [Fact] public async void Contact_SerializedJsonMatchesSchema() { - Contact contact = new Contact(new ContactID { Email = "email", FdsId = "fdsid" }, "contact"); + Contact contact = new Contact(new ContactID { Email = "email@test.com", FDS_ID = "fdsid" }, "contact"); await this.ValidateSchema(contact); } } \ No newline at end of file diff --git a/src/Tests/Finos.Fdc3.NewtonsoftJson.Tests/Context/EmailTests.cs b/src/Tests/Finos.Fdc3.NewtonsoftJson.Tests/Context/EmailTests.cs index 29c0a5c..26bf7f6 100644 --- a/src/Tests/Finos.Fdc3.NewtonsoftJson.Tests/Context/EmailTests.cs +++ b/src/Tests/Finos.Fdc3.NewtonsoftJson.Tests/Context/EmailTests.cs @@ -20,14 +20,14 @@ namespace Finos.Fdc3.NewtonsoftJson.Tests.Context; public class EmailTests : ContextSchemaTest { public EmailTests() - : base("https://fdc3.finos.org/schemas/2.0/email.schema.json") + : base("https://fdc3.finos.org/schemas/2.1/context/email.schema.json") { } [Fact] public async void Email_Contact_SerializedJsonMatchesSchema() { - Email email = new Email(new Contact(new ContactID() { Email = "email", FdsId = "fdsid" }), "subject", "body", null, "email"); + Email email = new Email(new Contact(new ContactID() { Email = "email@test.com", FDS_ID = "fdsid" }), "subject", "body", null, "email"); string test = await this.ValidateSchema(email); } @@ -37,8 +37,8 @@ public void Email_Contact_DeserializedJsonMatchesProperties() Email? email = this.Deserialize("Finos.Fdc3.NewtonsoftJson.Tests.Context.Examples.email-contact.json"); Assert.NotNull(email); Contact? contact = email?.Recipients as Contact; - Assert.Equal("email", contact?.ID?.Email); - Assert.Equal("fdsid", contact?.ID?.FdsId); + Assert.Equal("email@test.com", contact?.ID?.Email); + Assert.Equal("fdsid", contact?.ID?.FDS_ID); Assert.Equal("subject", email?.Subject); Assert.Equal("body", email?.TextBody); Assert.Equal("email", email?.Name); @@ -47,7 +47,7 @@ public void Email_Contact_DeserializedJsonMatchesProperties() [Fact] public async void Email_ContactList_SerializedJsonMatchesSchema() { - Email email = new Email(new ContactList(new Contact[] { new Contact(new ContactID() { Email = "email", FdsId = "fdsid" }) }), "subject", "body", null, "email"); + Email email = new Email(new ContactList(new Contact[] { new Contact(new ContactID() { Email = "email@test.com", FDS_ID = "fdsid" }) }), "subject", "body", null, "email"); await this.ValidateSchema(email); } @@ -58,8 +58,8 @@ public void Email_ContactList_DeserializedJsonMatchesProperties() Assert.NotNull(email); ContactList? contactList = email?.Recipients as ContactList; Contact? contact = contactList?.Contacts?.First(); - Assert.Equal("email", contact?.ID?.Email); - Assert.Equal("fdsid", contact?.ID?.FdsId); + Assert.Equal("email@test.com", contact?.ID?.Email); + Assert.Equal("fdsid", contact?.ID?.FDS_ID); Assert.Equal("subject", email?.Subject); Assert.Equal("body", email?.TextBody); Assert.Equal("email", email?.Name); diff --git a/src/Tests/Finos.Fdc3.NewtonsoftJson.Tests/Context/Examples/email-contact.json b/src/Tests/Finos.Fdc3.NewtonsoftJson.Tests/Context/Examples/email-contact.json index 8b7e251..7c66672 100644 --- a/src/Tests/Finos.Fdc3.NewtonsoftJson.Tests/Context/Examples/email-contact.json +++ b/src/Tests/Finos.Fdc3.NewtonsoftJson.Tests/Context/Examples/email-contact.json @@ -1,8 +1,8 @@ { "recipients": { "id": { - "email": "email", - "fdsId": "fdsid" + "email": "email@test.com", + "FDS_ID": "fdsid" }, "type": "fdc3.contact" }, diff --git a/src/Tests/Finos.Fdc3.NewtonsoftJson.Tests/Context/Examples/email-contactList.json b/src/Tests/Finos.Fdc3.NewtonsoftJson.Tests/Context/Examples/email-contactList.json index bdfb86d..937faa2 100644 --- a/src/Tests/Finos.Fdc3.NewtonsoftJson.Tests/Context/Examples/email-contactList.json +++ b/src/Tests/Finos.Fdc3.NewtonsoftJson.Tests/Context/Examples/email-contactList.json @@ -3,8 +3,8 @@ "contacts": [ { "id": { - "email": "email", - "fdsId": "fdsid" + "email": "email@test.com", + "FDS_ID": "fdsid" }, "type": "fdc3.contact" } diff --git a/src/Tests/Finos.Fdc3.SystemTextJson.Tests/EmailTests.cs b/src/Tests/Finos.Fdc3.SystemTextJson.Tests/EmailTests.cs index 720d825..7cd7f5c 100644 --- a/src/Tests/Finos.Fdc3.SystemTextJson.Tests/EmailTests.cs +++ b/src/Tests/Finos.Fdc3.SystemTextJson.Tests/EmailTests.cs @@ -27,8 +27,8 @@ public void Email_Contact_DeserializedJsonMatchesProperties() Email? email = Deserialize("Finos.Fdc3.SystemTextJson.Tests.Examples.email-contact.json"); Assert.NotNull(email); Contact? contact = email?.Recipients as Contact; - Assert.Equal("email", contact?.ID?.Email); - Assert.Equal("fdsid", contact?.ID?.FdsId); + Assert.Equal("email@test.com", contact?.ID?.Email); + Assert.Equal("fdsid", contact?.ID?.FDS_ID); Assert.Equal("subject", email?.Subject); Assert.Equal("body", email?.TextBody); Assert.Equal("email", email?.Name); @@ -41,8 +41,8 @@ public void Email_ContactList_DeserializedJsonMatchesProperties() Assert.NotNull(email); ContactList? contactList = email?.Recipients as ContactList; Contact? contact = contactList?.Contacts?.First(); - Assert.Equal("email", contact?.ID?.Email); - Assert.Equal("fdsid", contact?.ID?.FdsId); + Assert.Equal("email@test.com", contact?.ID?.Email); + Assert.Equal("fdsid", contact?.ID?.FDS_ID); Assert.Equal("subject", email?.Subject); Assert.Equal("body", email?.TextBody); Assert.Equal("email", email?.Name); diff --git a/src/Tests/Finos.Fdc3.Tests/Context/ChatInitSettingsTests.cs b/src/Tests/Finos.Fdc3.Tests/Context/ChatInitSettingsTests.cs index dd02b56..1fa3e8b 100644 --- a/src/Tests/Finos.Fdc3.Tests/Context/ChatInitSettingsTests.cs +++ b/src/Tests/Finos.Fdc3.Tests/Context/ChatInitSettingsTests.cs @@ -23,7 +23,7 @@ public void ChatInitSettings_PropertiesMatchParams() { var options = new { GroupRecipients = true, @Public = true, AllowHistoryBrowsing = true, AllowMessageCopy = true, AllowAddUser = true }; ChatInitSettings chatInitSettings = new ChatInitSettings( - new ContactList(new Contact[] { new Contact(new ContactID() { Email = "email", FdsId = "fdsid" }) }), + new ContactList(new Contact[] { new Contact(new ContactID() { Email = "email@test.com", FDS_ID = "fdsid" }) }), "initMessage", "chatName", options, @@ -31,9 +31,9 @@ public void ChatInitSettings_PropertiesMatchParams() "chatInitSettings" ); - Assert.Same("email", chatInitSettings?.Members?.Contacts?.First()?.ID?.Email); + Assert.Same("email@test.com", chatInitSettings?.Members?.Contacts?.First()?.ID?.Email); Assert.Same(options, chatInitSettings?.Options); - Assert.Same("initMessage", chatInitSettings?.InitMessage); + Assert.Same("initMessage", chatInitSettings?.Message); Assert.Same("chatName", chatInitSettings?.ChatName); Assert.Same("chatInitSettings", chatInitSettings?.Name); Assert.Same(ContextTypes.ChatInitSettings, chatInitSettings?.Type); diff --git a/src/Tests/Finos.Fdc3.Tests/Context/ContactListTests.cs b/src/Tests/Finos.Fdc3.Tests/Context/ContactListTests.cs index cfd7fee..1be7007 100644 --- a/src/Tests/Finos.Fdc3.Tests/Context/ContactListTests.cs +++ b/src/Tests/Finos.Fdc3.Tests/Context/ContactListTests.cs @@ -21,9 +21,9 @@ public class ContactListTests [Fact] public void ContactList_PropertiesMatchParams() { - ContactList contactList = new ContactList(new Contact[] { new Contact(new ContactID { Email = "email", FdsId = "fdsid" }, "contact") }, "contactList"); + ContactList contactList = new ContactList(new Contact[] { new Contact(new ContactID { Email = "email@test.com", FDS_ID = "fdsid" }, "contact") }, "contactList"); - Assert.Same("email", contactList?.Contacts?.First()?.ID?.Email); + Assert.Same("email@test.com", contactList?.Contacts?.First()?.ID?.Email); Assert.Same("contactList", contactList?.Name); Assert.Same(ContextTypes.ContactList, contactList?.Type); } diff --git a/src/Tests/Finos.Fdc3.Tests/Context/ContactTests.cs b/src/Tests/Finos.Fdc3.Tests/Context/ContactTests.cs index 83dfc87..4cd0175 100644 --- a/src/Tests/Finos.Fdc3.Tests/Context/ContactTests.cs +++ b/src/Tests/Finos.Fdc3.Tests/Context/ContactTests.cs @@ -20,9 +20,9 @@ public class ContactTests [Fact] public void Contact_PropertiesMatchParams() { - Contact contact = new Contact(new ContactID { Email = "email", FdsId = "fdsid" }, "contact"); + Contact contact = new Contact(new ContactID { Email = "email@test.com", FDS_ID = "fdsid" }, "contact"); - Assert.Same("email", contact?.ID?.Email); + Assert.Same("email@test.com", contact?.ID?.Email); Assert.Same("contact", contact?.Name); Assert.Same(ContextTypes.Contact, contact?.Type); } diff --git a/src/Tests/Finos.Fdc3.Tests/Context/EmailTests.cs b/src/Tests/Finos.Fdc3.Tests/Context/EmailTests.cs index 1105504..a88ec89 100644 --- a/src/Tests/Finos.Fdc3.Tests/Context/EmailTests.cs +++ b/src/Tests/Finos.Fdc3.Tests/Context/EmailTests.cs @@ -21,9 +21,9 @@ public class EmailTests [Fact] public void Email_Contact_PropertiesMatchParams() { - Email email = new Email(new Contact(new ContactID() { Email = "email", FdsId = "fdsid" }), "subject", "body", null, "email"); + Email email = new Email(new Contact(new ContactID() { Email = "email@test.com", FDS_ID = "fdsid" }), "subject", "body", null, "email"); - Assert.Same("email", (email?.Recipients as Contact)?.ID?.Email); + Assert.Same("email@test.com", (email?.Recipients as Contact)?.ID?.Email); Assert.Same("email", email?.Name); Assert.Same(ContextTypes.Email, email?.Type); } @@ -31,9 +31,9 @@ public void Email_Contact_PropertiesMatchParams() [Fact] public void Email_ContactList_PropertiesMatchParams() { - Email email = new Email(new ContactList(new Contact[] { new Contact(new ContactID() { Email = "email", FdsId = "fdsid" }) }), "subject", "body", null, "email"); + Email email = new Email(new ContactList(new Contact[] { new Contact(new ContactID() { Email = "email@test.com", FDS_ID = "fdsid" }) }), "subject", "body", null, "email"); - Assert.Same("email", (email?.Recipients as ContactList)?.Contacts?.First()?.ID?.Email); + Assert.Same("email@test.com", (email?.Recipients as ContactList)?.Contacts?.First()?.ID?.Email); Assert.Same("email", email?.Name); Assert.Same(ContextTypes.Email, email?.Type); } From 639b5a0404c5c47033bfb38e4edd1085f98dfda5 Mon Sep 17 00:00:00 2001 From: bingenito <28159742+bingenito@users.noreply.github.com> Date: Mon, 15 Jul 2024 12:33:28 -0400 Subject: [PATCH 10/31] Update schema version on tests --- .../Finos.Fdc3.NewtonsoftJson.Tests/Context/CountryTests.cs | 2 +- .../Finos.Fdc3.NewtonsoftJson.Tests/Context/CurrencyTests.cs | 2 +- .../Context/InstrumentListTests.cs | 2 +- .../Finos.Fdc3.NewtonsoftJson.Tests/Context/InstrumentTests.cs | 2 +- .../Finos.Fdc3.NewtonsoftJson.Tests/Context/NothingTests.cs | 2 +- .../Context/OrganizationTests.cs | 2 +- .../Finos.Fdc3.NewtonsoftJson.Tests/Context/PortfolioTests.cs | 2 +- .../Finos.Fdc3.NewtonsoftJson.Tests/Context/PositionTests.cs | 2 +- .../Finos.Fdc3.NewtonsoftJson.Tests/Context/ValuationTests.cs | 2 +- 9 files changed, 9 insertions(+), 9 deletions(-) diff --git a/src/Tests/Finos.Fdc3.NewtonsoftJson.Tests/Context/CountryTests.cs b/src/Tests/Finos.Fdc3.NewtonsoftJson.Tests/Context/CountryTests.cs index 7c88802..e89d8c6 100644 --- a/src/Tests/Finos.Fdc3.NewtonsoftJson.Tests/Context/CountryTests.cs +++ b/src/Tests/Finos.Fdc3.NewtonsoftJson.Tests/Context/CountryTests.cs @@ -19,7 +19,7 @@ namespace Finos.Fdc3.NewtonsoftJson.Tests.Context; public class CountryTests : ContextSchemaTest { public CountryTests() - : base("https://fdc3.finos.org/schemas/2.0/country.schema.json") + : base("https://fdc3.finos.org/schemas/2.1/context/country.schema.json") { } diff --git a/src/Tests/Finos.Fdc3.NewtonsoftJson.Tests/Context/CurrencyTests.cs b/src/Tests/Finos.Fdc3.NewtonsoftJson.Tests/Context/CurrencyTests.cs index d38355b..62461bc 100644 --- a/src/Tests/Finos.Fdc3.NewtonsoftJson.Tests/Context/CurrencyTests.cs +++ b/src/Tests/Finos.Fdc3.NewtonsoftJson.Tests/Context/CurrencyTests.cs @@ -19,7 +19,7 @@ namespace Finos.Fdc3.NewtonsoftJson.Tests.Context; public class CurrencyTests : ContextSchemaTest { public CurrencyTests() - : base("https://fdc3.finos.org/schemas/2.0/currency.schema.json") + : base("https://fdc3.finos.org/schemas/2.1/context/currency.schema.json") { } diff --git a/src/Tests/Finos.Fdc3.NewtonsoftJson.Tests/Context/InstrumentListTests.cs b/src/Tests/Finos.Fdc3.NewtonsoftJson.Tests/Context/InstrumentListTests.cs index ad73a92..8e11476 100644 --- a/src/Tests/Finos.Fdc3.NewtonsoftJson.Tests/Context/InstrumentListTests.cs +++ b/src/Tests/Finos.Fdc3.NewtonsoftJson.Tests/Context/InstrumentListTests.cs @@ -19,7 +19,7 @@ namespace Finos.Fdc3.NewtonsoftJson.Tests.Context; public class InstrumentListTests : ContextSchemaTest { public InstrumentListTests() - : base("https://fdc3.finos.org/schemas/2.0/instrumentList.schema.json") + : base("https://fdc3.finos.org/schemas/2.1/context/instrumentList.schema.json") { } diff --git a/src/Tests/Finos.Fdc3.NewtonsoftJson.Tests/Context/InstrumentTests.cs b/src/Tests/Finos.Fdc3.NewtonsoftJson.Tests/Context/InstrumentTests.cs index 730e720..877bffb 100644 --- a/src/Tests/Finos.Fdc3.NewtonsoftJson.Tests/Context/InstrumentTests.cs +++ b/src/Tests/Finos.Fdc3.NewtonsoftJson.Tests/Context/InstrumentTests.cs @@ -19,7 +19,7 @@ namespace Finos.Fdc3.NewtonsoftJson.Tests.Context; public class InstrumentTests : ContextSchemaTest { public InstrumentTests() - : base("https://fdc3.finos.org/schemas/2.0/instrument.schema.json") + : base("https://fdc3.finos.org/schemas/2.1/context/instrument.schema.json") { } diff --git a/src/Tests/Finos.Fdc3.NewtonsoftJson.Tests/Context/NothingTests.cs b/src/Tests/Finos.Fdc3.NewtonsoftJson.Tests/Context/NothingTests.cs index f9afbff..b65cc40 100644 --- a/src/Tests/Finos.Fdc3.NewtonsoftJson.Tests/Context/NothingTests.cs +++ b/src/Tests/Finos.Fdc3.NewtonsoftJson.Tests/Context/NothingTests.cs @@ -19,7 +19,7 @@ namespace Finos.Fdc3.NewtonsoftJson.Tests.Context; public class NothingTests : ContextSchemaTest { public NothingTests() - : base("https://fdc3.finos.org/schemas/2.0/nothing.schema.json") + : base("https://fdc3.finos.org/schemas/2.1/context/nothing.schema.json") { } diff --git a/src/Tests/Finos.Fdc3.NewtonsoftJson.Tests/Context/OrganizationTests.cs b/src/Tests/Finos.Fdc3.NewtonsoftJson.Tests/Context/OrganizationTests.cs index 29ce848..c53ff82 100644 --- a/src/Tests/Finos.Fdc3.NewtonsoftJson.Tests/Context/OrganizationTests.cs +++ b/src/Tests/Finos.Fdc3.NewtonsoftJson.Tests/Context/OrganizationTests.cs @@ -19,7 +19,7 @@ namespace Finos.Fdc3.NewtonsoftJson.Tests.Context; public class OrganizationTests : ContextSchemaTest { public OrganizationTests() - : base("https://fdc3.finos.org/schemas/2.0/organization.schema.json") + : base("https://fdc3.finos.org/schemas/2.1/context/organization.schema.json") { } diff --git a/src/Tests/Finos.Fdc3.NewtonsoftJson.Tests/Context/PortfolioTests.cs b/src/Tests/Finos.Fdc3.NewtonsoftJson.Tests/Context/PortfolioTests.cs index d04a998..8df197f 100644 --- a/src/Tests/Finos.Fdc3.NewtonsoftJson.Tests/Context/PortfolioTests.cs +++ b/src/Tests/Finos.Fdc3.NewtonsoftJson.Tests/Context/PortfolioTests.cs @@ -19,7 +19,7 @@ namespace Finos.Fdc3.NewtonsoftJson.Tests.Context; public class PortfolioTests : ContextSchemaTest { public PortfolioTests() - : base("https://fdc3.finos.org/schemas/2.0/portfolio.schema.json") + : base("https://fdc3.finos.org/schemas/2.1/context/portfolio.schema.json") { } diff --git a/src/Tests/Finos.Fdc3.NewtonsoftJson.Tests/Context/PositionTests.cs b/src/Tests/Finos.Fdc3.NewtonsoftJson.Tests/Context/PositionTests.cs index f939010..300ae82 100644 --- a/src/Tests/Finos.Fdc3.NewtonsoftJson.Tests/Context/PositionTests.cs +++ b/src/Tests/Finos.Fdc3.NewtonsoftJson.Tests/Context/PositionTests.cs @@ -19,7 +19,7 @@ namespace Finos.Fdc3.NewtonsoftJson.Tests.Context; public class PositionTests : ContextSchemaTest { public PositionTests() - : base("https://fdc3.finos.org/schemas/2.0/position.schema.json") + : base("https://fdc3.finos.org/schemas/2.1/context/position.schema.json") { } diff --git a/src/Tests/Finos.Fdc3.NewtonsoftJson.Tests/Context/ValuationTests.cs b/src/Tests/Finos.Fdc3.NewtonsoftJson.Tests/Context/ValuationTests.cs index 6e0afa9..4435c60 100644 --- a/src/Tests/Finos.Fdc3.NewtonsoftJson.Tests/Context/ValuationTests.cs +++ b/src/Tests/Finos.Fdc3.NewtonsoftJson.Tests/Context/ValuationTests.cs @@ -19,7 +19,7 @@ namespace Finos.Fdc3.NewtonsoftJson.Tests.Context; public class ValuationTests : ContextSchemaTest { public ValuationTests() - : base("https://fdc3.finos.org/schemas/2.0/valuation.schema.json") + : base("https://fdc3.finos.org/schemas/2.1/context/valuation.schema.json") { } From 606fc52cb7c5dc57a57073fb8cdd04aabfb03a31 Mon Sep 17 00:00:00 2001 From: bingenito <28159742+bingenito@users.noreply.github.com> Date: Tue, 16 Jul 2024 08:45:39 -0400 Subject: [PATCH 11/31] Add TransactionResult context type --- src/Fdc3/Context/ContextTypes.cs | 2 ++ src/Fdc3/Context/TransactionResult.cs | 33 +++++++++++++++++++ .../Context/TransactionResultTests.cs | 32 ++++++++++++++++++ .../Context/TransactionResultTests.cs | 31 +++++++++++++++++ 4 files changed, 98 insertions(+) create mode 100644 src/Fdc3/Context/TransactionResult.cs create mode 100644 src/Tests/Finos.Fdc3.NewtonsoftJson.Tests/Context/TransactionResultTests.cs create mode 100644 src/Tests/Finos.Fdc3.Tests/Context/TransactionResultTests.cs diff --git a/src/Fdc3/Context/ContextTypes.cs b/src/Fdc3/Context/ContextTypes.cs index af23837..56e7e44 100644 --- a/src/Fdc3/Context/ContextTypes.cs +++ b/src/Fdc3/Context/ContextTypes.cs @@ -33,6 +33,7 @@ public static class ContextTypes public static readonly string Portfolio = "fdc3.portfolio"; public static readonly string Position = "fdc3.position"; public static readonly string TimeRange = "fdc3.timeRange"; + public static readonly string TransactionResult = "fdc3.transactionResult"; public static readonly string Valuation = "fdc3.valuation"; public static IDictionary Map = new Dictionary() @@ -51,6 +52,7 @@ public static class ContextTypes { ContextTypes.Portfolio, typeof(Portfolio) }, { ContextTypes.Position, typeof(Position) }, { ContextTypes.TimeRange, typeof(TimeRange) }, + { ContextTypes.TransactionResult, typeof(TransactionResult) }, { ContextTypes.Valuation, typeof(Valuation) }, }; diff --git a/src/Fdc3/Context/TransactionResult.cs b/src/Fdc3/Context/TransactionResult.cs new file mode 100644 index 0000000..c1cd2f5 --- /dev/null +++ b/src/Fdc3/Context/TransactionResult.cs @@ -0,0 +1,33 @@ +/* + * Morgan Stanley makes this available to you under the Apache License, + * Version 2.0 (the "License"). You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0. + * + * See the NOTICE file distributed with this work for additional information + * regarding copyright ownership. Unless required by applicable law or agreed + * to in writing, software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express + * or implied. See the License for the specific language governing permissions + * and limitations under the License. + */ + +using System.ComponentModel; + +namespace Finos.Fdc3.Context +{ + public class TransactionResult : Context, IContext + { + public TransactionResult(string status, IContext? context = null, string? message = null, object? id = null, string? name = null) + : base(ContextTypes.TransactionResult, id, name) + { + this.Status = status; + this.Context = context; + this.Message = message; + } + + public string Status { get; set; } + public IContext? Context; + public string? Message { get; set; } + } +} diff --git a/src/Tests/Finos.Fdc3.NewtonsoftJson.Tests/Context/TransactionResultTests.cs b/src/Tests/Finos.Fdc3.NewtonsoftJson.Tests/Context/TransactionResultTests.cs new file mode 100644 index 0000000..a007652 --- /dev/null +++ b/src/Tests/Finos.Fdc3.NewtonsoftJson.Tests/Context/TransactionResultTests.cs @@ -0,0 +1,32 @@ +/* + * Morgan Stanley makes this available to you under the Apache License, + * Version 2.0 (the "License"). You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0. + * + * See the NOTICE file distributed with this work for additional information + * regarding copyright ownership. Unless required by applicable law or agreed + * to in writing, software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express + * or implied. See the License for the specific language governing permissions + * and limitations under the License. + */ + +using Finos.Fdc3.Context; + +namespace Finos.Fdc3.NewtonsoftJson.Tests.Context; + +public class TransactionResultTests : ContextSchemaTest +{ + public TransactionResultTests() + : base("https://fdc3.finos.org/schemas/2.1/context/transactionResult.schema.json") + { + } + + [Fact] + public async void TransactionResult_SerializedJsonMatchesSchema() + { + TransactionResult transactionResult = new TransactionResult("Created", new Contact(new ContactID { Email = "email@test.com", FDS_ID = "fdsid" }, "contact"), "message"); + await this.ValidateSchema(transactionResult); + } +} \ No newline at end of file diff --git a/src/Tests/Finos.Fdc3.Tests/Context/TransactionResultTests.cs b/src/Tests/Finos.Fdc3.Tests/Context/TransactionResultTests.cs new file mode 100644 index 0000000..81a8c6b --- /dev/null +++ b/src/Tests/Finos.Fdc3.Tests/Context/TransactionResultTests.cs @@ -0,0 +1,31 @@ +/* + * Morgan Stanley makes this available to you under the Apache License, + * Version 2.0 (the "License"). You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0. + * + * See the NOTICE file distributed with this work for additional information + * regarding copyright ownership. Unless required by applicable law or agreed + * to in writing, software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express + * or implied. See the License for the specific language governing permissions + * and limitations under the License. + */ + +using Finos.Fdc3.Context; + +namespace Finos.Fdc3.Tests.Context; + +public class TransactionResultTests +{ + [Fact] + public void TransactionResult_PropertiesMatchParams() + { + Contact contact = new Contact(new ContactID { Email = "email@test.com", FDS_ID = "fdsid" }, "contact"); + TransactionResult result = new TransactionResult("Created", contact, "message"); + + Assert.Same("Created", result.Status); + Assert.Equal(contact, result.Context); + Assert.Same("message", result.Message); + } +} \ No newline at end of file From 8cea70dab03630eea5b358a10ba3872e3364eb6d Mon Sep 17 00:00:00 2001 From: bingenito <28159742+bingenito@users.noreply.github.com> Date: Tue, 16 Jul 2024 08:56:29 -0400 Subject: [PATCH 12/31] Add TransactionResultStatus helper static string values --- src/Fdc3/Context/TransactionResultStatus.cs | 24 +++++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100644 src/Fdc3/Context/TransactionResultStatus.cs diff --git a/src/Fdc3/Context/TransactionResultStatus.cs b/src/Fdc3/Context/TransactionResultStatus.cs new file mode 100644 index 0000000..61b346c --- /dev/null +++ b/src/Fdc3/Context/TransactionResultStatus.cs @@ -0,0 +1,24 @@ +/* + * Morgan Stanley makes this available to you under the Apache License, + * Version 2.0 (the "License"). You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0. + * + * See the NOTICE file distributed with this work for additional information + * regarding copyright ownership. Unless required by applicable law or agreed + * to in writing, software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express + * or implied. See the License for the specific language governing permissions + * and limitations under the License. + */ + +namespace Finos.Fdc3.Context +{ + public static class TransactionResultStatus + { + public static readonly string Created = "Created"; + public static readonly string Deleted = "Deleted"; + public static readonly string Updated = "Updated"; + public static readonly string Failed = "Failed"; + } +} From 5c600df8bdbe584ad474ff985d893310486040c5 Mon Sep 17 00:00:00 2001 From: bingenito <28159742+bingenito@users.noreply.github.com> Date: Tue, 16 Jul 2024 13:05:42 -0400 Subject: [PATCH 13/31] Add Action context type --- src/Fdc3/Context/Action.cs | 34 +++++++++++++++++++ src/Fdc3/Context/ContextTypes.cs | 2 ++ .../Context/ActionTests.cs | 33 ++++++++++++++++++ .../Finos.Fdc3.Tests/Context/ActionTests.cs | 33 ++++++++++++++++++ 4 files changed, 102 insertions(+) create mode 100644 src/Fdc3/Context/Action.cs create mode 100644 src/Tests/Finos.Fdc3.NewtonsoftJson.Tests/Context/ActionTests.cs create mode 100644 src/Tests/Finos.Fdc3.Tests/Context/ActionTests.cs diff --git a/src/Fdc3/Context/Action.cs b/src/Fdc3/Context/Action.cs new file mode 100644 index 0000000..61d2639 --- /dev/null +++ b/src/Fdc3/Context/Action.cs @@ -0,0 +1,34 @@ +/* + * Morgan Stanley makes this available to you under the Apache License, + * Version 2.0 (the "License"). You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0. + * + * See the NOTICE file distributed with this work for additional information + * regarding copyright ownership. Unless required by applicable law or agreed + * to in writing, software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express + * or implied. See the License for the specific language governing permissions + * and limitations under the License. + */ + +namespace Finos.Fdc3.Context +{ + public class Action : Context, IContext + { + public Action(string title, IContext context, string? intent, IAppIdentifier? app = null, object? id = null, string? name = null) + : base(ContextTypes.Action, id, name) + { + this.Title = title; + this.Context = context; + this.Intent = intent; + this.App = app; + } + + public string Title { get; private set; } + public IContext Context { get; private set; } + public string? Intent { get; private set; } + public IAppIdentifier? App { get; private set; } + + } +} diff --git a/src/Fdc3/Context/ContextTypes.cs b/src/Fdc3/Context/ContextTypes.cs index 56e7e44..23abfcf 100644 --- a/src/Fdc3/Context/ContextTypes.cs +++ b/src/Fdc3/Context/ContextTypes.cs @@ -19,6 +19,7 @@ namespace Finos.Fdc3.Context { public static class ContextTypes { + public static readonly string Action = "fdc3.action"; public static readonly string Chart = "fdc3.chart"; public static readonly string ChatInitSettings = "fdc3.chat.initSettings"; public static readonly string Contact = "fdc3.contact"; @@ -38,6 +39,7 @@ public static class ContextTypes public static IDictionary Map = new Dictionary() { + { ContextTypes.Action, typeof(Action) }, { ContextTypes.Chart, typeof(Chart) }, { ContextTypes.ChatInitSettings, typeof(ChatInitSettings) }, { ContextTypes.Contact, typeof(Contact) }, diff --git a/src/Tests/Finos.Fdc3.NewtonsoftJson.Tests/Context/ActionTests.cs b/src/Tests/Finos.Fdc3.NewtonsoftJson.Tests/Context/ActionTests.cs new file mode 100644 index 0000000..f198a66 --- /dev/null +++ b/src/Tests/Finos.Fdc3.NewtonsoftJson.Tests/Context/ActionTests.cs @@ -0,0 +1,33 @@ +/* + * Morgan Stanley makes this available to you under the Apache License, + * Version 2.0 (the "License"). You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0. + * + * See the NOTICE file distributed with this work for additional information + * regarding copyright ownership. Unless required by applicable law or agreed + * to in writing, software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express + * or implied. See the License for the specific language governing permissions + * and limitations under the License. + */ + +using Finos.Fdc3.Context; + +namespace Finos.Fdc3.NewtonsoftJson.Tests.Context; + +public class ActionTests : ContextSchemaTest +{ + public ActionTests() + : base("https://fdc3.finos.org/schemas/2.1/context/action.schema.json") + { + } + + [Fact] + public async void Action_SerializedJsonMatchesSchema() + { + Instrument instrument = new Instrument(new InstrumentID { Ticker = "TICKER" }); + Fdc3.Context.Action action = new Fdc3.Context.Action("title", instrument, "ViewInstrument", new AppIdentifier("appid", "instanceid")); + await this.ValidateSchema(action); + } +} \ No newline at end of file diff --git a/src/Tests/Finos.Fdc3.Tests/Context/ActionTests.cs b/src/Tests/Finos.Fdc3.Tests/Context/ActionTests.cs new file mode 100644 index 0000000..648ca7e --- /dev/null +++ b/src/Tests/Finos.Fdc3.Tests/Context/ActionTests.cs @@ -0,0 +1,33 @@ +/* + * Morgan Stanley makes this available to you under the Apache License, + * Version 2.0 (the "License"). You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0. + * + * See the NOTICE file distributed with this work for additional information + * regarding copyright ownership. Unless required by applicable law or agreed + * to in writing, software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express + * or implied. See the License for the specific language governing permissions + * and limitations under the License. + */ + +using Finos.Fdc3.Context; + +namespace Finos.Fdc3.Tests.Context; + +public class ActionTests +{ + [Fact] + public void Action_PropertiesMatchParams() + { + Instrument instrument = new Instrument(new InstrumentID { Ticker = "TICKER" }); + Fdc3.Context.Action action = new Fdc3.Context.Action("title", instrument, "ViewInstrument", new AppIdentifier("appid", "instanceid")); + + Assert.Same("title", action.Title); + Assert.Equal(instrument, action.Context); + Assert.Same("TICKER", (action.Context as Instrument)?.ID?.Ticker); + Assert.Same("appid", action.App.AppId); + Assert.Same("instanceid", action.App.InstanceId); + } +} \ No newline at end of file From 5c95a626dd4c85e580111f29604b97faadc2412f Mon Sep 17 00:00:00 2001 From: bingenito <28159742+bingenito@users.noreply.github.com> Date: Wed, 17 Jul 2024 06:20:29 -0400 Subject: [PATCH 14/31] Update version to prepare for 2.1.0 beta 1 --- src/Directory.Build.props | 4 ++-- src/Fdc3/IIntentMetadata.cs | 5 ++++- src/Fdc3/IntentMetadata.cs | 13 ++++++++++--- src/Tests/Finos.Fdc3.Tests/IntentMetadataTests.cs | 11 ++++++----- 4 files changed, 22 insertions(+), 11 deletions(-) diff --git a/src/Directory.Build.props b/src/Directory.Build.props index db563d9..e737245 100644 --- a/src/Directory.Build.props +++ b/src/Directory.Build.props @@ -1,7 +1,7 @@  - 2.0.0 - + 2.1.0 + beta.1 Morgan Stanley Morgan Stanley Copyright 2023 Morgan Stanley diff --git a/src/Fdc3/IIntentMetadata.cs b/src/Fdc3/IIntentMetadata.cs index 26b1d66..11a8853 100644 --- a/src/Fdc3/IIntentMetadata.cs +++ b/src/Fdc3/IIntentMetadata.cs @@ -12,6 +12,8 @@ * and limitations under the License. */ +using System; + namespace Finos.Fdc3 { /// @@ -27,6 +29,7 @@ public interface IIntentMetadata /// /// A friendly display name for the intent that should be used to render UI elements. /// - string DisplayName { get; } + [Obsolete("Use the intent name for display as display name may vary for each application as it is defined in the app's AppD record.")] + string? DisplayName { get; } } } diff --git a/src/Fdc3/IntentMetadata.cs b/src/Fdc3/IntentMetadata.cs index 85d17fc..79413ee 100644 --- a/src/Fdc3/IntentMetadata.cs +++ b/src/Fdc3/IntentMetadata.cs @@ -21,10 +21,16 @@ namespace Finos.Fdc3 /// public class IntentMetadata : IIntentMetadata { - public IntentMetadata(string name, string displayName) + public IntentMetadata(string name) { this.Name = name ?? throw new ArgumentNullException(nameof(name)); - this.DisplayName = displayName ?? throw new ArgumentNullException(nameof(displayName)); + } + + + [Obsolete] + public IntentMetadata(string name, string? displayName = null) : this(name) + { + this.DisplayName = displayName; } /// @@ -35,6 +41,7 @@ public IntentMetadata(string name, string displayName) /// /// A friendly display name for the intent that should be used to render UI elements. /// - public string DisplayName { get; } + [Obsolete("Use the intent name for display as display name may vary for each application as it is defined in the app's AppD record.")] + public string? DisplayName { get; } } } diff --git a/src/Tests/Finos.Fdc3.Tests/IntentMetadataTests.cs b/src/Tests/Finos.Fdc3.Tests/IntentMetadataTests.cs index 68cc8cb..b681e77 100644 --- a/src/Tests/Finos.Fdc3.Tests/IntentMetadataTests.cs +++ b/src/Tests/Finos.Fdc3.Tests/IntentMetadataTests.cs @@ -25,15 +25,16 @@ public void IntentMetadata_NullName_ArgumentNullException() } [Fact] - public void IntentMetadata_NullDisplayName_ArgumentNullException() + public void IntentMetadata_PropertiesMatchParamsFromCtor1() { -#pragma warning disable CS8625 // Cannot convert null literal to non-nullable reference type. - Assert.Throws(() => new IntentMetadata("name", null)); -#pragma warning restore CS8625 // Cannot convert null literal to non-nullable reference type. + IIntentMetadata metadata = new IntentMetadata("name"); + Assert.Same("name", metadata.Name); + Assert.Null(metadata.DisplayName); } + [Fact] - public void IntentMetadata_PropertiesMatchParams() + public void IntentMetadata_PropertiesMatchParamsFromCtor2() { IIntentMetadata metadata = new IntentMetadata("name", "displayname"); Assert.Same("name", metadata.Name); From d59928a0fc50660a5d6d4f3f8fa240a18aa88a4b Mon Sep 17 00:00:00 2001 From: bingenito <28159742+bingenito@users.noreply.github.com> Date: Wed, 17 Jul 2024 07:45:37 -0400 Subject: [PATCH 15/31] Add ChatRoom context type --- src/Fdc3/Context/ChatRoom.cs | 29 ++++++++++++++++ src/Fdc3/Context/ContextTypes.cs | 1 + .../Context/ChatRoomTests.cs | 33 +++++++++++++++++++ .../Finos.Fdc3.Tests/Context/ChatRoomTests.cs | 31 +++++++++++++++++ 4 files changed, 94 insertions(+) create mode 100644 src/Fdc3/Context/ChatRoom.cs create mode 100644 src/Tests/Finos.Fdc3.NewtonsoftJson.Tests/Context/ChatRoomTests.cs create mode 100644 src/Tests/Finos.Fdc3.Tests/Context/ChatRoomTests.cs diff --git a/src/Fdc3/Context/ChatRoom.cs b/src/Fdc3/Context/ChatRoom.cs new file mode 100644 index 0000000..9cebbb8 --- /dev/null +++ b/src/Fdc3/Context/ChatRoom.cs @@ -0,0 +1,29 @@ +/* + * Morgan Stanley makes this available to you under the Apache License, + * Version 2.0 (the "License"). You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0. + * + * See the NOTICE file distributed with this work for additional information + * regarding copyright ownership. Unless required by applicable law or agreed + * to in writing, software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express + * or implied. See the License for the specific language governing permissions + * and limitations under the License. + */ + +namespace Finos.Fdc3.Context +{ + public class ChatRoom : Context, IContext, IRecipient + { + public ChatRoom(object id, string providerName, string? url = null, string? name = null) + : base(ContextTypes.ChatRoom, id, name) + { + this.ProviderName = providerName; + this.Url = url; + } + + public string ProviderName { get; set; } + public string? Url { get; set; } + } +} diff --git a/src/Fdc3/Context/ContextTypes.cs b/src/Fdc3/Context/ContextTypes.cs index 23abfcf..cf177de 100644 --- a/src/Fdc3/Context/ContextTypes.cs +++ b/src/Fdc3/Context/ContextTypes.cs @@ -22,6 +22,7 @@ public static class ContextTypes public static readonly string Action = "fdc3.action"; public static readonly string Chart = "fdc3.chart"; public static readonly string ChatInitSettings = "fdc3.chat.initSettings"; + public static readonly string ChatRoom = "fdc3.chat.room"; public static readonly string Contact = "fdc3.contact"; public static readonly string ContactList = "fdc3.contactList"; public static readonly string Country = "fdc3.country"; diff --git a/src/Tests/Finos.Fdc3.NewtonsoftJson.Tests/Context/ChatRoomTests.cs b/src/Tests/Finos.Fdc3.NewtonsoftJson.Tests/Context/ChatRoomTests.cs new file mode 100644 index 0000000..77abf2e --- /dev/null +++ b/src/Tests/Finos.Fdc3.NewtonsoftJson.Tests/Context/ChatRoomTests.cs @@ -0,0 +1,33 @@ +/* + * Morgan Stanley makes this available to you under the Apache License, + * Version 2.0 (the "License"). You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0. + * + * See the NOTICE file distributed with this work for additional information + * regarding copyright ownership. Unless required by applicable law or agreed + * to in writing, software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express + * or implied. See the License for the specific language governing permissions + * and limitations under the License. + */ + +using Finos.Fdc3.Context; + +namespace Finos.Fdc3.NewtonsoftJson.Tests.Context; + +public class ChatroomTests : ContextSchemaTest +{ + public ChatroomTests() + : base("https://fdc3.finos.org/schemas/2.1/context/chatRoom.schema.json") + { + } + + [Fact] + public async void ChatRoom_SerializedJsonMatchesSchema() + { + dynamic chatRoomID = new { StreamId = "j75xqXy25NB0dacUI3FNBH", AnyOtherKey = "abcdef" }; + ChatRoom chatRoom = new ChatRoom(chatRoomID, "provider", "http://test.com", "name"); + await this.ValidateSchema(chatRoom); + } +} \ No newline at end of file diff --git a/src/Tests/Finos.Fdc3.Tests/Context/ChatRoomTests.cs b/src/Tests/Finos.Fdc3.Tests/Context/ChatRoomTests.cs new file mode 100644 index 0000000..e1db1c2 --- /dev/null +++ b/src/Tests/Finos.Fdc3.Tests/Context/ChatRoomTests.cs @@ -0,0 +1,31 @@ +/* + * Morgan Stanley makes this available to you under the Apache License, + * Version 2.0 (the "License"). You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0. + * + * See the NOTICE file distributed with this work for additional information + * regarding copyright ownership. Unless required by applicable law or agreed + * to in writing, software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express + * or implied. See the License for the specific language governing permissions + * and limitations under the License. + */ + +using Finos.Fdc3.Context; + +namespace Finos.Fdc3.Tests.Context; + +public class ChatRoomTests +{ + [Fact] + public void ChatRoom_PropertiesMatchParams() + { + dynamic chatRoomID = new { StreamId = "j75xqXy25NB0dacUI3FNBH", AnyOtherKey = "abcdef" }; + ChatRoom chatRoom = new ChatRoom(chatRoomID, "provider", "http://test.com", "name"); + + Assert.Equal(chatRoomID, chatRoom.ID); + Assert.Same("http://test.com", chatRoom.Url); + Assert.Same("name", chatRoom.Name); + } +} \ No newline at end of file From 2f803ad82fba4c639df1616e7ef91035602748a5 Mon Sep 17 00:00:00 2001 From: bingenito <28159742+bingenito@users.noreply.github.com> Date: Fri, 19 Jul 2024 10:39:06 -0400 Subject: [PATCH 16/31] Ignore obsolete warnings in tests as members still tested --- src/Tests/Finos.Fdc3.Tests/AppIntentTests.cs | 4 ++++ src/Tests/Finos.Fdc3.Tests/Context/ActionTests.cs | 4 ++-- src/Tests/Finos.Fdc3.Tests/IntentMetadataTests.cs | 8 ++++++++ 3 files changed, 14 insertions(+), 2 deletions(-) diff --git a/src/Tests/Finos.Fdc3.Tests/AppIntentTests.cs b/src/Tests/Finos.Fdc3.Tests/AppIntentTests.cs index f27e6d1..139e8be 100644 --- a/src/Tests/Finos.Fdc3.Tests/AppIntentTests.cs +++ b/src/Tests/Finos.Fdc3.Tests/AppIntentTests.cs @@ -28,14 +28,18 @@ public void AppIntent_NullIntent_ThrowsArgumentNullException() public void AppIntent_NullApps_ThrowsArgumentNullException() { #pragma warning disable CS8625 // Cannot convert null literal to non-nullable reference type. +#pragma warning disable CS0612 // Type or member is obsolete Assert.Throws(() => new AppIntent(new IntentMetadata("name", "displayName"), null)); +#pragma warning restore CS0612 // Type or member is obsolete #pragma warning restore CS8625 // Cannot convert null literal to non-nullable reference type. } [Fact] public void AppIntent_NonNullParams_PropertyMatchesParam() { +#pragma warning disable CS0612 // Type or member is obsolete IIntentMetadata metadata = new IntentMetadata("name", "displayName"); +#pragma warning restore CS0612 // Type or member is obsolete IAppMetadata[] apps = { new AppMetadata("appid") }; IAppIntent appIntent = new AppIntent(metadata, apps); diff --git a/src/Tests/Finos.Fdc3.Tests/Context/ActionTests.cs b/src/Tests/Finos.Fdc3.Tests/Context/ActionTests.cs index 648ca7e..d620ae5 100644 --- a/src/Tests/Finos.Fdc3.Tests/Context/ActionTests.cs +++ b/src/Tests/Finos.Fdc3.Tests/Context/ActionTests.cs @@ -27,7 +27,7 @@ public void Action_PropertiesMatchParams() Assert.Same("title", action.Title); Assert.Equal(instrument, action.Context); Assert.Same("TICKER", (action.Context as Instrument)?.ID?.Ticker); - Assert.Same("appid", action.App.AppId); - Assert.Same("instanceid", action.App.InstanceId); + Assert.Same("appid", action.App?.AppId); + Assert.Same("instanceid", action.App?.InstanceId); } } \ No newline at end of file diff --git a/src/Tests/Finos.Fdc3.Tests/IntentMetadataTests.cs b/src/Tests/Finos.Fdc3.Tests/IntentMetadataTests.cs index b681e77..bcda13c 100644 --- a/src/Tests/Finos.Fdc3.Tests/IntentMetadataTests.cs +++ b/src/Tests/Finos.Fdc3.Tests/IntentMetadataTests.cs @@ -20,7 +20,9 @@ public class IntentMetadataTests public void IntentMetadata_NullName_ArgumentNullException() { #pragma warning disable CS8625 // Cannot convert null literal to non-nullable reference type. +#pragma warning disable CS0612 // Type or member is obsolete Assert.Throws(() => new IntentMetadata(null, "displayname")); +#pragma warning restore CS0612 // Type or member is obsolete #pragma warning restore CS8625 // Cannot convert null literal to non-nullable reference type. } @@ -29,15 +31,21 @@ public void IntentMetadata_PropertiesMatchParamsFromCtor1() { IIntentMetadata metadata = new IntentMetadata("name"); Assert.Same("name", metadata.Name); +#pragma warning disable CS0618 // Type or member is obsolete Assert.Null(metadata.DisplayName); +#pragma warning restore CS0618 // Type or member is obsolete } [Fact] public void IntentMetadata_PropertiesMatchParamsFromCtor2() { +#pragma warning disable CS0612 // Type or member is obsolete IIntentMetadata metadata = new IntentMetadata("name", "displayname"); +#pragma warning restore CS0612 // Type or member is obsolete Assert.Same("name", metadata.Name); +#pragma warning disable CS0618 // Type or member is obsolete Assert.Same("displayname", metadata.DisplayName); +#pragma warning restore CS0618 // Type or member is obsolete } } \ No newline at end of file From 9985b4605dbfcfecc47385803533972ff1ebc027 Mon Sep 17 00:00:00 2001 From: bingenito <28159742+bingenito@users.noreply.github.com> Date: Fri, 19 Jul 2024 10:49:39 -0400 Subject: [PATCH 17/31] Add ChatSearchCriteria context type --- src/Fdc3/Context/ChatSearchCriteria.cs | 30 ++++++++++++++++ src/Fdc3/Context/ContextTypes.cs | 1 + .../Context/ChatSearchCriteriaTests.cs | 35 +++++++++++++++++++ .../Context/ChatSearchCriteriaTests.cs | 30 ++++++++++++++++ 4 files changed, 96 insertions(+) create mode 100644 src/Fdc3/Context/ChatSearchCriteria.cs create mode 100644 src/Tests/Finos.Fdc3.NewtonsoftJson.Tests/Context/ChatSearchCriteriaTests.cs create mode 100644 src/Tests/Finos.Fdc3.Tests/Context/ChatSearchCriteriaTests.cs diff --git a/src/Fdc3/Context/ChatSearchCriteria.cs b/src/Fdc3/Context/ChatSearchCriteria.cs new file mode 100644 index 0000000..b64a305 --- /dev/null +++ b/src/Fdc3/Context/ChatSearchCriteria.cs @@ -0,0 +1,30 @@ +/* + * Morgan Stanley makes this available to you under the Apache License, + * Version 2.0 (the "License"). You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0. + * + * See the NOTICE file distributed with this work for additional information + * regarding copyright ownership. Unless required by applicable law or agreed + * to in writing, software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express + * or implied. See the License for the specific language governing permissions + * and limitations under the License. + */ + +using System.Collections; +using System.Dynamic; + +namespace Finos.Fdc3.Context +{ + public class ChatSearchCriteria : Context, IContext + { + public ChatSearchCriteria(IEnumerable criteria, object? id = null, string? name = null) + : base(ContextTypes.ChatSearchCriteria, id, name) + { + this.Criteria = criteria; + } + + public IEnumerable Criteria { get; set; } + } +} diff --git a/src/Fdc3/Context/ContextTypes.cs b/src/Fdc3/Context/ContextTypes.cs index cf177de..110b779 100644 --- a/src/Fdc3/Context/ContextTypes.cs +++ b/src/Fdc3/Context/ContextTypes.cs @@ -23,6 +23,7 @@ public static class ContextTypes public static readonly string Chart = "fdc3.chart"; public static readonly string ChatInitSettings = "fdc3.chat.initSettings"; public static readonly string ChatRoom = "fdc3.chat.room"; + public static readonly string ChatSearchCriteria = "fdc3.chat.searchCriteria"; public static readonly string Contact = "fdc3.contact"; public static readonly string ContactList = "fdc3.contactList"; public static readonly string Country = "fdc3.country"; diff --git a/src/Tests/Finos.Fdc3.NewtonsoftJson.Tests/Context/ChatSearchCriteriaTests.cs b/src/Tests/Finos.Fdc3.NewtonsoftJson.Tests/Context/ChatSearchCriteriaTests.cs new file mode 100644 index 0000000..c675b89 --- /dev/null +++ b/src/Tests/Finos.Fdc3.NewtonsoftJson.Tests/Context/ChatSearchCriteriaTests.cs @@ -0,0 +1,35 @@ +/* + * Morgan Stanley makes this available to you under the Apache License, + * Version 2.0 (the "License"). You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0. + * + * See the NOTICE file distributed with this work for additional information + * regarding copyright ownership. Unless required by applicable law or agreed + * to in writing, software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express + * or implied. See the License for the specific language governing permissions + * and limitations under the License. + */ + +using Finos.Fdc3.Context; +using Newtonsoft.Json; +using System.Reflection.PortableExecutable; + +namespace Finos.Fdc3.NewtonsoftJson.Tests.Context; + +public class ChatSearchCriteriaTests : ContextSchemaTest +{ + public ChatSearchCriteriaTests() + : base("https://fdc3.finos.org/schemas/2.1/context/chatSearchCriteria.schema.json") + { + } + + [Fact] + public async void ChatSearchCriteria_SerializedJsonMatchesSchema() + { + Instrument instrument = new Instrument(new InstrumentID { Ticker = "TICKER" }); + ChatSearchCriteria criteria = new ChatSearchCriteria(new object[] { instrument, "searchterm" }); + string json = await this.ValidateSchema(criteria); + } +} \ No newline at end of file diff --git a/src/Tests/Finos.Fdc3.Tests/Context/ChatSearchCriteriaTests.cs b/src/Tests/Finos.Fdc3.Tests/Context/ChatSearchCriteriaTests.cs new file mode 100644 index 0000000..8b7598d --- /dev/null +++ b/src/Tests/Finos.Fdc3.Tests/Context/ChatSearchCriteriaTests.cs @@ -0,0 +1,30 @@ +/* + * Morgan Stanley makes this available to you under the Apache License, + * Version 2.0 (the "License"). You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0. + * + * See the NOTICE file distributed with this work for additional information + * regarding copyright ownership. Unless required by applicable law or agreed + * to in writing, software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express + * or implied. See the License for the specific language governing permissions + * and limitations under the License. + */ + +using Finos.Fdc3.Context; + +namespace Finos.Fdc3.Tests.Context; + +public class ChatSearchCriteriaTests +{ + [Fact] + public void ChatSearchCriteria_PropertiesMatchParams() + { + Instrument instrument = new Instrument(new InstrumentID { Ticker = "TICKER" }); + ChatSearchCriteria criteria = new ChatSearchCriteria(new object[] { instrument, "searchterm" }); + + Assert.Equal(instrument, criteria.Criteria.Cast().First()); + Assert.Same("searchterm", criteria.Criteria.Cast().Last()); + } +} \ No newline at end of file From 905a4b56016cb2d524000d0115ee2b79b97f3407 Mon Sep 17 00:00:00 2001 From: bingenito <28159742+bingenito@users.noreply.github.com> Date: Fri, 19 Jul 2024 12:22:14 -0400 Subject: [PATCH 18/31] Fix warnings --- .../Finos.Fdc3.NewtonsoftJson.Tests/Context/ActionTests.cs | 2 +- .../Context/ChatSearchCriteriaTests.cs | 2 +- .../Context/TransactionResultTests.cs | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/Tests/Finos.Fdc3.NewtonsoftJson.Tests/Context/ActionTests.cs b/src/Tests/Finos.Fdc3.NewtonsoftJson.Tests/Context/ActionTests.cs index f198a66..d498590 100644 --- a/src/Tests/Finos.Fdc3.NewtonsoftJson.Tests/Context/ActionTests.cs +++ b/src/Tests/Finos.Fdc3.NewtonsoftJson.Tests/Context/ActionTests.cs @@ -24,7 +24,7 @@ public ActionTests() } [Fact] - public async void Action_SerializedJsonMatchesSchema() + public async Task Action_SerializedJsonMatchesSchema() { Instrument instrument = new Instrument(new InstrumentID { Ticker = "TICKER" }); Fdc3.Context.Action action = new Fdc3.Context.Action("title", instrument, "ViewInstrument", new AppIdentifier("appid", "instanceid")); diff --git a/src/Tests/Finos.Fdc3.NewtonsoftJson.Tests/Context/ChatSearchCriteriaTests.cs b/src/Tests/Finos.Fdc3.NewtonsoftJson.Tests/Context/ChatSearchCriteriaTests.cs index c675b89..32d83dd 100644 --- a/src/Tests/Finos.Fdc3.NewtonsoftJson.Tests/Context/ChatSearchCriteriaTests.cs +++ b/src/Tests/Finos.Fdc3.NewtonsoftJson.Tests/Context/ChatSearchCriteriaTests.cs @@ -26,7 +26,7 @@ public ChatSearchCriteriaTests() } [Fact] - public async void ChatSearchCriteria_SerializedJsonMatchesSchema() + public async Task ChatSearchCriteria_SerializedJsonMatchesSchema() { Instrument instrument = new Instrument(new InstrumentID { Ticker = "TICKER" }); ChatSearchCriteria criteria = new ChatSearchCriteria(new object[] { instrument, "searchterm" }); diff --git a/src/Tests/Finos.Fdc3.NewtonsoftJson.Tests/Context/TransactionResultTests.cs b/src/Tests/Finos.Fdc3.NewtonsoftJson.Tests/Context/TransactionResultTests.cs index a007652..7498f37 100644 --- a/src/Tests/Finos.Fdc3.NewtonsoftJson.Tests/Context/TransactionResultTests.cs +++ b/src/Tests/Finos.Fdc3.NewtonsoftJson.Tests/Context/TransactionResultTests.cs @@ -24,7 +24,7 @@ public TransactionResultTests() } [Fact] - public async void TransactionResult_SerializedJsonMatchesSchema() + public async Task TransactionResult_SerializedJsonMatchesSchema() { TransactionResult transactionResult = new TransactionResult("Created", new Contact(new ContactID { Email = "email@test.com", FDS_ID = "fdsid" }, "contact"), "message"); await this.ValidateSchema(transactionResult); From 1ec3fd9ba8ca0f668db0ff38a4d81135ebb62ad2 Mon Sep 17 00:00:00 2001 From: bingenito <28159742+bingenito@users.noreply.github.com> Date: Fri, 19 Jul 2024 12:33:44 -0400 Subject: [PATCH 19/31] Add mising context Type property tests --- src/Tests/Finos.Fdc3.Tests/Context/ActionTests.cs | 1 + src/Tests/Finos.Fdc3.Tests/Context/ChatRoomTests.cs | 2 ++ src/Tests/Finos.Fdc3.Tests/Context/ChatSearchCriteriaTests.cs | 2 ++ src/Tests/Finos.Fdc3.Tests/Context/TimeRangeTests.cs | 1 + src/Tests/Finos.Fdc3.Tests/Context/TransactionResultTests.cs | 2 ++ 5 files changed, 8 insertions(+) diff --git a/src/Tests/Finos.Fdc3.Tests/Context/ActionTests.cs b/src/Tests/Finos.Fdc3.Tests/Context/ActionTests.cs index d620ae5..115bbd3 100644 --- a/src/Tests/Finos.Fdc3.Tests/Context/ActionTests.cs +++ b/src/Tests/Finos.Fdc3.Tests/Context/ActionTests.cs @@ -29,5 +29,6 @@ public void Action_PropertiesMatchParams() Assert.Same("TICKER", (action.Context as Instrument)?.ID?.Ticker); Assert.Same("appid", action.App?.AppId); Assert.Same("instanceid", action.App?.InstanceId); + } } \ No newline at end of file diff --git a/src/Tests/Finos.Fdc3.Tests/Context/ChatRoomTests.cs b/src/Tests/Finos.Fdc3.Tests/Context/ChatRoomTests.cs index e1db1c2..e0e5031 100644 --- a/src/Tests/Finos.Fdc3.Tests/Context/ChatRoomTests.cs +++ b/src/Tests/Finos.Fdc3.Tests/Context/ChatRoomTests.cs @@ -13,6 +13,7 @@ */ using Finos.Fdc3.Context; +using System; namespace Finos.Fdc3.Tests.Context; @@ -27,5 +28,6 @@ public void ChatRoom_PropertiesMatchParams() Assert.Equal(chatRoomID, chatRoom.ID); Assert.Same("http://test.com", chatRoom.Url); Assert.Same("name", chatRoom.Name); + Assert.Same(ContextTypes.ChatRoom, chatRoom.Type); } } \ No newline at end of file diff --git a/src/Tests/Finos.Fdc3.Tests/Context/ChatSearchCriteriaTests.cs b/src/Tests/Finos.Fdc3.Tests/Context/ChatSearchCriteriaTests.cs index 8b7598d..618f7c5 100644 --- a/src/Tests/Finos.Fdc3.Tests/Context/ChatSearchCriteriaTests.cs +++ b/src/Tests/Finos.Fdc3.Tests/Context/ChatSearchCriteriaTests.cs @@ -13,6 +13,7 @@ */ using Finos.Fdc3.Context; +using System; namespace Finos.Fdc3.Tests.Context; @@ -26,5 +27,6 @@ public void ChatSearchCriteria_PropertiesMatchParams() Assert.Equal(instrument, criteria.Criteria.Cast().First()); Assert.Same("searchterm", criteria.Criteria.Cast().Last()); + Assert.Same(ContextTypes.ChatSearchCriteria, criteria.Type); } } \ No newline at end of file diff --git a/src/Tests/Finos.Fdc3.Tests/Context/TimeRangeTests.cs b/src/Tests/Finos.Fdc3.Tests/Context/TimeRangeTests.cs index f523104..b581263 100644 --- a/src/Tests/Finos.Fdc3.Tests/Context/TimeRangeTests.cs +++ b/src/Tests/Finos.Fdc3.Tests/Context/TimeRangeTests.cs @@ -33,5 +33,6 @@ public void TimeRange_PropertiesMatchParams() Assert.Same(startTime, timeRange.StartTime); Assert.Same(endTime, timeRange.EndTime); Assert.Same("timerange", timeRange.Name); + Assert.Same(ContextTypes.TimeRange, timeRange.Type); } } \ No newline at end of file diff --git a/src/Tests/Finos.Fdc3.Tests/Context/TransactionResultTests.cs b/src/Tests/Finos.Fdc3.Tests/Context/TransactionResultTests.cs index 81a8c6b..c0dd752 100644 --- a/src/Tests/Finos.Fdc3.Tests/Context/TransactionResultTests.cs +++ b/src/Tests/Finos.Fdc3.Tests/Context/TransactionResultTests.cs @@ -13,6 +13,7 @@ */ using Finos.Fdc3.Context; +using System; namespace Finos.Fdc3.Tests.Context; @@ -27,5 +28,6 @@ public void TransactionResult_PropertiesMatchParams() Assert.Same("Created", result.Status); Assert.Equal(contact, result.Context); Assert.Same("message", result.Message); + Assert.Same(ContextTypes.TransactionResult, result.Type) ; } } \ No newline at end of file From ba7180a59f981ea5a37fb7e7ba64e22de84963f5 Mon Sep 17 00:00:00 2001 From: bingenito <28159742+bingenito@users.noreply.github.com> Date: Fri, 19 Jul 2024 12:43:07 -0400 Subject: [PATCH 20/31] Add Message context type --- .../Fdc3CamelCaseNamingPolicy.cs | 5 +++ .../Fdc3CamelCaseNamingStrategy.cs | 4 +++ src/Fdc3/Context/ContextTypes.cs | 1 + src/Fdc3/Context/Message.cs | 35 +++++++++++++++++++ .../Context/MessageTests.cs | 32 +++++++++++++++++ .../Finos.Fdc3.Tests/Context/MessageTests.cs | 30 ++++++++++++++++ 6 files changed, 107 insertions(+) create mode 100644 src/Fdc3/Context/Message.cs create mode 100644 src/Tests/Finos.Fdc3.NewtonsoftJson.Tests/Context/MessageTests.cs create mode 100644 src/Tests/Finos.Fdc3.Tests/Context/MessageTests.cs diff --git a/src/Fdc3.Json/Serialization/Fdc3CamelCaseNamingPolicy.cs b/src/Fdc3.Json/Serialization/Fdc3CamelCaseNamingPolicy.cs index 91c020d..be42cce 100644 --- a/src/Fdc3.Json/Serialization/Fdc3CamelCaseNamingPolicy.cs +++ b/src/Fdc3.Json/Serialization/Fdc3CamelCaseNamingPolicy.cs @@ -37,6 +37,11 @@ public override string ConvertName(string name) case "SEDOL": case "LEI": return name; + case "TextPlain": + return "text/plain"; + case "TextMarkdown": + return "text/markdown"; + default: return CamelCase.ConvertName(name); } diff --git a/src/Fdc3.NewtonsoftJson/Serialization/Fdc3CamelCaseNamingStrategy.cs b/src/Fdc3.NewtonsoftJson/Serialization/Fdc3CamelCaseNamingStrategy.cs index 23520ce..3d66c41 100644 --- a/src/Fdc3.NewtonsoftJson/Serialization/Fdc3CamelCaseNamingStrategy.cs +++ b/src/Fdc3.NewtonsoftJson/Serialization/Fdc3CamelCaseNamingStrategy.cs @@ -37,6 +37,10 @@ public override string GetPropertyName(string name, bool hasSpecifiedName) case "SEDOL": case "LEI": return name; + case "TextPlain": + return "text/plain"; + case "TextMarkdown": + return "text/markdown"; default: return base.GetPropertyName(name, hasSpecifiedName); diff --git a/src/Fdc3/Context/ContextTypes.cs b/src/Fdc3/Context/ContextTypes.cs index 110b779..66cc146 100644 --- a/src/Fdc3/Context/ContextTypes.cs +++ b/src/Fdc3/Context/ContextTypes.cs @@ -31,6 +31,7 @@ public static class ContextTypes public static readonly string Email = "fdc3.email"; public static readonly string Instrument = "fdc3.instrument"; public static readonly string InstrumentList = "fdc3.instrumentList"; + public static readonly string Message = "fdc3.message"; public static readonly string Nothing = "fdc3.nothing"; public static readonly string Organization = "fdc3.organization"; public static readonly string Portfolio = "fdc3.portfolio"; diff --git a/src/Fdc3/Context/Message.cs b/src/Fdc3/Context/Message.cs new file mode 100644 index 0000000..841a3a0 --- /dev/null +++ b/src/Fdc3/Context/Message.cs @@ -0,0 +1,35 @@ +/* + * Morgan Stanley makes this available to you under the Apache License, + * Version 2.0 (the "License"). You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0. + * + * See the NOTICE file distributed with this work for additional information + * regarding copyright ownership. Unless required by applicable law or agreed + * to in writing, software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express + * or implied. See the License for the specific language governing permissions + * and limitations under the License. + */ + +using System.Runtime.InteropServices.ComTypes; + +namespace Finos.Fdc3.Context +{ + public class Message : Context, IContext + { + public Message(MessageText text, object? id = null, string? name = null) + : base(ContextTypes.Message, id, name) + { + this.Text = text; + } + + public MessageText Text { get; set; } + } + + public class MessageText + { + public string? TextPlain { get; set; } + public string? TextMarkdown { get; set; } + } +} diff --git a/src/Tests/Finos.Fdc3.NewtonsoftJson.Tests/Context/MessageTests.cs b/src/Tests/Finos.Fdc3.NewtonsoftJson.Tests/Context/MessageTests.cs new file mode 100644 index 0000000..a08e020 --- /dev/null +++ b/src/Tests/Finos.Fdc3.NewtonsoftJson.Tests/Context/MessageTests.cs @@ -0,0 +1,32 @@ +/* + * Morgan Stanley makes this available to you under the Apache License, + * Version 2.0 (the "License"). You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0. + * + * See the NOTICE file distributed with this work for additional information + * regarding copyright ownership. Unless required by applicable law or agreed + * to in writing, software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express + * or implied. See the License for the specific language governing permissions + * and limitations under the License. + */ + +using Finos.Fdc3.Context; + +namespace Finos.Fdc3.NewtonsoftJson.Tests.Context; + +public class MessageTests : ContextSchemaTest +{ + public MessageTests() + : base("https://fdc3.finos.org/schemas/2.1/context/message.schema.json") + { + } + + [Fact] + public async Task Message_SerializedJsonMatchesSchema() + { + Message message = new Message(new MessageText() { TextPlain = "textplain", TextMarkdown = "textmarkdown" }); + string json = await this.ValidateSchema(message); + } +} \ No newline at end of file diff --git a/src/Tests/Finos.Fdc3.Tests/Context/MessageTests.cs b/src/Tests/Finos.Fdc3.Tests/Context/MessageTests.cs new file mode 100644 index 0000000..4a09e5c --- /dev/null +++ b/src/Tests/Finos.Fdc3.Tests/Context/MessageTests.cs @@ -0,0 +1,30 @@ +/* + * Morgan Stanley makes this available to you under the Apache License, + * Version 2.0 (the "License"). You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0. + * + * See the NOTICE file distributed with this work for additional information + * regarding copyright ownership. Unless required by applicable law or agreed + * to in writing, software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express + * or implied. See the License for the specific language governing permissions + * and limitations under the License. + */ + +using Finos.Fdc3.Context; + +namespace Finos.Fdc3.Tests.Context; + +public class MessageTests +{ + [Fact] + public void Message_PropertiesMatchParams() + { + Message message = new Message(new MessageText() { TextPlain = "textplain", TextMarkdown = "textmarkdown" }); + + Assert.Same("textplain", message.Text.TextPlain); + Assert.Same("textmarkdown", message.Text.TextMarkdown); + Assert.Same(ContextTypes.Message, message?.Type); + } +} \ No newline at end of file From 483ed1f2521a6b4c5acef7ff997a158847cbe402 Mon Sep 17 00:00:00 2001 From: bingenito <28159742+bingenito@users.noreply.github.com> Date: Fri, 19 Jul 2024 13:12:20 -0400 Subject: [PATCH 21/31] Add ChatMessage context type --- src/Fdc3/Context/ChatMessage.cs | 29 ++++++++++++++ src/Fdc3/Context/ContextTypes.cs | 1 + .../Context/ChatMessageTests.cs | 35 +++++++++++++++++ .../Context/ChatMessageTests.cs | 38 +++++++++++++++++++ 4 files changed, 103 insertions(+) create mode 100644 src/Fdc3/Context/ChatMessage.cs create mode 100644 src/Tests/Finos.Fdc3.NewtonsoftJson.Tests/Context/ChatMessageTests.cs create mode 100644 src/Tests/Finos.Fdc3.Tests/Context/ChatMessageTests.cs diff --git a/src/Fdc3/Context/ChatMessage.cs b/src/Fdc3/Context/ChatMessage.cs new file mode 100644 index 0000000..d28bc19 --- /dev/null +++ b/src/Fdc3/Context/ChatMessage.cs @@ -0,0 +1,29 @@ +/* + * Morgan Stanley makes this available to you under the Apache License, + * Version 2.0 (the "License"). You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0. + * + * See the NOTICE file distributed with this work for additional information + * regarding copyright ownership. Unless required by applicable law or agreed + * to in writing, software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express + * or implied. See the License for the specific language governing permissions + * and limitations under the License. + */ + +namespace Finos.Fdc3.Context +{ + public class ChatMessage : Context, IContext, IRecipient + { + public ChatMessage(ChatRoom chatRoom, Message message, object? id = null, string? name = null) + : base(ContextTypes.ChatMessage, id, name) + { + this.ChatRoom = chatRoom; + this.Message = message; + } + + public ChatRoom ChatRoom { get; set; } + public Message Message { get; set; } + } +} diff --git a/src/Fdc3/Context/ContextTypes.cs b/src/Fdc3/Context/ContextTypes.cs index 66cc146..1e82ec1 100644 --- a/src/Fdc3/Context/ContextTypes.cs +++ b/src/Fdc3/Context/ContextTypes.cs @@ -22,6 +22,7 @@ public static class ContextTypes public static readonly string Action = "fdc3.action"; public static readonly string Chart = "fdc3.chart"; public static readonly string ChatInitSettings = "fdc3.chat.initSettings"; + public static readonly string ChatMessage = "fdc3.chat.message"; public static readonly string ChatRoom = "fdc3.chat.room"; public static readonly string ChatSearchCriteria = "fdc3.chat.searchCriteria"; public static readonly string Contact = "fdc3.contact"; diff --git a/src/Tests/Finos.Fdc3.NewtonsoftJson.Tests/Context/ChatMessageTests.cs b/src/Tests/Finos.Fdc3.NewtonsoftJson.Tests/Context/ChatMessageTests.cs new file mode 100644 index 0000000..d1b2255 --- /dev/null +++ b/src/Tests/Finos.Fdc3.NewtonsoftJson.Tests/Context/ChatMessageTests.cs @@ -0,0 +1,35 @@ +/* + * Morgan Stanley makes this available to you under the Apache License, + * Version 2.0 (the "License"). You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0. + * + * See the NOTICE file distributed with this work for additional information + * regarding copyright ownership. Unless required by applicable law or agreed + * to in writing, software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express + * or implied. See the License for the specific language governing permissions + * and limitations under the License. + */ + +using Finos.Fdc3.Context; + +namespace Finos.Fdc3.NewtonsoftJson.Tests.Context; + +public class ChatMessageTests : ContextSchemaTest +{ + public ChatMessageTests() + : base("https://fdc3.finos.org/schemas/2.1/context/chatMessage.schema.json") + { + } + + [Fact] + public async Task ChatMessage_SerializedJsonMatchesSchema() + { + dynamic chatRoomID = new { StreamId = "j75xqXy25NB0dacUI3FNBH", AnyOtherKey = "abcdef" }; + ChatRoom chatRoom = new ChatRoom(chatRoomID, "provider", "http://test.com", "name"); + ChatMessage message = new ChatMessage(chatRoom, new Message(new MessageText() { TextPlain = "plaintext", TextMarkdown = "textmarkdown" }, null, "message"), null, "chatmessage"); + + await this.ValidateSchema(message); + } +} \ No newline at end of file diff --git a/src/Tests/Finos.Fdc3.Tests/Context/ChatMessageTests.cs b/src/Tests/Finos.Fdc3.Tests/Context/ChatMessageTests.cs new file mode 100644 index 0000000..8c2acda --- /dev/null +++ b/src/Tests/Finos.Fdc3.Tests/Context/ChatMessageTests.cs @@ -0,0 +1,38 @@ +/* + * Morgan Stanley makes this available to you under the Apache License, + * Version 2.0 (the "License"). You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0. + * + * See the NOTICE file distributed with this work for additional information + * regarding copyright ownership. Unless required by applicable law or agreed + * to in writing, software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express + * or implied. See the License for the specific language governing permissions + * and limitations under the License. + */ + +using Finos.Fdc3.Context; +using System; + +namespace Finos.Fdc3.Tests.Context; + +public class ChatMessageTests +{ + [Fact] + public void ChatMessage_PropertiesMatchParams() + { + dynamic chatRoomID = new { StreamId = "j75xqXy25NB0dacUI3FNBH", AnyOtherKey = "abcdef" }; + ChatRoom chatRoom = new ChatRoom(chatRoomID, "provider", "http://test.com", "name"); + ChatMessage message = new ChatMessage(chatRoom, new Message(new MessageText() { TextPlain = "textplain", TextMarkdown = "textmarkdown" }, null, "message"), null, "chatmessage"); + + Assert.Equal(chatRoomID, message.ChatRoom.ID); + Assert.Same("http://test.com", message.ChatRoom.Url); + Assert.Same("name", message.ChatRoom.Name); + Assert.Same(ContextTypes.ChatRoom, message.ChatRoom.Type); + Assert.Same("textplain", message.Message.Text.TextPlain); + Assert.Same("textmarkdown", message.Message.Text.TextMarkdown); + Assert.Same(ContextTypes.Message, message.Message.Type); + Assert.Same(ContextTypes.ChatMessage, message.Type); + } +} \ No newline at end of file From 616aa94e48806a260a3b3e8b05067946ba2ba5e2 Mon Sep 17 00:00:00 2001 From: bingenito <28159742+bingenito@users.noreply.github.com> Date: Fri, 19 Jul 2024 13:43:41 -0400 Subject: [PATCH 22/31] Update ChatInitSettings to use defined types --- src/Fdc3/Context/ChatInitSettings.cs | 15 ++++++++++++--- .../Context/ChatInitSettingsTests.cs | 4 ++-- .../Context/ChatInitSettingsTests.cs | 7 ++++--- 3 files changed, 18 insertions(+), 8 deletions(-) diff --git a/src/Fdc3/Context/ChatInitSettings.cs b/src/Fdc3/Context/ChatInitSettings.cs index f0cfa55..89a77fc 100644 --- a/src/Fdc3/Context/ChatInitSettings.cs +++ b/src/Fdc3/Context/ChatInitSettings.cs @@ -16,7 +16,7 @@ namespace Finos.Fdc3.Context { public class ChatInitSettings : Context, IContext { - public ChatInitSettings(ContactList? members = null, string? message = null, string? chatName = null, object? options = null, object? id = null, string? name = null) + public ChatInitSettings(ContactList? members = null, Message? message = null, string? chatName = null, ChatInitSettingsOptions? options = null, object? id = null, string? name = null) : base(ContextTypes.ChatInitSettings, id, name) { this.Members = members; @@ -26,10 +26,19 @@ public ChatInitSettings(ContactList? members = null, string? message = null, str } public string? ChatName { get; set; } - public string? Message { get; set; } + public Message? Message { get; set; } public ContactList? Members { get; set; } - public object? Options { get; set; } + public ChatInitSettingsOptions? Options { get; set; } object? IContext.ID => base.ID; } + + public class ChatInitSettingsOptions + { + public bool? GroupRecipients { get; set; } + public bool? IsPublic { get; set; } + public bool? AllowHistoryBrowsing { get; set; } + public bool? AllowMessageCopy { get; set; } + public bool? AllowAddUser { get; set; } + } } diff --git a/src/Tests/Finos.Fdc3.NewtonsoftJson.Tests/Context/ChatInitSettingsTests.cs b/src/Tests/Finos.Fdc3.NewtonsoftJson.Tests/Context/ChatInitSettingsTests.cs index 405573e..ff13ed0 100644 --- a/src/Tests/Finos.Fdc3.NewtonsoftJson.Tests/Context/ChatInitSettingsTests.cs +++ b/src/Tests/Finos.Fdc3.NewtonsoftJson.Tests/Context/ChatInitSettingsTests.cs @@ -28,9 +28,9 @@ public async void ChatInitSettings_SerializedJsonMatchesSchema() { ChatInitSettings chatInitSettings = new ChatInitSettings( new ContactList(new Contact[] { new Contact(new ContactID() { Email = "email@test.com", FDS_ID = "fdsid" }) }), - "initMessage", + new Message(new MessageText() { TextPlain = "textplain", TextMarkdown = "textmarkdown" }), "chatName", - new { GroupRecipients = true, IsPublic = true, AllowHistoryBrowsing = true, AllowMessageCopy = true, AllowAddUser = true }, + new ChatInitSettingsOptions() { GroupRecipients = true, IsPublic = true, AllowHistoryBrowsing = true, AllowMessageCopy = true, AllowAddUser = true }, null, "chatInitSettings" ); diff --git a/src/Tests/Finos.Fdc3.Tests/Context/ChatInitSettingsTests.cs b/src/Tests/Finos.Fdc3.Tests/Context/ChatInitSettingsTests.cs index 1fa3e8b..1565b89 100644 --- a/src/Tests/Finos.Fdc3.Tests/Context/ChatInitSettingsTests.cs +++ b/src/Tests/Finos.Fdc3.Tests/Context/ChatInitSettingsTests.cs @@ -21,10 +21,11 @@ public class ChatInitSettingsTests [Fact] public void ChatInitSettings_PropertiesMatchParams() { - var options = new { GroupRecipients = true, @Public = true, AllowHistoryBrowsing = true, AllowMessageCopy = true, AllowAddUser = true }; + ChatInitSettingsOptions options = new ChatInitSettingsOptions() { GroupRecipients = true, IsPublic = true, AllowHistoryBrowsing = true, AllowMessageCopy = true, AllowAddUser = true }; + Message message = new Message(new MessageText() { TextPlain = "textplain", TextMarkdown = "textmarkdown" }); ChatInitSettings chatInitSettings = new ChatInitSettings( new ContactList(new Contact[] { new Contact(new ContactID() { Email = "email@test.com", FDS_ID = "fdsid" }) }), - "initMessage", + message, "chatName", options, null, @@ -33,7 +34,7 @@ public void ChatInitSettings_PropertiesMatchParams() Assert.Same("email@test.com", chatInitSettings?.Members?.Contacts?.First()?.ID?.Email); Assert.Same(options, chatInitSettings?.Options); - Assert.Same("initMessage", chatInitSettings?.Message); + Assert.Same(message, chatInitSettings?.Message); Assert.Same("chatName", chatInitSettings?.ChatName); Assert.Same("chatInitSettings", chatInitSettings?.Name); Assert.Same(ContextTypes.ChatInitSettings, chatInitSettings?.Type); From 01dded7744894b6139d38d065f2def21d9931d4b Mon Sep 17 00:00:00 2001 From: bingenito <28159742+bingenito@users.noreply.github.com> Date: Fri, 19 Jul 2024 14:28:15 -0400 Subject: [PATCH 23/31] Mark AppD displayName as obsolete --- src/Fdc3.AppDirectory/IntentMetadata.cs | 20 +++++++++++++++---- src/Fdc3/IntentMetadata.cs | 4 ++-- .../DeserializationTest.cs | 2 ++ src/Tests/Finos.Fdc3.Tests/AppIntentTests.cs | 4 ++++ .../Finos.Fdc3.Tests/IntentMetadataTests.cs | 4 ++++ 5 files changed, 28 insertions(+), 6 deletions(-) diff --git a/src/Fdc3.AppDirectory/IntentMetadata.cs b/src/Fdc3.AppDirectory/IntentMetadata.cs index 0728891..e9421fe 100644 --- a/src/Fdc3.AppDirectory/IntentMetadata.cs +++ b/src/Fdc3.AppDirectory/IntentMetadata.cs @@ -26,16 +26,27 @@ public class IntentMetadata : IIntentMetadata /// Initializes a new instance of the class. /// /// The name - /// The displayName /// The contexts /// Exception contexts is null - public IntentMetadata(string name, string displayName, IEnumerable contexts) + public IntentMetadata(string name, IEnumerable contexts) { Name = name; - DisplayName = displayName; Contexts = contexts ?? throw new ArgumentNullException(nameof(contexts)); } + /// + /// Initializes a new instance of the class. + /// + /// The name + /// The displayName + /// The contexts + /// Exception contexts is null + [Obsolete("Use the intent name for display as display name may vary for each application as it is defined in the app's AppD record.")] + public IntentMetadata(string name, string displayName, IEnumerable contexts) : this(name, contexts) + { + DisplayName = displayName; + } + /// /// Definition of an intent that an app listens for /// @@ -44,7 +55,8 @@ public IntentMetadata(string name, string displayName, IEnumerable conte /// /// An optional display name for the intent that may be used in UI instead of the name. /// - public string DisplayName { get; set; } + [Obsolete("Use the intent name for display as display name may vary for each application as it is defined in the app's AppD record.")] + public string? DisplayName { get; set; } /// /// A comma separated list of the types of contexts the intent offered by the application diff --git a/src/Fdc3/IntentMetadata.cs b/src/Fdc3/IntentMetadata.cs index 79413ee..59b4c44 100644 --- a/src/Fdc3/IntentMetadata.cs +++ b/src/Fdc3/IntentMetadata.cs @@ -27,7 +27,7 @@ public IntentMetadata(string name) } - [Obsolete] + [Obsolete("Use the intent name for display as display name may vary for each application as it is defined in the app's AppD record.")] public IntentMetadata(string name, string? displayName = null) : this(name) { this.DisplayName = displayName; @@ -41,7 +41,7 @@ public IntentMetadata(string name, string? displayName = null) : this(name) /// /// A friendly display name for the intent that should be used to render UI elements. /// - [Obsolete("Use the intent name for display as display name may vary for each application as it is defined in the app's AppD record.")] + [Obsolete("Use the intent name for display as display name may vary for each application as it is defined in the app's AppD record.")] public string? DisplayName { get; } } } diff --git a/src/Tests/Finos.Fdc3.AppDirectory.Tests/DeserializationTest.cs b/src/Tests/Finos.Fdc3.AppDirectory.Tests/DeserializationTest.cs index ef6453d..d59f887 100644 --- a/src/Tests/Finos.Fdc3.AppDirectory.Tests/DeserializationTest.cs +++ b/src/Tests/Finos.Fdc3.AppDirectory.Tests/DeserializationTest.cs @@ -52,7 +52,9 @@ protected void ValidateApp(Fdc3App app) Assert.Contains("ViewChart", app.Interop!.Intents!.ListensFor!.Keys); Assert.Contains("myApp.GetPrice", app.Interop.Intents.ListensFor.Keys); Assert.Contains("fdc3.instrument", app.Interop!.Intents!.ListensFor!["myApp.GetPrice"].Contexts!); +#pragma warning disable CS0618 // Type or member is obsolete Assert.Equal("Get Price", app.Interop!.Intents!.ListensFor!["myApp.GetPrice"].DisplayName); +#pragma warning restore CS0618 // Type or member is obsolete Assert.Equal("myApp.quote", app.Interop!.Intents!.ListensFor!["myApp.GetPrice"].ResultType); Assert.Equal("ViewChart", app.Interop!.Intents!.ListensFor!["ViewChart"].Name); Assert.Equal("myApp.GetPrice", app.Interop!.Intents!.ListensFor!["myApp.GetPrice"].Name); diff --git a/src/Tests/Finos.Fdc3.Tests/AppIntentTests.cs b/src/Tests/Finos.Fdc3.Tests/AppIntentTests.cs index 139e8be..8c49f30 100644 --- a/src/Tests/Finos.Fdc3.Tests/AppIntentTests.cs +++ b/src/Tests/Finos.Fdc3.Tests/AppIntentTests.cs @@ -29,7 +29,9 @@ public void AppIntent_NullApps_ThrowsArgumentNullException() { #pragma warning disable CS8625 // Cannot convert null literal to non-nullable reference type. #pragma warning disable CS0612 // Type or member is obsolete +#pragma warning disable CS0618 // Type or member is obsolete Assert.Throws(() => new AppIntent(new IntentMetadata("name", "displayName"), null)); +#pragma warning restore CS0618 // Type or member is obsolete #pragma warning restore CS0612 // Type or member is obsolete #pragma warning restore CS8625 // Cannot convert null literal to non-nullable reference type. } @@ -37,8 +39,10 @@ public void AppIntent_NullApps_ThrowsArgumentNullException() [Fact] public void AppIntent_NonNullParams_PropertyMatchesParam() { +#pragma warning disable CS0618 // Type or member is obsolete #pragma warning disable CS0612 // Type or member is obsolete IIntentMetadata metadata = new IntentMetadata("name", "displayName"); +#pragma warning restore CS0618 // Type or member is obsolete #pragma warning restore CS0612 // Type or member is obsolete IAppMetadata[] apps = { new AppMetadata("appid") }; diff --git a/src/Tests/Finos.Fdc3.Tests/IntentMetadataTests.cs b/src/Tests/Finos.Fdc3.Tests/IntentMetadataTests.cs index bcda13c..590a7cd 100644 --- a/src/Tests/Finos.Fdc3.Tests/IntentMetadataTests.cs +++ b/src/Tests/Finos.Fdc3.Tests/IntentMetadataTests.cs @@ -21,7 +21,9 @@ public void IntentMetadata_NullName_ArgumentNullException() { #pragma warning disable CS8625 // Cannot convert null literal to non-nullable reference type. #pragma warning disable CS0612 // Type or member is obsolete +#pragma warning disable CS0618 // Type or member is obsolete Assert.Throws(() => new IntentMetadata(null, "displayname")); +#pragma warning restore CS0618 // Type or member is obsolete #pragma warning restore CS0612 // Type or member is obsolete #pragma warning restore CS8625 // Cannot convert null literal to non-nullable reference type. } @@ -40,8 +42,10 @@ public void IntentMetadata_PropertiesMatchParamsFromCtor1() [Fact] public void IntentMetadata_PropertiesMatchParamsFromCtor2() { +#pragma warning disable CS0618 // Type or member is obsolete #pragma warning disable CS0612 // Type or member is obsolete IIntentMetadata metadata = new IntentMetadata("name", "displayname"); +#pragma warning restore CS0618 // Type or member is obsolete #pragma warning restore CS0612 // Type or member is obsolete Assert.Same("name", metadata.Name); #pragma warning disable CS0618 // Type or member is obsolete From da435983c363f8d36f33dfe64ed4235b67931e62 Mon Sep 17 00:00:00 2001 From: bingenito <28159742+bingenito@users.noreply.github.com> Date: Fri, 19 Jul 2024 14:34:44 -0400 Subject: [PATCH 24/31] Mark AppD App Name as obsolete --- src/Fdc3.AppDirectory/Fdc3App.cs | 14 +++++++++++--- .../DeserializationTest.cs | 2 ++ 2 files changed, 13 insertions(+), 3 deletions(-) diff --git a/src/Fdc3.AppDirectory/Fdc3App.cs b/src/Fdc3.AppDirectory/Fdc3App.cs index 4c640e4..e6639ad 100644 --- a/src/Fdc3.AppDirectory/Fdc3App.cs +++ b/src/Fdc3.AppDirectory/Fdc3App.cs @@ -25,13 +25,20 @@ namespace Finos.Fdc3.AppDirectory /// public class Fdc3App { - public Fdc3App(string appId, string name, AppType type, object details) + public Fdc3App(string appId, AppType type, object details) { AppId = appId ?? throw new ArgumentNullException(nameof(appId)); - Name = name ?? throw new ArgumentNullException( nameof(name)); Type = type; Details = details ?? throw new ArgumentNullException(nameof(details)); } + + public Fdc3App(string appId, string name, AppType type, object details) : this(appId, type, details) + { +#pragma warning disable CS0618 // Type or member is obsolete + Name = name ?? throw new ArgumentNullException( nameof(name)); +#pragma warning restore CS0618 // Type or member is obsolete + } + /// /// The unique application identifier located within a specific application directory instance. /// @@ -43,7 +50,8 @@ public Fdc3App(string appId, string name, AppType type, object details) /// for multiple versions of the same app. The same appName could occur in other directories. /// We are not currently specifying app name conventions in the document. /// - public string Name { get; set; } + [Obsolete("Use `AppId` to identify apps and `Title` for their display names.")] + public string? Name { get; set; } /// /// The technology type that is used to launch and run the application. diff --git a/src/Tests/Finos.Fdc3.AppDirectory.Tests/DeserializationTest.cs b/src/Tests/Finos.Fdc3.AppDirectory.Tests/DeserializationTest.cs index d59f887..73bef22 100644 --- a/src/Tests/Finos.Fdc3.AppDirectory.Tests/DeserializationTest.cs +++ b/src/Tests/Finos.Fdc3.AppDirectory.Tests/DeserializationTest.cs @@ -20,7 +20,9 @@ public partial class DeserializationTest protected void ValidateApp(Fdc3App app) { Assert.Equal("my-application", app!.AppId); +#pragma warning disable CS0618 // Type or member is obsolete Assert.Equal("my-application", app.Name); +#pragma warning restore CS0618 // Type or member is obsolete Assert.Equal("My Application", app.Title); Assert.Equal("An example application that uses FDC3 and fully describes itself in an AppD record.", app.Description); Assert.Equal("1.0.0", app.Version); From 084d350b8291d022808d15b8ce90be11064b300c Mon Sep 17 00:00:00 2001 From: bingenito <28159742+bingenito@users.noreply.github.com> Date: Fri, 19 Jul 2024 14:40:09 -0400 Subject: [PATCH 25/31] Mark AppD App CustomConfig as obsolete --- src/Fdc3.AppDirectory/Fdc3App.cs | 1 + 1 file changed, 1 insertion(+) diff --git a/src/Fdc3.AppDirectory/Fdc3App.cs b/src/Fdc3.AppDirectory/Fdc3App.cs index e6639ad..2f01886 100644 --- a/src/Fdc3.AppDirectory/Fdc3App.cs +++ b/src/Fdc3.AppDirectory/Fdc3App.cs @@ -155,6 +155,7 @@ public Fdc3App(string appId, string name, AppType type, object details) : this(a /// /// An optional set of name value pairs that can be used to deliver custom data from an App Directory to a launcher. /// + [Obsolete] public Dictionary? CustomConfig { get; set; } /// From 5e1c370f5ea86cee5ad094e0e21d732cdd2d5dcc Mon Sep 17 00:00:00 2001 From: bingenito <28159742+bingenito@users.noreply.github.com> Date: Fri, 19 Jul 2024 14:50:04 -0400 Subject: [PATCH 26/31] Fix AppD Interop AppChannel to use ID instead of Name --- src/Fdc3.AppDirectory/AppChannel.cs | 12 ++++++------ .../DeserializationTest.cs | 2 +- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/src/Fdc3.AppDirectory/AppChannel.cs b/src/Fdc3.AppDirectory/AppChannel.cs index dd75ff6..f21c692 100644 --- a/src/Fdc3.AppDirectory/AppChannel.cs +++ b/src/Fdc3.AppDirectory/AppChannel.cs @@ -28,16 +28,16 @@ public class AppChannel /// /// Initializes a new instance of the class. /// - /// The name - /// Exception if name is null - public AppChannel(string name) + /// The ID of the App Channel + /// Exception if ID is null + public AppChannel(string id) { - Name = name ?? throw new ArgumentNullException(nameof(name)); + ID = id ?? throw new ArgumentNullException(nameof(id)); } /// - /// The name of the App Channel. + /// The ID of the App Channel. /// - public string Name { get; set; } + public string ID { get; set; } /// /// A description of how the channel is used. diff --git a/src/Tests/Finos.Fdc3.AppDirectory.Tests/DeserializationTest.cs b/src/Tests/Finos.Fdc3.AppDirectory.Tests/DeserializationTest.cs index 73bef22..8a9928a 100644 --- a/src/Tests/Finos.Fdc3.AppDirectory.Tests/DeserializationTest.cs +++ b/src/Tests/Finos.Fdc3.AppDirectory.Tests/DeserializationTest.cs @@ -68,7 +68,7 @@ protected void ValidateApp(Fdc3App app) Assert.Contains("fdc3.instrument", app.Interop!.UserChannels!.Broadcasts!); Assert.Contains("fdc3.organization", app.Interop!.UserChannels!.ListensFor!); Assert.Single(app.Interop.AppChannels!); - Assert.Equal("myApp.quotes,", app.Interop!.AppChannels!.First().Name); + Assert.Equal("myApp.quotes,", app.Interop!.AppChannels!.First().ID); Assert.Contains("myApp.quote", app.Interop.AppChannels!.First().Broadcasts!); Assert.Contains("fdc3.instrument", app.Interop.AppChannels!.First().ListensFor!); Assert.Contains("fr-FR", app.LocalizedVersions!.Keys); From c1967088378dfbe171abbdfca99e1a44570198ea Mon Sep 17 00:00:00 2001 From: bingenito <28159742+bingenito@users.noreply.github.com> Date: Fri, 19 Jul 2024 15:27:20 -0400 Subject: [PATCH 27/31] Changer Chart OtherConfig from array to IEnumerable --- src/Fdc3/Context/Chart.cs | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/Fdc3/Context/Chart.cs b/src/Fdc3/Context/Chart.cs index eded89e..dd83759 100644 --- a/src/Fdc3/Context/Chart.cs +++ b/src/Fdc3/Context/Chart.cs @@ -12,11 +12,13 @@ * and limitations under the License. */ +using System.Collections.Generic; + namespace Finos.Fdc3.Context { public class Chart : Context, IContext { - public Chart(Instrument[] instruments, TimeRange? range = null, IContext[]? otherConfig = null, string? style = null, object? id = null, string? name = null) + public Chart(Instrument[] instruments, TimeRange? range = null, IEnumerable? otherConfig = null, string? style = null, object? id = null, string? name = null) : base(ContextTypes.Chart, id, name) { this.Instruments = instruments; @@ -27,7 +29,7 @@ public Chart(Instrument[] instruments, TimeRange? range = null, IContext[]? othe public Instrument[] Instruments { get; set; } public TimeRange? Range { get; set; } - public IContext[]? OtherConfig { get; set; } + public IEnumerable? OtherConfig { get; set; } public string? Style { get; set; } object? IContext.ID => base.ID; From b6331db821e6e7a505955b41c22a3d5678a61231 Mon Sep 17 00:00:00 2001 From: bingenito <28159742+bingenito@users.noreply.github.com> Date: Mon, 29 Jul 2024 12:39:33 -0400 Subject: [PATCH 28/31] Fix build warnings --- src/Examples/WpfFdc3/Fdc3/DesktopAgent.cs | 2 +- .../Finos.Fdc3.NewtonsoftJson.Tests/Context/ChartTests.cs | 2 +- .../Context/ChatInitSettingsTests.cs | 2 +- .../Finos.Fdc3.NewtonsoftJson.Tests/Context/ChatRoomTests.cs | 2 +- .../Context/ContactListTests.cs | 2 +- .../Finos.Fdc3.NewtonsoftJson.Tests/Context/ContactTests.cs | 2 +- .../Finos.Fdc3.NewtonsoftJson.Tests/Context/CountryTests.cs | 2 +- .../Finos.Fdc3.NewtonsoftJson.Tests/Context/CurrencyTests.cs | 2 +- .../Finos.Fdc3.NewtonsoftJson.Tests/Context/EmailTests.cs | 4 ++-- .../Context/InstrumentListTests.cs | 2 +- .../Context/InstrumentTests.cs | 2 +- .../Finos.Fdc3.NewtonsoftJson.Tests/Context/NothingTests.cs | 2 +- .../Context/OrganizationTests.cs | 2 +- .../Finos.Fdc3.NewtonsoftJson.Tests/Context/PortfolioTests.cs | 2 +- .../Finos.Fdc3.NewtonsoftJson.Tests/Context/PositionTests.cs | 2 +- .../Finos.Fdc3.NewtonsoftJson.Tests/Context/TimeRangeTests.cs | 2 +- .../Finos.Fdc3.NewtonsoftJson.Tests/Context/ValuationTests.cs | 2 +- 17 files changed, 18 insertions(+), 18 deletions(-) diff --git a/src/Examples/WpfFdc3/Fdc3/DesktopAgent.cs b/src/Examples/WpfFdc3/Fdc3/DesktopAgent.cs index a9c44c9..4bc48b6 100644 --- a/src/Examples/WpfFdc3/Fdc3/DesktopAgent.cs +++ b/src/Examples/WpfFdc3/Fdc3/DesktopAgent.cs @@ -33,7 +33,7 @@ public DesktopAgent() public Task AddContextListener(string? contextType, ContextHandler handler) where T : IContext { - return _currentChannel?.AddContextListener(contextType, handler); + return _currentChannel?.AddContextListener(contextType, handler) ?? throw new Exception("Unable to create listener"); } public Task AddIntentListener(string intent, IntentHandler handler) where T : IContext diff --git a/src/Tests/Finos.Fdc3.NewtonsoftJson.Tests/Context/ChartTests.cs b/src/Tests/Finos.Fdc3.NewtonsoftJson.Tests/Context/ChartTests.cs index 5a89ecb..9b73a21 100644 --- a/src/Tests/Finos.Fdc3.NewtonsoftJson.Tests/Context/ChartTests.cs +++ b/src/Tests/Finos.Fdc3.NewtonsoftJson.Tests/Context/ChartTests.cs @@ -24,7 +24,7 @@ public ChartTests() } [Fact] - public async void Chart_SerializedJsonMatchesSchema() + public async Task Chart_SerializedJsonMatchesSchema() { Instrument instrument = new Instrument(new InstrumentID { Ticker = "TICKER" }); TimeRange timeRange = new TimeRange(DateTime.Now.ToString("o"), DateTime.Now.ToString("o")); diff --git a/src/Tests/Finos.Fdc3.NewtonsoftJson.Tests/Context/ChatInitSettingsTests.cs b/src/Tests/Finos.Fdc3.NewtonsoftJson.Tests/Context/ChatInitSettingsTests.cs index ff13ed0..559e6c5 100644 --- a/src/Tests/Finos.Fdc3.NewtonsoftJson.Tests/Context/ChatInitSettingsTests.cs +++ b/src/Tests/Finos.Fdc3.NewtonsoftJson.Tests/Context/ChatInitSettingsTests.cs @@ -24,7 +24,7 @@ public ChatInitSettingsTests() } [Fact] - public async void ChatInitSettings_SerializedJsonMatchesSchema() + public async Task ChatInitSettings_SerializedJsonMatchesSchema() { ChatInitSettings chatInitSettings = new ChatInitSettings( new ContactList(new Contact[] { new Contact(new ContactID() { Email = "email@test.com", FDS_ID = "fdsid" }) }), diff --git a/src/Tests/Finos.Fdc3.NewtonsoftJson.Tests/Context/ChatRoomTests.cs b/src/Tests/Finos.Fdc3.NewtonsoftJson.Tests/Context/ChatRoomTests.cs index 77abf2e..40b7c15 100644 --- a/src/Tests/Finos.Fdc3.NewtonsoftJson.Tests/Context/ChatRoomTests.cs +++ b/src/Tests/Finos.Fdc3.NewtonsoftJson.Tests/Context/ChatRoomTests.cs @@ -24,7 +24,7 @@ public ChatroomTests() } [Fact] - public async void ChatRoom_SerializedJsonMatchesSchema() + public async Task ChatRoom_SerializedJsonMatchesSchema() { dynamic chatRoomID = new { StreamId = "j75xqXy25NB0dacUI3FNBH", AnyOtherKey = "abcdef" }; ChatRoom chatRoom = new ChatRoom(chatRoomID, "provider", "http://test.com", "name"); diff --git a/src/Tests/Finos.Fdc3.NewtonsoftJson.Tests/Context/ContactListTests.cs b/src/Tests/Finos.Fdc3.NewtonsoftJson.Tests/Context/ContactListTests.cs index 899e49d..680c87a 100644 --- a/src/Tests/Finos.Fdc3.NewtonsoftJson.Tests/Context/ContactListTests.cs +++ b/src/Tests/Finos.Fdc3.NewtonsoftJson.Tests/Context/ContactListTests.cs @@ -24,7 +24,7 @@ public ContactListTests() } [Fact] - public async void ContactList_SerializedJsonMatchesSchema() + public async Task ContactList_SerializedJsonMatchesSchema() { ContactList contactList = new ContactList(new Contact[] { new Contact(new ContactID { Email = "email@email.com", FDS_ID = "fdsid" }, "contact") }, "contactList"); await this.ValidateSchema(contactList); diff --git a/src/Tests/Finos.Fdc3.NewtonsoftJson.Tests/Context/ContactTests.cs b/src/Tests/Finos.Fdc3.NewtonsoftJson.Tests/Context/ContactTests.cs index de78945..687a3ee 100644 --- a/src/Tests/Finos.Fdc3.NewtonsoftJson.Tests/Context/ContactTests.cs +++ b/src/Tests/Finos.Fdc3.NewtonsoftJson.Tests/Context/ContactTests.cs @@ -23,7 +23,7 @@ public ContactTests() } [Fact] - public async void Contact_SerializedJsonMatchesSchema() + public async Task Contact_SerializedJsonMatchesSchema() { Contact contact = new Contact(new ContactID { Email = "email@test.com", FDS_ID = "fdsid" }, "contact"); await this.ValidateSchema(contact); diff --git a/src/Tests/Finos.Fdc3.NewtonsoftJson.Tests/Context/CountryTests.cs b/src/Tests/Finos.Fdc3.NewtonsoftJson.Tests/Context/CountryTests.cs index e89d8c6..3897ead 100644 --- a/src/Tests/Finos.Fdc3.NewtonsoftJson.Tests/Context/CountryTests.cs +++ b/src/Tests/Finos.Fdc3.NewtonsoftJson.Tests/Context/CountryTests.cs @@ -24,7 +24,7 @@ public CountryTests() } [Fact] - public async void Country_SerializedJsonMatchesSchema() + public async Task Country_SerializedJsonMatchesSchema() { Country country = new Country(new CountryID() { ISOALPHA2 = "isoalpha2", ISOALPHA3 = "isoalpha3" }, "country"); diff --git a/src/Tests/Finos.Fdc3.NewtonsoftJson.Tests/Context/CurrencyTests.cs b/src/Tests/Finos.Fdc3.NewtonsoftJson.Tests/Context/CurrencyTests.cs index 62461bc..e4ce627 100644 --- a/src/Tests/Finos.Fdc3.NewtonsoftJson.Tests/Context/CurrencyTests.cs +++ b/src/Tests/Finos.Fdc3.NewtonsoftJson.Tests/Context/CurrencyTests.cs @@ -24,7 +24,7 @@ public CurrencyTests() } [Fact] - public async void Currency_SerializedJsonMatchesSchema() + public async Task Currency_SerializedJsonMatchesSchema() { Currency currency = new Currency(new CurrencyID() { CURRENCY_ISOCODE = "AAA" }, "currency"); diff --git a/src/Tests/Finos.Fdc3.NewtonsoftJson.Tests/Context/EmailTests.cs b/src/Tests/Finos.Fdc3.NewtonsoftJson.Tests/Context/EmailTests.cs index 26bf7f6..92c053c 100644 --- a/src/Tests/Finos.Fdc3.NewtonsoftJson.Tests/Context/EmailTests.cs +++ b/src/Tests/Finos.Fdc3.NewtonsoftJson.Tests/Context/EmailTests.cs @@ -25,7 +25,7 @@ public EmailTests() } [Fact] - public async void Email_Contact_SerializedJsonMatchesSchema() + public async Task Email_Contact_SerializedJsonMatchesSchema() { Email email = new Email(new Contact(new ContactID() { Email = "email@test.com", FDS_ID = "fdsid" }), "subject", "body", null, "email"); string test = await this.ValidateSchema(email); @@ -45,7 +45,7 @@ public void Email_Contact_DeserializedJsonMatchesProperties() } [Fact] - public async void Email_ContactList_SerializedJsonMatchesSchema() + public async Task Email_ContactList_SerializedJsonMatchesSchema() { Email email = new Email(new ContactList(new Contact[] { new Contact(new ContactID() { Email = "email@test.com", FDS_ID = "fdsid" }) }), "subject", "body", null, "email"); await this.ValidateSchema(email); diff --git a/src/Tests/Finos.Fdc3.NewtonsoftJson.Tests/Context/InstrumentListTests.cs b/src/Tests/Finos.Fdc3.NewtonsoftJson.Tests/Context/InstrumentListTests.cs index 8e11476..8e65bcb 100644 --- a/src/Tests/Finos.Fdc3.NewtonsoftJson.Tests/Context/InstrumentListTests.cs +++ b/src/Tests/Finos.Fdc3.NewtonsoftJson.Tests/Context/InstrumentListTests.cs @@ -24,7 +24,7 @@ public InstrumentListTests() } [Fact] - public async void InstrumentList_SerializedJsonMatchesSchema() + public async Task InstrumentList_SerializedJsonMatchesSchema() { InstrumentList instrumentList = new InstrumentList(new Instrument[] { diff --git a/src/Tests/Finos.Fdc3.NewtonsoftJson.Tests/Context/InstrumentTests.cs b/src/Tests/Finos.Fdc3.NewtonsoftJson.Tests/Context/InstrumentTests.cs index 877bffb..af27486 100644 --- a/src/Tests/Finos.Fdc3.NewtonsoftJson.Tests/Context/InstrumentTests.cs +++ b/src/Tests/Finos.Fdc3.NewtonsoftJson.Tests/Context/InstrumentTests.cs @@ -24,7 +24,7 @@ public InstrumentTests() } [Fact] - public async void Instrument_SerializedJsonMatchesSchema() + public async Task Instrument_SerializedJsonMatchesSchema() { Instrument instrument = new Instrument( new InstrumentID diff --git a/src/Tests/Finos.Fdc3.NewtonsoftJson.Tests/Context/NothingTests.cs b/src/Tests/Finos.Fdc3.NewtonsoftJson.Tests/Context/NothingTests.cs index b65cc40..22a3b19 100644 --- a/src/Tests/Finos.Fdc3.NewtonsoftJson.Tests/Context/NothingTests.cs +++ b/src/Tests/Finos.Fdc3.NewtonsoftJson.Tests/Context/NothingTests.cs @@ -24,7 +24,7 @@ public NothingTests() } [Fact] - public async void Nothing_SerializedJsonMatchesSchema() + public async Task Nothing_SerializedJsonMatchesSchema() { Nothing nothing = new Nothing(); diff --git a/src/Tests/Finos.Fdc3.NewtonsoftJson.Tests/Context/OrganizationTests.cs b/src/Tests/Finos.Fdc3.NewtonsoftJson.Tests/Context/OrganizationTests.cs index c53ff82..b190b9c 100644 --- a/src/Tests/Finos.Fdc3.NewtonsoftJson.Tests/Context/OrganizationTests.cs +++ b/src/Tests/Finos.Fdc3.NewtonsoftJson.Tests/Context/OrganizationTests.cs @@ -24,7 +24,7 @@ public OrganizationTests() } [Fact] - public async void Organization_SerializedJsonMatchesSchema() + public async Task Organization_SerializedJsonMatchesSchema() { Organization organization = new Organization(new OrganizationID() { FDS_ID = "fdc_id", LEI = "lei", PERMID = "permid" }, "organization"); diff --git a/src/Tests/Finos.Fdc3.NewtonsoftJson.Tests/Context/PortfolioTests.cs b/src/Tests/Finos.Fdc3.NewtonsoftJson.Tests/Context/PortfolioTests.cs index 8df197f..e3104b3 100644 --- a/src/Tests/Finos.Fdc3.NewtonsoftJson.Tests/Context/PortfolioTests.cs +++ b/src/Tests/Finos.Fdc3.NewtonsoftJson.Tests/Context/PortfolioTests.cs @@ -24,7 +24,7 @@ public PortfolioTests() } [Fact] - public async void Portfolio_SerializedJsonMatchesSchema() + public async Task Portfolio_SerializedJsonMatchesSchema() { Portfolio portfolio = new Portfolio( new Position[] { new Position(0, new Instrument(new InstrumentID() { Ticker = "ticker" })) }, diff --git a/src/Tests/Finos.Fdc3.NewtonsoftJson.Tests/Context/PositionTests.cs b/src/Tests/Finos.Fdc3.NewtonsoftJson.Tests/Context/PositionTests.cs index 300ae82..9154f29 100644 --- a/src/Tests/Finos.Fdc3.NewtonsoftJson.Tests/Context/PositionTests.cs +++ b/src/Tests/Finos.Fdc3.NewtonsoftJson.Tests/Context/PositionTests.cs @@ -24,7 +24,7 @@ public PositionTests() } [Fact] - public async void Position_SerializedJsonMatchesSchema() + public async Task Position_SerializedJsonMatchesSchema() { Position position = new Position(0, new Instrument(new InstrumentID() { Ticker = "ticker" }), null, "position"); diff --git a/src/Tests/Finos.Fdc3.NewtonsoftJson.Tests/Context/TimeRangeTests.cs b/src/Tests/Finos.Fdc3.NewtonsoftJson.Tests/Context/TimeRangeTests.cs index 1b7af6e..ffe77b9 100644 --- a/src/Tests/Finos.Fdc3.NewtonsoftJson.Tests/Context/TimeRangeTests.cs +++ b/src/Tests/Finos.Fdc3.NewtonsoftJson.Tests/Context/TimeRangeTests.cs @@ -24,7 +24,7 @@ public TimeRangeTests() } [Fact] - public async void TimeRange_SerializedJsonMatchesSchema() + public async Task TimeRange_SerializedJsonMatchesSchema() { TimeRange timeRange = new TimeRange( DateTime.Now.ToString("o"), diff --git a/src/Tests/Finos.Fdc3.NewtonsoftJson.Tests/Context/ValuationTests.cs b/src/Tests/Finos.Fdc3.NewtonsoftJson.Tests/Context/ValuationTests.cs index 4435c60..8398c9e 100644 --- a/src/Tests/Finos.Fdc3.NewtonsoftJson.Tests/Context/ValuationTests.cs +++ b/src/Tests/Finos.Fdc3.NewtonsoftJson.Tests/Context/ValuationTests.cs @@ -24,7 +24,7 @@ public ValuationTests() } [Fact] - public async void Valuation_SerializedJsonMatchesSchema() + public async Task Valuation_SerializedJsonMatchesSchema() { var valuation = new Valuation("AAA", 1, 1, DateTime.Now.ToString("o"), DateTime.Now.ToString("o"), null, "valuation"); From 914ecee4d8047e43638fa553c22a7ec48a3897d0 Mon Sep 17 00:00:00 2001 From: bingenito <28159742+bingenito@users.noreply.github.com> Date: Mon, 29 Jul 2024 13:05:21 -0400 Subject: [PATCH 29/31] Add back ctor including obsolete members --- src/Fdc3.AppDirectory/Fdc3App.cs | 10 +++------- src/Fdc3.AppDirectory/IntentMetadata.cs | 19 +++++-------------- .../TestJsons/SampleAppForInterop.json | 2 +- 3 files changed, 9 insertions(+), 22 deletions(-) diff --git a/src/Fdc3.AppDirectory/Fdc3App.cs b/src/Fdc3.AppDirectory/Fdc3App.cs index 2f01886..15f5171 100644 --- a/src/Fdc3.AppDirectory/Fdc3App.cs +++ b/src/Fdc3.AppDirectory/Fdc3App.cs @@ -25,18 +25,14 @@ namespace Finos.Fdc3.AppDirectory /// public class Fdc3App { - public Fdc3App(string appId, AppType type, object details) + public Fdc3App(string appId, string name, AppType type, object details) { AppId = appId ?? throw new ArgumentNullException(nameof(appId)); - Type = type; - Details = details ?? throw new ArgumentNullException(nameof(details)); - } - - public Fdc3App(string appId, string name, AppType type, object details) : this(appId, type, details) - { #pragma warning disable CS0618 // Type or member is obsolete Name = name ?? throw new ArgumentNullException( nameof(name)); #pragma warning restore CS0618 // Type or member is obsolete + Type = type; + Details = details ?? throw new ArgumentNullException(nameof(details)); } /// diff --git a/src/Fdc3.AppDirectory/IntentMetadata.cs b/src/Fdc3.AppDirectory/IntentMetadata.cs index e9421fe..f387a51 100644 --- a/src/Fdc3.AppDirectory/IntentMetadata.cs +++ b/src/Fdc3.AppDirectory/IntentMetadata.cs @@ -22,18 +22,6 @@ namespace Finos.Fdc3.AppDirectory /// public class IntentMetadata : IIntentMetadata { - /// - /// Initializes a new instance of the class. - /// - /// The name - /// The contexts - /// Exception contexts is null - public IntentMetadata(string name, IEnumerable contexts) - { - Name = name; - Contexts = contexts ?? throw new ArgumentNullException(nameof(contexts)); - } - /// /// Initializes a new instance of the class. /// @@ -41,10 +29,13 @@ public IntentMetadata(string name, IEnumerable contexts) /// The displayName /// The contexts /// Exception contexts is null - [Obsolete("Use the intent name for display as display name may vary for each application as it is defined in the app's AppD record.")] - public IntentMetadata(string name, string displayName, IEnumerable contexts) : this(name, contexts) + public IntentMetadata(string name, string displayName, IEnumerable contexts) { + Name = name; +#pragma warning disable CS0618 // Type or member is obsolete DisplayName = displayName; +#pragma warning restore CS0618 // Type or member is obsolete + Contexts = contexts ?? throw new ArgumentNullException(nameof(contexts)); } /// diff --git a/src/Tests/Finos.Fdc3.AppDirectory.Tests/TestJsons/SampleAppForInterop.json b/src/Tests/Finos.Fdc3.AppDirectory.Tests/TestJsons/SampleAppForInterop.json index 2c90618..9b1eb92 100644 --- a/src/Tests/Finos.Fdc3.AppDirectory.Tests/TestJsons/SampleAppForInterop.json +++ b/src/Tests/Finos.Fdc3.AppDirectory.Tests/TestJsons/SampleAppForInterop.json @@ -96,7 +96,7 @@ }, "appChannels": [ { - "name": "myApp.quotes,", + "id": "myApp.quotes,", "description": "Used to share a stream of quotes for currently displayed instrument and may be used to change the currently displayed symbol,", "broadcasts": [ "myApp.quote" ], "listensFor": [ "fdc3.instrument" ] From ce68a38ddb4456931aaff7a0ceda4567ce6e52e7 Mon Sep 17 00:00:00 2001 From: bingenito <28159742+bingenito@users.noreply.github.com> Date: Mon, 29 Jul 2024 14:33:45 -0400 Subject: [PATCH 30/31] Remove uncessary imports --- src/Fdc3/Context/ChatSearchCriteria.cs | 1 - src/Fdc3/Context/Message.cs | 2 -- src/Fdc3/Context/TransactionResult.cs | 2 -- .../Context/ChatSearchCriteriaTests.cs | 2 -- 4 files changed, 7 deletions(-) diff --git a/src/Fdc3/Context/ChatSearchCriteria.cs b/src/Fdc3/Context/ChatSearchCriteria.cs index b64a305..bea33d1 100644 --- a/src/Fdc3/Context/ChatSearchCriteria.cs +++ b/src/Fdc3/Context/ChatSearchCriteria.cs @@ -13,7 +13,6 @@ */ using System.Collections; -using System.Dynamic; namespace Finos.Fdc3.Context { diff --git a/src/Fdc3/Context/Message.cs b/src/Fdc3/Context/Message.cs index 841a3a0..f8fbe53 100644 --- a/src/Fdc3/Context/Message.cs +++ b/src/Fdc3/Context/Message.cs @@ -12,8 +12,6 @@ * and limitations under the License. */ -using System.Runtime.InteropServices.ComTypes; - namespace Finos.Fdc3.Context { public class Message : Context, IContext diff --git a/src/Fdc3/Context/TransactionResult.cs b/src/Fdc3/Context/TransactionResult.cs index c1cd2f5..fa7c08e 100644 --- a/src/Fdc3/Context/TransactionResult.cs +++ b/src/Fdc3/Context/TransactionResult.cs @@ -12,8 +12,6 @@ * and limitations under the License. */ -using System.ComponentModel; - namespace Finos.Fdc3.Context { public class TransactionResult : Context, IContext diff --git a/src/Tests/Finos.Fdc3.NewtonsoftJson.Tests/Context/ChatSearchCriteriaTests.cs b/src/Tests/Finos.Fdc3.NewtonsoftJson.Tests/Context/ChatSearchCriteriaTests.cs index 32d83dd..314f3f6 100644 --- a/src/Tests/Finos.Fdc3.NewtonsoftJson.Tests/Context/ChatSearchCriteriaTests.cs +++ b/src/Tests/Finos.Fdc3.NewtonsoftJson.Tests/Context/ChatSearchCriteriaTests.cs @@ -13,8 +13,6 @@ */ using Finos.Fdc3.Context; -using Newtonsoft.Json; -using System.Reflection.PortableExecutable; namespace Finos.Fdc3.NewtonsoftJson.Tests.Context; From f13c648440db85b31a7e9473faf5b7ef7bf6f5ab Mon Sep 17 00:00:00 2001 From: bingenito <28159742+bingenito@users.noreply.github.com> Date: Mon, 29 Jul 2024 14:34:31 -0400 Subject: [PATCH 31/31] Add context type map entries for new context types --- src/Fdc3/Context/ContextTypes.cs | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/Fdc3/Context/ContextTypes.cs b/src/Fdc3/Context/ContextTypes.cs index 1e82ec1..8e1168b 100644 --- a/src/Fdc3/Context/ContextTypes.cs +++ b/src/Fdc3/Context/ContextTypes.cs @@ -46,6 +46,9 @@ public static class ContextTypes { ContextTypes.Action, typeof(Action) }, { ContextTypes.Chart, typeof(Chart) }, { ContextTypes.ChatInitSettings, typeof(ChatInitSettings) }, + { ContextTypes.ChatMessage, typeof(ChatMessage) }, + { ContextTypes.ChatRoom, typeof(ChatRoom) }, + { ContextTypes.ChatSearchCriteria, typeof(ChatSearchCriteria) }, { ContextTypes.Contact, typeof(Contact) }, { ContextTypes.ContactList, typeof(ContactList) }, { ContextTypes.Country, typeof(Country) }, @@ -53,12 +56,13 @@ public static class ContextTypes { ContextTypes.Email, typeof(Email) }, { ContextTypes.Instrument, typeof(Instrument) }, { ContextTypes.InstrumentList, typeof(InstrumentList) }, + { ContextTypes.Message, typeof(Message) }, { ContextTypes.Nothing, typeof(Nothing) }, { ContextTypes.Organization, typeof(Organization) }, { ContextTypes.Portfolio, typeof(Portfolio) }, { ContextTypes.Position, typeof(Position) }, { ContextTypes.TimeRange, typeof(TimeRange) }, - { ContextTypes.TransactionResult, typeof(TransactionResult) }, + { ContextTypes.TransactionResult, typeof(TransactionResult) }, { ContextTypes.Valuation, typeof(Valuation) }, };