//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test public void internalProtocolVersionsMustMatch() public virtual void InternalProtocolVersionsMustMatch() { MadeUpServer server = _builder.internalProtocolVersion(( sbyte )1).server(); MadeUpClient client = _builder.internalProtocolVersion(( sbyte )2).client(); AddToLifeAndStart(server, client); try { client.Multiply(10, 20); fail("Shouldn't be able to communicate with different application protocol versions"); } catch (IllegalProtocolVersionException) { } }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test public void applicationProtocolVersionsMustMatch() public virtual void ApplicationProtocolVersionsMustMatch() { MadeUpServer server = _builder.applicationProtocolVersion(( sbyte )(APPLICATION_PROTOCOL_VERSION + 1)).server(); MadeUpClient client = _builder.client(); AddToLifeAndStart(server, client); try { client.Multiply(10, 20); fail("Shouldn't be able to communicate with different application protocol versions"); } catch (IllegalProtocolVersionException) { } }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test public void clientGetResponseFromServerViaComLayer() throws Throwable //JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#: public virtual void ClientGetResponseFromServerViaComLayer() { MadeUpServerImplementation serverImplementation = new MadeUpServerImplementation(_storeIdToUse); MadeUpServer server = _builder.server(serverImplementation); MadeUpClient client = _builder.client(); AddToLifeAndStart(server, client); int value1 = 10; int value2 = 5; Response <int> response = client.Multiply(10, 5); WaitUntilResponseHasBeenWritten(server, 1000); assertEquals(( int? )(value1 * value2), response.ResponseConflict()); assertTrue(serverImplementation.GotCalled()); assertTrue(server.ResponseHasBeenWritten()); }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test public void throwingServerSideExceptionBackToClient() public virtual void ThrowingServerSideExceptionBackToClient() { MadeUpServer server = _builder.server(); MadeUpClient client = _builder.client(); AddToLifeAndStart(server, client); string exceptionMessage = "The message"; try { client.ThrowException(exceptionMessage); fail("Should have thrown " + typeof(MadeUpException).Name); } catch (MadeUpException e) { // Good assertEquals(exceptionMessage, e.Message); } }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test public void clientThrowsServerSideErrorMidwayThroughStreaming() public virtual void ClientThrowsServerSideErrorMidwayThroughStreaming() { const string failureMessage = "Just failing"; MadeUpServerImplementation serverImplementation = new MadeUpServerImplementationAnonymousInnerClass(this, _storeIdToUse, failureMessage); MadeUpServer server = _builder.server(serverImplementation); MadeUpClient client = _builder.client(); AddToLifeAndStart(server, client); try { client.FetchDataStream(new ToAssertionWriter(), FRAME_LENGTH * 2); fail("Should have thrown " + typeof(MadeUpException).Name); } catch (MadeUpException e) { assertEquals(failureMessage, e.Message); } }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test public void impossibleToHaveBiggerChunkSizeThanFrameSize() throws Throwable //JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#: public virtual void ImpossibleToHaveBiggerChunkSizeThanFrameSize() { Builder myBuilder = _builder.chunkSize(MadeUpServer.FRAME_LENGTH + 10); try { MadeUpServer server = myBuilder.Server(); server.Init(); server.Start(); fail("Shouldn't be possible"); } catch (System.ArgumentException) { // Good } try { myBuilder.Client(); fail("Shouldn't be possible"); } catch (System.ArgumentException) { // Good } }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test public void serverContextVerificationCanThrowException() public virtual void ServerContextVerificationCanThrowException() { const string failureMessage = "I'm failing"; TxChecksumVerifier failingVerifier = (txId, checksum) => { throw new FailingException(failureMessage); }; MadeUpServer server = _builder.verifier(failingVerifier).server(); MadeUpClient client = _builder.client(); AddToLifeAndStart(server, client); try { client.Multiply(10, 5); fail("Should have failed"); } catch (Exception) { // Good // TODO catch FailingException instead of Exception and make Server throw the proper // one instead of getting a "channel closed". } }