예제 #1
0
        public void UpdateCallSid_AnyCallId_CallNull_isCallerFalse()
        {
            // Setup dependence
            var settingMock = new Mock<ISettings>();
            var componentMock = new Mock<IComponents>();
            var uowMock = new Mock<IUnitOfWork>();
            var repositoryMock = new Mock<IRepository>();
            var serviceLocatorMock = new Mock<IServiceLocator>();

            serviceLocatorMock.Setup(r => r.GetInstance<IRepository>())
                .Returns(repositoryMock.Object);
            ServiceLocator.SetLocatorProvider(() => serviceLocatorMock.Object);

            // Arrange data
            Guid callId = Guid.NewGuid();
            string receiverSid = "12345";
            bool isCaller = false;

            // Act
            CallService callService = new CallService(uowMock.Object, repositoryMock.Object, settingMock.Object, componentMock.Object);
            CallDto currentCall = callService
                .UpdateCallSid(callId, receiverSid, isCaller);

            // Assert
            repositoryMock.Verify(r => r.FindById<Call>(callId));
            Assert.AreEqual(currentCall, null);
        }