public void TestLookupInstance() { // Initialize entities DataWriter writer = _publisher.CreateDataWriter(_topic); Assert.IsNotNull(writer); TestStructDataWriter dataWriter = new TestStructDataWriter(writer); // Lookup for a non-existing instance InstanceHandle handle = dataWriter.LookupInstance(new TestStruct { Id = 1 }); Assert.AreEqual(InstanceHandle.HandleNil, handle); // Register an instance InstanceHandle handle1 = dataWriter.RegisterInstance(new TestStruct { Id = 1 }); Assert.AreNotEqual(InstanceHandle.HandleNil, handle1); // Lookup for an existing instance handle = dataWriter.LookupInstance(new TestStruct { Id = 1 }); Assert.AreNotEqual(InstanceHandle.HandleNil, handle); Assert.AreEqual(handle1, handle); }