2
require 'soap/rpc/driver'
10
class TestCalc2 < Test::Unit::TestCase
14
@server = CalcServer2.new('CalcServer', 'http://tempuri.org/calcService', '0.0.0.0', Port)
15
@server.level = Logger::Severity::ERROR
17
Thread.current.abort_on_exception = true
20
@endpoint = "http://localhost:#{Port}/"
21
@var = SOAP::RPC::Driver.new(@endpoint, 'http://tempuri.org/calcService')
22
@var.wiredump_dev = STDERR if $DEBUG
23
@var.add_method('set_value', 'newValue')
24
@var.add_method('get_value')
25
@var.add_method_as('+', 'add', 'rhs')
26
@var.add_method_as('-', 'sub', 'rhs')
27
@var.add_method_as('*', 'multi', 'rhs')
28
@var.add_method_as('/', 'div', 'rhs')
39
assert_equal(1, @var.set_value(1))
40
assert_equal(3, @var + 2)
41
assert_equal(-1.2, @var - 2.2)
42
assert_equal(2.2, @var * 2.2)
43
assert_equal(0, @var / 2)
44
assert_equal(0.5, @var / 2.0)
45
assert_raises(ZeroDivisionError) do