diff options
| author | Roy Ben Shabat <Roy.mail.net@gmail.com> | 2020-10-24 06:40:07 +0300 |
|---|---|---|
| committer | Roy Ben Shabat <Roy.mail.net@gmail.com> | 2020-10-24 06:40:07 +0300 |
| commit | adaddad79352c156303e9178a6f172a18af50cd2 (patch) | |
| tree | 0ff2a59c3007bc9c40b7b543a9a2afe32dbc3d45 /Software/Visual_Studio/Tango.UnitTesting/DataStore | |
| parent | 2d803e9410cd383d8e66c300f86fe0f7374c81ea (diff) | |
| download | Tango-adaddad79352c156303e9178a6f172a18af50cd2.tar.gz Tango-adaddad79352c156303e9178a6f172a18af50cd2.zip | |
Refactored DataStore Proto.
Diffstat (limited to 'Software/Visual_Studio/Tango.UnitTesting/DataStore')
| -rw-r--r-- | Software/Visual_Studio/Tango.UnitTesting/DataStore/DataStore_TST.cs | 34 |
1 files changed, 32 insertions, 2 deletions
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<RemoteDataStoreGetResponse>(response, PMR.Integration.GenericMessageProtocol.Bson); + + RemoteDataStoreGetResponse des = GenericMessageSerializer.Deserialize<RemoteDataStoreGetResponse>(data, PMR.Integration.GenericMessageProtocol.Bson); + + CalculateRequest cc = des.ProtoObject.Message as CalculateRequest; + + Assert.AreEqual<CalculateRequest>(calc, cc); + } + private void Run_Test(IDataStoreManager manager) { IDataStoreCollection collection = manager.GetCollection("TEST"); @@ -72,7 +96,13 @@ namespace Tango.UnitTesting.DataStore Assert.AreEqual<byte>(value[0], 255); } - Assert.IsTrue(collection.Count() == 6); + { + collection.Put<CalculateRequest>("calc", new CalculateRequest() { A = 10, B = 15 }); + CalculateRequest value = collection.Get<CalculateRequest>("calc"); + Assert.AreEqual<CalculateRequest>(value, new CalculateRequest() { A = 10, B = 15 }); + } + + Assert.IsTrue(collection.Count() == 7); Assert.ThrowsException<NotSupportedException>(() => collection.Put<DataStore_TST>("somekey", this)); @@ -82,7 +112,7 @@ namespace Tango.UnitTesting.DataStore collection.Delete("float"); Assert.ThrowsException<KeyNotFoundException>(() => collection.Get<float>("float")); - Assert.IsTrue(collection.Count() == 4); + Assert.IsTrue(collection.Count() == 5); collection.DeleteAll(); Assert.IsTrue(collection.Count() == 0); |
