Beispiel #1
0
        /// <summary>
        ///     Gets my work fields.
        /// </summary>
        /// <param name="data">The data.</param>
        /// <returns></returns>
        public string GetMyWorkFields(string data)
        {
            try
            {
                var dataElement = new XElement("Data");

                List <string> fields;

                using (var myWorkReportData = new MyWorkReportData(Web.Site.ID))
                {
                    fields = myWorkReportData.GetFields();
                }

                foreach (string field in fields)
                {
                    dataElement.Add(new XElement("Field", new XAttribute("Name", field)));
                }

                return(new XElement("GetMyWorkFields", new XElement("Params"), dataElement).ToString());
            }
            catch (APIException)
            {
                throw;
            }
            catch (Exception exception)
            {
                throw new APIException((int)Errors.GetMyWorkFields, exception.GetBaseException().Message);
            }
        }
        public void GetFields_ReturnsDataTable()
        {
            // Act
            _testObj.GetFields();

            // Assert
            Assert.IsTrue(_adoShims.IsCommandCreated(GetFieldsSql));
            Assert.IsTrue(_adoShims.IsCommandExecuted(GetFieldsSql));
            Assert.IsTrue(_adoShims.IsDataReaderCreatedForCommand(GetFieldsSql));
            Assert.IsTrue(_adoShims.IsDataReaderDisposedForCommand(GetFieldsSql));
        }