public void TestHostedObject() { var disposeFile = Path.GetTempFileName(); var disposeText = $"Worker Dispose Test {DateTime.UtcNow}"; using (IRemoteClass proxyClass = new ProxyClass()) { var result = proxyClass.Get(); Assert.AreEqual(1000, result); proxyClass.Set(5000); var result2 = proxyClass.Get(); Assert.AreEqual(5000, result2); var enumValue = ObjectEnum.Two; proxyClass.SetObjectEnum(enumValue); var enumResult = proxyClass.GetObjectEnum(); Assert.AreEqual(enumValue, enumResult); proxyClass.SetDisposeText(disposeFile, disposeText); } var disposeResult = File.ReadAllText(disposeFile); Assert.AreEqual(disposeText, disposeResult); }
public void TestHostedObject() { var disposeFile = Path.GetTempFileName(); var disposeText = $"Worker Dispose Test {DateTime.UtcNow}"; using (IRemoteClass proxyClass = new ProxyClass()) { var result = proxyClass.Get(); Assert.AreEqual(1000, result); proxyClass.Set(5000); var result2 = proxyClass.Get(); Assert.AreEqual(5000, result2); var enumValue = ObjectEnum.Two; proxyClass.SetObjectEnum(enumValue); var enumResult = proxyClass.GetObjectEnum(); Assert.AreEqual(enumValue, enumResult); proxyClass.SetDisposeText(disposeFile, disposeText); var returnedEnumString = proxyClass.TransportEnumValue <TransportGenericEnum>(TransportGenericEnum.One); // https://stackoverflow.com/questions/6703180/generic-method-enum-to-string-conversion var stringifiedEnumValue = Enum.GetName(typeof(TransportGenericEnum), TransportGenericEnum.One); Assert.AreEqual(stringifiedEnumValue, returnedEnumString); } var disposeResult = File.ReadAllText(disposeFile); Assert.AreEqual(disposeText, disposeResult); }