Ejemplo n.º 1
0
        public void Delete_InvalidHomeServer_Failure()
        {
            var oTemp = new Mwi(_mockServer, "ObjectId");
            var res   = oTemp.Delete();

            Assert.IsFalse(res.Success, "Delete should fail with invalid HomeServer property updates");
        }
Ejemplo n.º 2
0
        public void GetMwiDevice_NullConnectionServer_Failure()
        {
            Mwi oMwi;
            var res = Mwi.GetMwiDevice(null, "UserObjectId", "ObjectId", out oMwi);

            Assert.IsFalse(res.Success, "Calling GetMwiDevice with null connection server should fail");
        }
Ejemplo n.º 3
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");
        }
Ejemplo n.º 4
0
        public void GetMwiDevice_EmptyObjectId_Failure()
        {
            Mwi oMwi;
            var res = Mwi.GetMwiDevice(_mockServer, "UserObjectId", "", out oMwi);

            Assert.IsFalse(res.Success, "Calling GetMwiDevice with empty objectId should fail");
        }
Ejemplo n.º 5
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);
        }
Ejemplo n.º 6
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");
        }
Ejemplo n.º 7
0
        public void GetMwiDevice_InvalidOBjectId_Failure()
        {
            Mwi oMwiDevice;
            var res = Mwi.GetMwiDevice(_connectionServer, "UserObjectId", "ObjectId", out oMwiDevice);

            Assert.IsFalse(res.Success, "Static call to GetMwiDevice did not fail with: invalid ObjectId");
        }
Ejemplo n.º 8
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");
        }
Ejemplo n.º 9
0
        public void Update_InvalidHomeServer_Failure()
        {
            var oTemp = new Mwi(_mockServer, "ObjectId");

            oTemp.UsePrimaryExtension = false;
            var res = oTemp.Update();

            Assert.IsFalse(res.Success, "Update should fail with invalid HomeServer property updates");
        }
Ejemplo n.º 10
0
        public void Update_NoPendingChanges_Failure()
        {
            var oTemp = new Mwi(_mockServer, "ObjectId");

            oTemp.ClearPendingChanges();
            var res = oTemp.Update();

            Assert.IsFalse(res.Success, "Update should fail with no pending updates");
        }
Ejemplo n.º 11
0
        public void Constructor_NonEmptyOBjectId_Success()
        {
            var oTemp = new Mwi(_mockServer, "ObjectId");

            Console.WriteLine(oTemp.ToString());
            Console.WriteLine(oTemp.DumpAllProps());
            Console.WriteLine(oTemp.SelectionDisplayString);
            Console.WriteLine(oTemp.UniqueIdentifier);
        }
Ejemplo n.º 12
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);
        }
Ejemplo n.º 13
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");
        }
Ejemplo n.º 14
0
        public void DeleteMwiDevice_ErrorResponse_Failure()
        {
            //error response
            _mockTransport.Setup(x => x.GetCupiResponse(It.IsAny <string>(), It.IsAny <MethodType>(), It.IsAny <ConnectionServerRest>(),
                                                        It.IsAny <string>(), true)).Returns(new WebCallResult
            {
                Success      = false,
                ResponseText = "error text",
                StatusCode   = 404
            });
            var res = Mwi.DeleteMwiDevice(_mockServer, "userObjectId", "Device Name");

            Assert.IsFalse(res.Success, "Calling DeleteMwiDevice with an error response should fail");
        }
Ejemplo n.º 15
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");
        }
Ejemplo n.º 16
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");
        }
Ejemplo n.º 17
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");
        }
Ejemplo n.º 18
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");
        }
Ejemplo n.º 19
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");
        }
Ejemplo n.º 20
0
        public void DeleteMwiDevice_InvalidObjectId_Failure()
        {
            var res = Mwi.DeleteMwiDevice(_connectionServer, "UserObjectId", "ObjectId");

            Assert.IsFalse(res.Success, "Static call to DeleteMwiDevice did not fail with: invalid ObjectId");
        }
Ejemplo n.º 21
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");
        }
Ejemplo n.º 22
0
        public void DeleteMwiDevice_NullConnectionServer_Failure()
        {
            var res = Mwi.DeleteMwiDevice(null, "UserOBjectId", "ObjectId");

            Assert.IsFalse(res.Success, "Calling DeleteMwiDevice with null connection server should fail");
        }
Ejemplo n.º 23
0
        public void DeleteMwiDevice_EmptyObjectId_Failure()
        {
            var res = Mwi.DeleteMwiDevice(_mockServer, "UserOBjectId", "");

            Assert.IsFalse(res.Success, "Calling DeleteMwiDevice with empty objectId should fail");
        }
Ejemplo n.º 24
0
        public void UpdateMwi_NullConnectionServer_Failure()
        {
            var res = Mwi.UpdateMwi(null, "UserOBjectId", "ObjectId", new ConnectionPropertyList());

            Assert.IsFalse(res.Success, "Calling UpdateMwi with null ConnectionServer should fail");
        }
Ejemplo n.º 25
0
        public void Constructor_EmptyUserObjectId_Failure()
        {
            var oTemp = new Mwi(_mockServer, "");

            Console.WriteLine(oTemp);
        }
Ejemplo n.º 26
0
        public void UpdateMwi_EmptyPropertyList_Failure()
        {
            var res = Mwi.UpdateMwi(_mockServer, "UserOBjectId", "ObjectId", new ConnectionPropertyList());

            Assert.IsFalse(res.Success, "Calling UpdateMwi with empty property list should fail");
        }
Ejemplo n.º 27
0
        public void Constuctor_NullConnectionServer_Failure()
        {
            var oTemp = new Mwi(null, "UserObjectid", "objectid");

            Console.WriteLine(oTemp);
        }
Ejemplo n.º 28
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");
        }
Ejemplo n.º 29
0
        public void Mwi_Constructor_InvalidObjectIds_Failure()
        {
            Mwi oTemp = new Mwi(_connectionServer, "UserObjectId", "MwiObjectId");

            Console.WriteLine(oTemp);
        }
Ejemplo n.º 30
0
        public void UpdateMwi_NullPropertyList_Failure()
        {
            var res = Mwi.UpdateMwi(_mockServer, "UserOBjectId", "ObjectId", null);

            Assert.IsFalse(res.Success, "Calling UpdateMwi with null property list should fail");
        }