diff options
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); |
