public void Send_should_invoke_Send_of_networkclient() { var client = Substitute.For <INetworkClient>(); var msg = "Hello world"; var sut = new SomeService(client); sut.Send(msg); client.Received().Send(Arg.Any <byte[]>(), 0, msg.Length + 1); }
public void Send_is_not_allowed_while_disconnected() { var client = Substitute.For <INetworkClient>(); var msg = "Hello world"; var sut = new SomeService(client); client.Disconnected += Raise.Event(); Action actual = () => sut.Send(msg); actual.ShouldThrow <InvalidOperationException>(); }