public void Test() { //send invite var network = new FakeNetwork(); var cs1 = new FakeSipContextSource(TestConstants.IpEndPoint1); var cs2 = new FakeSipContextSource(TestConstants.IpEndPoint2); //var idleState = new IdleState(null); //var sendCommand = (IdleSendCommand) idleState.ProcessRequest(); //var contextSourceMock = new Mock<ISipContextSource>(); //contextSourceMock.Setup((cs)=> cs.SendTo(It.IsAny<byte[]>(), It.IsAny<IPEndPoint>())).Callback((byte[] bytes, IPEndPoint endPoint) => // { // var sipContext = ConvertToSipContext(bytes); // idleState.ProcessRequest(sipContext); // network.SendTo(); // }) //cs1.AddToNetwork(network); //cs2.AddToNetwork(network); //var sipProvider1 = new SipProvider(new SipStack(), cs1); ////var sipProvider2 = new SipProvider(new SipStack(), cs2); ////sendCommand.Response; //var sipProviderMock = new Mock<ISipProvider>(); //sipProviderMock.Setup((p) => p.ListeningPoint).Returns(new SipListeningPoint(TestConstants.IpEndPoint2)); ////sipProviderMock.Setup((p) => p.CreateServerDialog(It.IsAny<ISipServerTransaction>())).Returns(); //var commandFactoryMock = new Mock<ICommandFactory>(); //bool fired1,fired2,fired3; //SoftPhone calleePhone = new SoftPhone(sipProvider1, new SipMessageFactory(), new SipHeaderFactory(), new SipAddressFactory(), new CommandFactory()); //calleePhone.IncomingCall += CalleePhoneOnIncomingCall; //calleePhone.StateChanged += CalleePhoneOnStateChanged; //calleePhone.Start(); //IPhoneLine calleePhoneLine = calleePhone.CreatePhoneLine(new SipAccount()); //calleePhoneLine.Register(); //SoftPhone callerPhone = new SoftPhone(sipProvider2, new SipMessageFactory(), new SipHeaderFactory(), new SipAddressFactory(), new CommandFactory()); //callerPhone.StateChanged += CallerPhoneOnStateChanged; //callerPhone.Start(); //IPhoneCall phoneCall = callerPhone.CreateCall(); //phoneCall.Invite(TestConstants.IpEndPoint1.ToString()); //callerPhone.State.Should().BeOfType<RingingState>(); //calleePhone.State.Should().BeOfType<RingingState>(); //var softPhone = /*simulate receive invite.*/ /*verify ringingresponse sent*/ /*verify both caller + callee to ringingstate*/ }
protected override void Given() { _contextSource = new FakeSipContextSource(); _sipStack = new SipStack(); _provider = new SipProvider(_sipStack, _contextSource); _inviteRequest = CreateInviteRequest(); BeforeCreateInviteTransaction(); _inviteTransaction = _provider.CreateClientTransaction(_inviteRequest).As<SipInviteClientTransaction>(); _dialog = _provider.CreateClientDialog(_inviteTransaction); _inviteTransaction.SendRequest(); GivenOverride(); }
protected override void Given() { //create invite that is addresses to the phone's sipuri _invite = CreateInviteRequest(_testClientUaUri, _phoneUaUri); //create phone that is located at IpEndPoint2 var phoneCs = new FakeSipContextSource(_phoneUaEndPoint); _network = new FakeNetwork(); _sipProvider1 = new SipProvider(new SipStack(), phoneCs); _phone = new SoftPhone(_sipProvider1, new SipMessageFactory(), new SipHeaderFactory(), new SipAddressFactory(), _stateProvider, _timerFactory, new SipListeningPoint(_phoneUaEndPoint)); phoneCs.AddToNetwork(_network); _network.AddReceiver(_testClientUaEndPoint, OnTestClientUaReceive); _phone.InternalStateChanged += new EventHandler<EventArgs>(_calleePhone_InternalStateChanged); _phone.IncomingCall += new EventHandler<VoipEventArgs<IPhoneCall>>(_calleePhone_IncomingCall); _phone.Start(); GivenOverride(); }