Пример #1
0
        public void AddEditDeleteMwi_Success()
        {
            var res = Mwi.AddMwi(_connectionServer, _tempUser.ObjectId, "display name", _tempUser.MediaSwitchObjectId,
                                 "1234321", false);

            Assert.IsTrue(res.Success, "Failed to create MWI device for user:"******"Failed to fetch single MWI device just added for user:"******"Calling update on MWi device with no pending changes did not fail");

            oMwiDevice.DisplayName = "Updated Display Name";
            oMwiDevice.Active      = false;

            res = oMwiDevice.Update();
            Assert.IsTrue(res.Success, "Updating MWI properties failed:" + res);

            Thread.Sleep(2000);

            List <Mwi> oMwis;

            res = Mwi.GetMwiDevices(_connectionServer, _tempUser.ObjectId, out oMwis);
            Assert.IsTrue(res.Success, "Failed to fetch MWI device for user:"******"Mwi count is not at least 2 after adding device, instead its" + oMwis.Count);

            res = Mwi.DeleteMwiDevice(_connectionServer, _tempUser.ObjectId, oMwiDevice.ObjectId);
            Assert.IsTrue(res.Success, "Failed to delete MWI device for user:" + res);
        }
Пример #2
0
        public void GetMwiDevices_InvalidOBjectId_Failure()
        {
            List <Mwi> oMwis;
            var        res = Mwi.GetMwiDevices(_connectionServer, "ObjectId", out oMwis);

            Assert.IsFalse(res.Success, "Static call to GetMwiDevices did not fail with: invalid ObjectId");
        }
Пример #3
0
        public void GetMwiDevices_EmptyUserObjectId_Failure()
        {
            List <Mwi> oMwis;
            var        res = Mwi.GetMwiDevices(_mockServer, "", out oMwis);

            Assert.IsFalse(res.Success, "Calling GetMwiDevices with empty UserObjectId should fail");
        }
Пример #4
0
        public void GetMwiDevices_NullConnectionServer_Failure()
        {
            List <Mwi> oMwis;
            var        res = Mwi.GetMwiDevices(null, "UserObjectId", out oMwis);

            Assert.IsFalse(res.Success, "Calling GetMwiDevices with null connection server should fail");
        }
Пример #5
0
        public void Mwi_Test()
        {
            _errorString = "";
            List <Mwi> oMwis;
            var        res = Mwi.GetMwiDevices(_connectionServer, _tempUser.ObjectId, out oMwis);

            Assert.IsTrue(res.Success & oMwis.Count > 0, "Failed to fetch mwis:" + res);
            Assert.IsTrue(string.IsNullOrEmpty(_errorString), "Error parsing Json for mwis:" + _errorString);
        }
Пример #6
0
        public void GetMwiDevices_EmptyResponse_Failure()
        {
            //empty results
            _mockTransport.Setup(
                x => x.GetCupiResponse(It.IsAny <string>(), It.IsAny <MethodType>(), It.IsAny <ConnectionServerRest>(),
                                       It.IsAny <string>(), true)).Returns(new WebCallResult
            {
                Success      = true,
                ResponseText = ""
            });
            List <Mwi> oMwis;
            var        res = Mwi.GetMwiDevices(_mockServer, "userObjectId", out oMwis);

            Assert.IsFalse(res.Success, "Calling GetMwiDevices with an empty response should fail");
        }
Пример #7
0
        public void GetMwiDevices_GarbageResponse_Failure()
        {
            //garbage response
            _mockTransport.Setup(x => x.GetCupiResponse(It.IsAny <string>(), MethodType.GET, It.IsAny <ConnectionServerRest>(),
                                                        It.IsAny <string>(), true)).Returns(new WebCallResult
            {
                Success          = true,
                TotalObjectCount = 1,
                ResponseText     = "garbage result in the response body that will not parse properly to mwi device"
            });
            List <Mwi> oMwis;
            var        res = Mwi.GetMwiDevices(_mockServer, "userObjectId", out oMwis);

            Assert.IsFalse(res.Success, "Calling GetMwiDevices with a garbage response should fail");
        }
Пример #8
0
        public void GetMwiDevices_ErrorResponse_Failure()
        {
            //error response
            _mockTransport.Setup(x => x.GetCupiResponse(It.IsAny <string>(), MethodType.GET, It.IsAny <ConnectionServerRest>(),
                                                        It.IsAny <string>(), true)).Returns(new WebCallResult
            {
                Success      = false,
                ResponseText = "error text",
                StatusCode   = 404
            });
            List <Mwi> oMwis;
            var        res = Mwi.GetMwiDevices(_mockServer, "userObjectId", out oMwis);

            Assert.IsFalse(res.Success, "Calling GetMwiDevices with an error response should fail");
        }
Пример #9
0
        public void GetMwiDevices_ZeroResult_Success()
        {
            //zero results
            _mockTransport.Setup(
                x => x.GetCupiResponse(It.IsAny <string>(), It.IsAny <MethodType>(), It.IsAny <ConnectionServerRest>(),
                                       It.IsAny <string>(), true)).Returns(new WebCallResult
            {
                Success          = true,
                TotalObjectCount = 0,
                ResponseText     = "junk"
            });
            List <Mwi> oMwis;
            var        res = Mwi.GetMwiDevices(_mockServer, "userObjectId", out oMwis);

            Assert.IsFalse(res.Success, "Calling GetMwiDevices with zero result failed:" + res);
            Assert.IsTrue(oMwis.Count == 0, "Calling GetMwiDevices with zero result should produce an empty list");
        }