public void GetDomainAPIConsole()
        {
            string expected = File.ReadAllText(Path.Combine(_requestsTestDataPath, "GetDomainAPIConsole.xml"));
            var    request  = new GetDomainAPIConsole
            {
                SessionId = "sid",
                DomainStr = "testing.co.uk",
                Filter    = new TPropertyListFilter
                {
                    Mask   = "admin",
                    Groups = new TPropertyStringList {
                        Val = new List <string> {
                            "Domain"
                        }
                    },
                    Clear = false
                },
                Comments = false
            };
            var xml = request.ToXml().InnerXmlFormatted();

            Assert.AreEqual(expected, xml);

            XmlDocument doc = new XmlDocument();

            doc.LoadXml(File.ReadAllText(Path.Combine(_responsesTestDataPath, "GetDomainAPIConsole.xml")));
            var response = request.FromHttpRequestResult(new HttpRequestResult {
                Response = doc.InnerXml
            });

            Assert.AreEqual("result", response.Type);
            Assert.AreEqual(0, response.Offset);
            Assert.AreEqual(88, response.OverallCount);
            Assert.AreEqual(88, response.Items.Count);
        }
        public void GetDomainAPIConsole_NoFilter()
        {
            string expected = File.ReadAllText(Path.Combine(_requestsTestDataPath, "GetDomainAPIConsole_NoFilter.xml"));
            var    request  = new GetDomainAPIConsole
            {
                SessionId = "sid",
                DomainStr = "testing.co.uk",
                Comments  = false
            };
            var xml = request.ToXml().InnerXmlFormatted();

            Assert.AreEqual(expected, xml);

            XmlDocument doc = new XmlDocument();

            doc.LoadXml(File.ReadAllText(Path.Combine(_responsesTestDataPath, "GetDomainAPIConsole_TPropertyVals.xml")));
            var response = request.FromHttpRequestResult(new HttpRequestResult {
                Response = doc.InnerXml
            });

            Assert.AreEqual("result", response.Type);
            Assert.AreEqual(0, response.Offset);
            Assert.AreEqual(3, response.OverallCount);
            Assert.AreEqual(3, response.Items.Count);

            Assert.AreEqual("d_adminemail", response.Items.First().APIProperty.PropName);
            Assert.AreEqual(typeof(TPropertyString), response.Items.First().PropertyVal.GetType());
            Assert.AreEqual("*****@*****.**", ((TPropertyString)response.Items.First().PropertyVal).Val);
            Assert.AreEqual(TPermission.ReadWrite, response.Items.First().PropertyRight);
            Assert.AreEqual(0, response.Items.First().PropertyEnumValues.Items.Count);
            Assert.AreEqual("Domain", response.Items.First().PropertyGroup);
            Assert.AreEqual(TPropertyValueType.String, response.Items.First().PropertyValueType);

            Assert.AreEqual("d_directorycache_refreshnow", response.Items.ElementAt(1).APIProperty.PropName);
            Assert.AreEqual(typeof(TPropertyNoValue), response.Items.ElementAt(1).PropertyVal.GetType());
            Assert.AreEqual(TPermission.ReadWrite, response.Items.ElementAt(1).PropertyRight);
            Assert.AreEqual(0, response.Items.ElementAt(1).PropertyEnumValues.Items.Count);
            Assert.AreEqual("Domain", response.Items.ElementAt(1).PropertyGroup);
            Assert.AreEqual(TPropertyValueType.Bool, response.Items.ElementAt(1).PropertyValueType);

            Assert.AreEqual("d_unknownuserstype", response.Items.Last().APIProperty.PropName);
            Assert.AreEqual(typeof(TPropertyString), response.Items.Last().PropertyVal.GetType());
            Assert.AreEqual("0", ((TPropertyString)response.Items.Last().PropertyVal).Val);
            Assert.AreEqual(TPermission.ReadWrite, response.Items.Last().PropertyRight);
            Assert.NotNull(response.Items.Last().PropertyEnumValues);
            Assert.AreEqual(3, response.Items.Last().PropertyEnumValues.Items.Count);
            Assert.AreEqual("Domain", response.Items.Last().PropertyGroup);
            Assert.AreEqual(TPropertyValueType.Enum, response.Items.Last().PropertyValueType);
        }