From adaddad79352c156303e9178a6f172a18af50cd2 Mon Sep 17 00:00:00 2001 From: Roy Ben Shabat Date: Sat, 24 Oct 2020 06:40:07 +0300 Subject: Refactored DataStore Proto. --- .../Tango.UnitTesting/DataStore/DataStore_TST.cs | 34 ++++++++++++++++++++-- .../Tango.UnitTesting/Tango.UnitTesting.csproj | 6 +++- 2 files changed, 37 insertions(+), 3 deletions(-) (limited to 'Software/Visual_Studio/Tango.UnitTesting') diff --git a/Software/Visual_Studio/Tango.UnitTesting/DataStore/DataStore_TST.cs b/Software/Visual_Studio/Tango.UnitTesting/DataStore/DataStore_TST.cs index 1428aa210..594c8d7f8 100644 --- a/Software/Visual_Studio/Tango.UnitTesting/DataStore/DataStore_TST.cs +++ b/Software/Visual_Studio/Tango.UnitTesting/DataStore/DataStore_TST.cs @@ -11,6 +11,9 @@ using Tango.DataStore; using Tango.DataStore.Lite; using Tango.Core.IO; using Tango.DataStore.EF; +using Tango.PMR.Stubs; +using Tango.Transport; +using Tango.DataStore.Remote; namespace Tango.UnitTesting.DataStore { @@ -32,6 +35,27 @@ namespace Tango.UnitTesting.DataStore Run_Test(new EFDataStoreManager()); } + [TestMethod] + public void Remote_Data_Store_Working() + { + CalculateRequest calc = new CalculateRequest() + { + A = 10, + B = 15, + }; + + RemoteDataStoreGetResponse response = new RemoteDataStoreGetResponse(); + response.ProtoObject = DataStoreProtoObject.FromMessage(calc); + + byte[] data = GenericMessageSerializer.Serialize(response, PMR.Integration.GenericMessageProtocol.Bson); + + RemoteDataStoreGetResponse des = GenericMessageSerializer.Deserialize(data, PMR.Integration.GenericMessageProtocol.Bson); + + CalculateRequest cc = des.ProtoObject.Message as CalculateRequest; + + Assert.AreEqual(calc, cc); + } + private void Run_Test(IDataStoreManager manager) { IDataStoreCollection collection = manager.GetCollection("TEST"); @@ -72,7 +96,13 @@ namespace Tango.UnitTesting.DataStore Assert.AreEqual(value[0], 255); } - Assert.IsTrue(collection.Count() == 6); + { + collection.Put("calc", new CalculateRequest() { A = 10, B = 15 }); + CalculateRequest value = collection.Get("calc"); + Assert.AreEqual(value, new CalculateRequest() { A = 10, B = 15 }); + } + + Assert.IsTrue(collection.Count() == 7); Assert.ThrowsException(() => collection.Put("somekey", this)); @@ -82,7 +112,7 @@ namespace Tango.UnitTesting.DataStore collection.Delete("float"); Assert.ThrowsException(() => collection.Get("float")); - Assert.IsTrue(collection.Count() == 4); + Assert.IsTrue(collection.Count() == 5); collection.DeleteAll(); Assert.IsTrue(collection.Count() == 0); diff --git a/Software/Visual_Studio/Tango.UnitTesting/Tango.UnitTesting.csproj b/Software/Visual_Studio/Tango.UnitTesting/Tango.UnitTesting.csproj index 0371c1cca..b24079da0 100644 --- a/Software/Visual_Studio/Tango.UnitTesting/Tango.UnitTesting.csproj +++ b/Software/Visual_Studio/Tango.UnitTesting/Tango.UnitTesting.csproj @@ -221,6 +221,10 @@ {fa96bc0c-4055-475c-9dcc-70a5a9436b10} Tango.DataStore.Lite + + {29448f3c-9b3e-4da6-8555-46a8b9a6b3aa} + Tango.DataStore.Remote + {e0364dfa-0721-4637-9d32-9d22aac109d6} Tango.DataStore @@ -319,7 +323,7 @@ - + \ No newline at end of file -- cgit v1.3.1