Esempio n. 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);
        }
Esempio n. 2
0
        public void AddMwi_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
            });
            var res = Mwi.AddMwi(_mockServer, "userObjectId", "Device Name", "SwitchId", "1234", true);

            Assert.IsFalse(res.Success, "Calling AddMwi with an error response should fail");
        }
Esempio n. 3
0
        public void AddMwi_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 = ""
            });
            var res = Mwi.AddMwi(_mockServer, "userObjectId", "Device Name", "SwitchId", "1234", true);

            Assert.IsFalse(res.Success, "Calling AddMwi with an empty response should fail");
        }
Esempio n. 4
0
        public void AddMwi_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"
            });
            var res = Mwi.AddMwi(_mockServer, "userObjectId", "Device Name", "SwitchId", "1234", true);

            Assert.IsFalse(res.Success, "Calling AddMwi with a garbage response should fail");
        }
Esempio n. 5
0
        public void AddMwi_InvalidObjectId_Failure()
        {
            var res = Mwi.AddMwi(_connectionServer, "ObjectId", "display name", "MediaSwitch", "1234", false);

            Assert.IsFalse(res.Success, "Static call to AddMwi did not fail with: invalid ObjectId");
        }
Esempio n. 6
0
        public void AddMwi_EmptyExtension_Failure()
        {
            var res = Mwi.AddMwi(_mockServer, "UserOBjectId", "Device Name", "SwitchObjectId", "", false);

            Assert.IsFalse(res.Success, "Calling AddMwi with empty extension should fail");
        }
Esempio n. 7
0
        public void AddMwi_EmptyUserObjectId_Failure()
        {
            var res = Mwi.AddMwi(_mockServer, "", "Device Name", "SwitchObjectId", "1234", false);

            Assert.IsFalse(res.Success, "Calling AddMwi with empty user objectId should fail");
        }
Esempio n. 8
0
        public void AddMwi_NullConnectionServer_Failure()
        {
            var res = Mwi.AddMwi(null, "UserOBjectId", "Device Name", "SwitchObjectId", "1234", false);

            Assert.IsFalse(res.Success, "Calling AddMwi with null connectionServer should fail");
        }