[mapguide-commits] r7656 - in trunk/MgDev/UnitTest/WebTier/DotNet: MgTestRunner TestCommon TestCommon/ResourceService TestMapGuideApi TestMapGuideApi/ServerAdmin TestMapGuideApi/SiteService TestMapGuideApi/WebLayout

svn_mapguide at osgeo.org svn_mapguide at osgeo.org
Wed Jul 3 07:59:19 PDT 2013


Author: jng
Date: 2013-07-03 07:59:19 -0700 (Wed, 03 Jul 2013)
New Revision: 7656

Added:
   trunk/MgDev/UnitTest/WebTier/DotNet/TestMapGuideApi/ServerAdmin/Operations.cs
   trunk/MgDev/UnitTest/WebTier/DotNet/TestMapGuideApi/SiteService/Operations.cs
   trunk/MgDev/UnitTest/WebTier/DotNet/TestMapGuideApi/WebLayout/Operations.cs
Modified:
   trunk/MgDev/UnitTest/WebTier/DotNet/MgTestRunner/
   trunk/MgDev/UnitTest/WebTier/DotNet/MgTestRunner/Program.cs
   trunk/MgDev/UnitTest/WebTier/DotNet/TestCommon/
   trunk/MgDev/UnitTest/WebTier/DotNet/TestCommon/CommonUtility.cs
   trunk/MgDev/UnitTest/WebTier/DotNet/TestCommon/ResourceService/Operations.cs
   trunk/MgDev/UnitTest/WebTier/DotNet/TestCommon/TestResult.cs
   trunk/MgDev/UnitTest/WebTier/DotNet/TestMapGuideApi/
   trunk/MgDev/UnitTest/WebTier/DotNet/TestMapGuideApi/MapGuideTestExecutorCollection.cs
   trunk/MgDev/UnitTest/WebTier/DotNet/TestMapGuideApi/TestMapGuideApi.csproj
   trunk/MgDev/UnitTest/WebTier/DotNet/TestMapGuideApi/WebLayout/WebLayoutOperationExecutor.cs
Log:
#2307: This submission adds in tests for the Server Admin, Site Service and Web Layout, bringing test suite parity with the PHP runner. Failure count is currently at 14 with 34 tests not being executed. The majority of the failures are due to:

 1. Unresolved issues with XML content preparation for comparison
 2. Unresolved issues with preparation of binary data for result comparison


Property changes on: trunk/MgDev/UnitTest/WebTier/DotNet/MgTestRunner
___________________________________________________________________
Added: svn:ignore
   + obj


Modified: trunk/MgDev/UnitTest/WebTier/DotNet/MgTestRunner/Program.cs
===================================================================
--- trunk/MgDev/UnitTest/WebTier/DotNet/MgTestRunner/Program.cs	2013-07-02 15:49:52 UTC (rev 7655)
+++ trunk/MgDev/UnitTest/WebTier/DotNet/MgTestRunner/Program.cs	2013-07-03 14:59:19 UTC (rev 7656)
@@ -45,9 +45,9 @@
                     failures += ExecuteTest(ApiTypes.Platform, "../../TestData/MapLayer/MapLayerTest.dump", ref testsRun, logger, isEnterprise);
                     failures += ExecuteTest(ApiTypes.Platform, "../../TestData/DrawingService/DrawingServiceTest.dump", ref testsRun, logger, isEnterprise);
                     failures += ExecuteTest(ApiTypes.Platform, "../../TestData/MappingService/MappingServiceTest.dump", ref testsRun, logger, isEnterprise);
-                    //failures += ExecuteTest(ApiTypes.Platform, "../../TestData/SiteService/SiteServiceTest.dump", ref testsRun, logger, isEnterprise);
-                    //failures += ExecuteTest(ApiTypes.Platform, "../../TestData/ServerAdmin/ServerAdminTest.dump", ref testsRun, logger, isEnterprise);
-                    //failures += ExecuteTest(ApiTypes.Platform, "../../TestData/WebLayout/WebLayoutTest.dump", ref testsRun, logger, isEnterprise);
+                    failures += ExecuteTest(ApiTypes.Platform, "../../TestData/SiteService/SiteServiceTest.dump", ref testsRun, logger, isEnterprise);
+                    failures += ExecuteTest(ApiTypes.Platform, "../../TestData/ServerAdmin/ServerAdminTest.dump", ref testsRun, logger, isEnterprise);
+                    failures += ExecuteTest(ApiTypes.Platform, "../../TestData/WebLayout/WebLayoutTest.dump", ref testsRun, logger, isEnterprise);
                     failures += ExecuteTest(ApiTypes.Platform, "../../TestData/Unicode/UnicodeTest.dump", ref testsRun, logger, isEnterprise);
                     logger.Write("\n\nTests failed/run: {0}/{1}\n", failures, testsRun);
                     Console.Write("\n\nTests failed/run: {0}/{1}\n", failures, testsRun);
@@ -71,6 +71,7 @@
             int ret = 0;
             if (exec != null)
             {
+                //"validate" is currently the only test execution mode supported
                 exec.Initialize("validate", dumpFile);
                 ret += exec.Execute(ref testsRun, logger, isEnterprise);
             }


Property changes on: trunk/MgDev/UnitTest/WebTier/DotNet/TestCommon
___________________________________________________________________
Added: svn:ignore
   + bin
obj


Modified: trunk/MgDev/UnitTest/WebTier/DotNet/TestCommon/CommonUtility.cs
===================================================================
--- trunk/MgDev/UnitTest/WebTier/DotNet/TestCommon/CommonUtility.cs	2013-07-02 15:49:52 UTC (rev 7655)
+++ trunk/MgDev/UnitTest/WebTier/DotNet/TestCommon/CommonUtility.cs	2013-07-03 14:59:19 UTC (rev 7656)
@@ -186,12 +186,24 @@
         {
             try
             {
+                //Sigh, we're too smart for our own good. Yes, the trailing comma
+                //should be there!
+                StringBuilder sb = new StringBuilder();
+                for (int i = 0; i < coll.GetCount(); i++)
+                {
+                    sb.Append(coll.GetItem(i));
+                    sb.Append(",");
+                }
+                return sb.ToString();
+
+                /*
                 List<string> items = new List<string>();
                 for (int i = 0; i < coll.GetCount(); i++)
                 {
                     items.Add(coll.GetItem(i));
                 }
                 return string.Join(",", items.ToArray());
+                 */
             }
             catch (MgException ex)
             {
@@ -317,27 +329,59 @@
             return res;
         }
 
+        class InvertedComparer<T> : IComparer<T>
+        {
+            private IComparer<T> _comp;
+
+            public InvertedComparer(IComparer<T> comp) { _comp = comp; }
+
+            public int Compare(T x, T y)
+            {
+                int res = _comp.Compare(x, y);
+                //Invert the non-zero results
+                if (res > 0)
+                    return -1;
+                else if (res < 0)
+                    return 1;
+                else
+                    return 0;
+            }
+        }
+
         private static string SortElement(XmlNode elem, string preText)
         {
             var elemArray = new List<string>();
             string elemString = "";
             if (elem.ChildNodes.Count > 0)
             {
-                foreach (XmlNode child in elem.ChildNodes)
+                int elCount = 0;
+                int txtCount = 0;
+                //foreach (XmlNode child in elem.ChildNodes)
+                for (int i = 0; i < elem.ChildNodes.Count; i++)
                 {
+                    var child = elem.ChildNodes[i];
                     if (child.NodeType == XmlNodeType.Element)
                     {
                         var elemValue = SortElement(child, preText + "  ");
                         if (!string.IsNullOrEmpty(elemValue))
+                        {
                             elemArray.Add(elemValue);
+                            elCount++;
+                        }
                     }
                     else if (child.NodeType == XmlNodeType.Text)
                     {
                         string content = child.InnerText.Trim();
                         if (!string.IsNullOrEmpty(content))
+                        {
                             elemArray.Add(content);
+                            txtCount++;
+                        }
                     }
                 }
+
+                //FIXME: Okay, PHP sort() does things differently than what
+                //we're expecting here (not surprising!)
                 elemArray.Sort();
                 foreach (string str in elemArray)
                 {

Modified: trunk/MgDev/UnitTest/WebTier/DotNet/TestCommon/ResourceService/Operations.cs
===================================================================
--- trunk/MgDev/UnitTest/WebTier/DotNet/TestCommon/ResourceService/Operations.cs	2013-07-02 15:49:52 UTC (rev 7655)
+++ trunk/MgDev/UnitTest/WebTier/DotNet/TestCommon/ResourceService/Operations.cs	2013-07-03 14:59:19 UTC (rev 7656)
@@ -262,7 +262,6 @@
             }
             catch (MgException ex)
             {
-                Console.WriteLine(ex.GetDetails());
                 return TestResult.FromMgException(ex);
             }
             catch (Exception ex)

Modified: trunk/MgDev/UnitTest/WebTier/DotNet/TestCommon/TestResult.cs
===================================================================
--- trunk/MgDev/UnitTest/WebTier/DotNet/TestCommon/TestResult.cs	2013-07-02 15:49:52 UTC (rev 7655)
+++ trunk/MgDev/UnitTest/WebTier/DotNet/TestCommon/TestResult.cs	2013-07-03 14:59:19 UTC (rev 7656)
@@ -44,7 +44,20 @@
                 if (byteReader != null)
                 {
                     res.ContentType = byteReader.GetMimeType();
-                    res.ResultData = byteReader.ToString();
+                    if (res.ContentType == MgMimeType.Html ||
+                        res.ContentType == MgMimeType.Json ||
+                        res.ContentType == MgMimeType.Kml ||
+                        res.ContentType == MgMimeType.Text ||
+                        res.ContentType == MgMimeType.Xml)
+                    {
+                        res.ResultData = byteReader.ToString();
+                    }
+                    else
+                    {
+                        byte[] bytes = new byte[byteReader.GetLength()];
+                        byteReader.Read(bytes, bytes.Length);
+                        res.ResultData = Encoding.UTF8.GetString(bytes);
+                    }
                 }
                 return res;
             }


Property changes on: trunk/MgDev/UnitTest/WebTier/DotNet/TestMapGuideApi
___________________________________________________________________
Added: svn:ignore
   + bin
obj


Modified: trunk/MgDev/UnitTest/WebTier/DotNet/TestMapGuideApi/MapGuideTestExecutorCollection.cs
===================================================================
--- trunk/MgDev/UnitTest/WebTier/DotNet/TestMapGuideApi/MapGuideTestExecutorCollection.cs	2013-07-02 15:49:52 UTC (rev 7655)
+++ trunk/MgDev/UnitTest/WebTier/DotNet/TestMapGuideApi/MapGuideTestExecutorCollection.cs	2013-07-03 14:59:19 UTC (rev 7656)
@@ -9,6 +9,7 @@
 using System.Text;
 using System.Threading.Tasks;
 using System.Xml;
+using System.Xml.Linq;
 
 namespace OSGeo.MapGuide.Test.Web
 {
@@ -36,9 +37,14 @@
             MgFeatureService featSvc = (MgFeatureService)_conn.CreateService(MgServiceType.FeatureService);
             MgDrawingService drawSvc = (MgDrawingService)_conn.CreateService(MgServiceType.DrawingService);
 
+            var site = _conn.GetSite();
+            var admin = new MgServerAdmin();
+            admin.Open(_userInfo);
+            var wlCreator = new MgWebLayoutCreator(resSvc);
             var creator = new MgMapCreator(resSvc);
             var sessionCreator = new MgSessionCreator(_conn);
             var sessionApply = new MgApplySession(_userInfo);
+            var session = new MgSession();
 
             //Resource Service
             _executors[typeof(Operations.ApplyResourcePackage).Name.ToUpper()] = new Operations.ApplyResourcePackage(resSvc, dbPath);
@@ -114,12 +120,92 @@
             //Rendering Service
 
             //Server Admin
+            _executors[typeof(Operations.Offline).Name.ToUpper()] = new Operations.Offline(admin, dbPath);
+            _executors[typeof(Operations.Online).Name.ToUpper()] = new Operations.Online(admin, dbPath);
+            _executors[typeof(Operations.GetLog).Name.ToUpper()] = new Operations.GetLog(admin, dbPath);
+            _executors[typeof(Operations.GetLogByDate).Name.ToUpper()] = new Operations.GetLogByDate(admin, dbPath);
+            _executors[typeof(Operations.ClearLog).Name.ToUpper()] = new Operations.ClearLog(admin, dbPath);
+            _executors[typeof(Operations.DeleteLog).Name.ToUpper()] = new Operations.DeleteLog(admin, dbPath);
+            _executors[typeof(Operations.RenameLog).Name.ToUpper()] = new Operations.RenameLog(admin, dbPath);
+            _executors[typeof(Operations.EnumeratePackages).Name.ToUpper()] = new Operations.EnumeratePackages(admin, dbPath);
+            _executors[typeof(Operations.DeletePackage).Name.ToUpper()] = new Operations.DeletePackage(admin, dbPath);
+            _executors[typeof(Operations.LoadPackage).Name.ToUpper()] = new Operations.LoadPackage(admin, dbPath);
+            _executors[typeof(Operations.GetPackageStatus).Name.ToUpper()] = new Operations.GetPackageStatus(admin, dbPath);
+            _executors[typeof(Operations.GetPackageLog).Name.ToUpper()] = new Operations.GetPackageLog(admin, dbPath);
 
             //Site Service
+            _executors[typeof(Operations.CreateSession).Name.ToUpper()] = new Operations.CreateSession(site, dbPath, session);
+            _executors[typeof(Operations.DestroySession).Name.ToUpper()] = new Operations.DestroySession(site, dbPath);
+            _executors[typeof(Operations.GetUserForSession).Name.ToUpper()] = new Operations.GetUserForSession(site, dbPath, session);
+            _executors[typeof(Operations.EnumerateUsers).Name.ToUpper()] = new Operations.EnumerateUsers(site, dbPath);
+            _executors[typeof(Operations.AddUser).Name.ToUpper()] = new Operations.AddUser(site, dbPath);
+            _executors[typeof(Operations.UpdateUser).Name.ToUpper()] = new Operations.UpdateUser(site, dbPath);
+            _executors[typeof(Operations.DeleteUsers).Name.ToUpper()] = new Operations.DeleteUsers(site, dbPath);
+            _executors[typeof(Operations.GrantRoleMembershipsToUsers).Name.ToUpper()] = new Operations.GrantRoleMembershipsToUsers(site, dbPath);
+            _executors[typeof(Operations.RevokeRoleMembershipsFromUsers).Name.ToUpper()] = new Operations.RevokeRoleMembershipsFromUsers(site, dbPath);
+            _executors[typeof(Operations.GrantGroupMembershipsToUsers).Name.ToUpper()] = new Operations.GrantGroupMembershipsToUsers(site, dbPath);
+            _executors[typeof(Operations.RevokeGroupMembershipsFromUsers).Name.ToUpper()] = new Operations.RevokeGroupMembershipsFromUsers(site, dbPath);
+            _executors[typeof(Operations.EnumerateGroups).Name.ToUpper()] = new Operations.EnumerateGroups(site, dbPath);
+            _executors[typeof(Operations.EnumerateGroups2).Name.ToUpper()] = new Operations.EnumerateGroups2(site, dbPath);
+            _executors[typeof(Operations.EnumerateRoles2).Name.ToUpper()] = new Operations.EnumerateRoles2(site, dbPath);
+            _executors[typeof(Operations.AddGroup).Name.ToUpper()] = new Operations.AddGroup(site, dbPath);
+            _executors[typeof(Operations.UpdateGroup).Name.ToUpper()] = new Operations.UpdateGroup(site, dbPath);
+            _executors[typeof(Operations.DeleteGroups).Name.ToUpper()] = new Operations.DeleteGroups(site, dbPath);
+            _executors[typeof(Operations.GrantRoleMembershipsToGroups).Name.ToUpper()] = new Operations.GrantRoleMembershipsToGroups(site, dbPath);
+            _executors[typeof(Operations.RevokeRoleMembershipsFromGroups).Name.ToUpper()] = new Operations.RevokeRoleMembershipsFromGroups(site, dbPath);
+            _executors[typeof(Operations.EnumerateRoles).Name.ToUpper()] = new Operations.EnumerateRoles(site, dbPath);
+            _executors[typeof(Operations.EnumerateServers).Name.ToUpper()] = new Operations.EnumerateServers(site, dbPath);
+            _executors[typeof(Operations.AddServer).Name.ToUpper()] = new Operations.AddServer(site, dbPath);
+            _executors[typeof(Operations.UpdateServer).Name.ToUpper()] = new Operations.UpdateServer(site, dbPath);
+            _executors[typeof(Operations.RemoveServer).Name.ToUpper()] = new Operations.RemoveServer(site, dbPath);
 
             //Web Layout
+            _executors[typeof(Operations.WL_GetTitle).Name.ToUpper()] = new Operations.WL_GetTitle(wlCreator, dbPath);
+            _executors[typeof(Operations.WL_GetMapDefinition).Name.ToUpper()] = new Operations.WL_GetMapDefinition(wlCreator, dbPath);
+            _executors[typeof(Operations.WL_GetScale).Name.ToUpper()] = new Operations.WL_GetScale(wlCreator, dbPath);
+            _executors[typeof(Operations.WL_GetCenter).Name.ToUpper()] = new Operations.WL_GetCenter(wlCreator, dbPath);
+            _executors[typeof(Operations.WL_ShowToolbar).Name.ToUpper()] = new Operations.WL_ShowToolbar(wlCreator, dbPath);
+            _executors[typeof(Operations.WL_ShowStatusbar).Name.ToUpper()] = new Operations.WL_ShowStatusbar(wlCreator, dbPath);
+            _executors[typeof(Operations.WL_ShowTaskpane).Name.ToUpper()] = new Operations.WL_ShowTaskpane(wlCreator, dbPath);
+            _executors[typeof(Operations.WL_ShowTaskbar).Name.ToUpper()] = new Operations.WL_ShowTaskbar(wlCreator, dbPath);
+            _executors[typeof(Operations.WL_ShowLegend).Name.ToUpper()] = new Operations.WL_ShowLegend(wlCreator, dbPath);
+            _executors[typeof(Operations.WL_ShowProperties).Name.ToUpper()] = new Operations.WL_ShowProperties(wlCreator, dbPath);
+            _executors[typeof(Operations.WL_GetTaskPaneWidth).Name.ToUpper()] = new Operations.WL_GetTaskPaneWidth(wlCreator, dbPath);
+            _executors[typeof(Operations.WL_GetInformationPaneWidth).Name.ToUpper()] = new Operations.WL_GetInformationPaneWidth(wlCreator, dbPath);
+            _executors[typeof(Operations.WL_GetInitialTaskUrl).Name.ToUpper()] = new Operations.WL_GetInitialTaskUrl(wlCreator, dbPath);
+            _executors[typeof(Operations.WL_ShowContextMenu).Name.ToUpper()] = new Operations.WL_ShowContextMenu(wlCreator, dbPath);
+            _executors[typeof(Operations.WL_TestUiItem).Name.ToUpper()] = new Operations.WL_TestUiItem(wlCreator, dbPath);
+            _executors[typeof(Operations.WL_HomeTooltip).Name.ToUpper()] = new Operations.WL_HomeTooltip(wlCreator, dbPath);
+            _executors[typeof(Operations.WL_HomeDescription).Name.ToUpper()] = new Operations.WL_HomeDescription(wlCreator, dbPath);
+            _executors[typeof(Operations.WL_BackTooltip).Name.ToUpper()] = new Operations.WL_BackTooltip(wlCreator, dbPath);
+            _executors[typeof(Operations.WL_BackDescription).Name.ToUpper()] = new Operations.WL_BackDescription(wlCreator, dbPath);
+            _executors[typeof(Operations.WL_ForwardTooltip).Name.ToUpper()] = new Operations.WL_ForwardTooltip(wlCreator, dbPath);
+            _executors[typeof(Operations.WL_ForwardDescription).Name.ToUpper()] = new Operations.WL_ForwardDescription(wlCreator, dbPath);
+            _executors[typeof(Operations.WL_TasksName).Name.ToUpper()] = new Operations.WL_TasksName(wlCreator, dbPath);
+            _executors[typeof(Operations.WL_TasksTooltip).Name.ToUpper()] = new Operations.WL_TasksTooltip(wlCreator, dbPath);
+            _executors[typeof(Operations.WL_TasksDescription).Name.ToUpper()] = new Operations.WL_TasksDescription(wlCreator, dbPath);
         }
 
+        class MgWebLayoutCreator : Operations.IWebLayoutCreator
+        {
+            private MgResourceService _resSvc;
+            private MgWebLayout _wl;
+
+            public MgWebLayoutCreator(MgResourceService resSvc)
+            {
+                _resSvc = resSvc;
+            }
+
+            public MgWebLayout CreateWebLayout(MgResourceIdentifier resId)
+            {
+                if (_wl != null)
+                    return _wl;
+
+                _wl = new MgWebLayout(_resSvc, resId);
+                return _wl;
+            }
+        }
+
         class MgMapCreator : Operations.IMapCreator
         {
             private MgResourceService _resSvc;
@@ -179,6 +265,15 @@
             }
         }
 
+        class MgSession : Operations.IMapGuideSession
+        {
+            public string SessionID
+            {
+                get;
+                set;
+            }
+        }
+
         public override ITestExecutor GetTestExecutor(string opName)
         {
             if (_executors.ContainsKey(opName))
@@ -287,8 +382,11 @@
 
                         if (this.TestExecutionMode == "validate")
                         {
+                            bool bStringsEqual = false;
+                            bStringsEqual = resultData.Equals(expectedResult, StringComparison.InvariantCultureIgnoreCase);
+                            
                             //If the results are different and special validation fails then the operation failed ->mark it red
-                            if (!resultData.Equals(expectedResult, StringComparison.InvariantCultureIgnoreCase) && !CommonUtility.SpecialValidation(operation, resultData, expectedResult))
+                            if (!bStringsEqual && !CommonUtility.SpecialValidation(operation, resultData, expectedResult))
                             {
                                 outcome = "fail";
                                 exitStatus = 1;
@@ -319,7 +417,8 @@
             {
                 Console.WriteLine("****{0} {1} {2} failed.\n", testName, paramSetId, operation);
                 string str = string.Format("\n****ACTUAL RESULT****\n{0}\n****EXPECTED RESULT****\n{1}\n********\n\n\n", resultData, expectedResult);
-                Console.WriteLine(str);
+                //Console.WriteLine(str);
+                //Console.WriteLine("<FAIL>");
                 logger.Write(str);
             }
 

Added: trunk/MgDev/UnitTest/WebTier/DotNet/TestMapGuideApi/ServerAdmin/Operations.cs
===================================================================
--- trunk/MgDev/UnitTest/WebTier/DotNet/TestMapGuideApi/ServerAdmin/Operations.cs	                        (rev 0)
+++ trunk/MgDev/UnitTest/WebTier/DotNet/TestMapGuideApi/ServerAdmin/Operations.cs	2013-07-03 14:59:19 UTC (rev 7656)
@@ -0,0 +1,370 @@
+using OSGeo.MapGuide.Test.Common;
+using System;
+using System.Collections.Generic;
+using System.Collections.Specialized;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace OSGeo.MapGuide.Test.Operations
+{
+    /*
+    public class GetProperties : ServerAdminOperationExecutor<GetProperties>
+    {
+        public GetProperties(MgServerAdmin admin, string unitTestVm)
+            : base(admin, unitTestVm)
+        {
+        }
+
+        public override TestResult Execute(int paramSetId)
+        {
+            try
+            {
+                return new TestResult();
+            }
+            catch (MgException ex)
+            {
+                return TestResult.FromMgException(ex);
+            }
+        }
+    }
+    */
+    public class Offline : ServerAdminOperationExecutor<Offline>
+    {
+        public Offline(MgServerAdmin admin, string unitTestVm)
+            : base(admin, unitTestVm)
+        {
+        }
+
+        public override TestResult Execute(int paramSetId)
+        {
+            try
+            {
+                _serverAdmin.TakeOffline();
+                return new TestResult(CommonUtility.BooleanToString(_serverAdmin.IsOnline()), "text/plain");
+            }
+            catch (MgException ex)
+            {
+                return TestResult.FromMgException(ex);
+            }
+        }
+    }
+
+    public class Online : ServerAdminOperationExecutor<Online>
+    {
+        public Online(MgServerAdmin admin, string unitTestVm)
+            : base(admin, unitTestVm)
+        {
+        }
+
+        public override TestResult Execute(int paramSetId)
+        {
+            try
+            {
+                _serverAdmin.BringOnline();
+                return new TestResult(CommonUtility.BooleanToString(_serverAdmin.IsOnline()), "text/plain");
+            }
+            catch (MgException ex)
+            {
+                return TestResult.FromMgException(ex);
+            }
+        }
+    }
+
+    public class GetLog : ServerAdminOperationExecutor<GetLog>
+    {
+        public GetLog(MgServerAdmin admin, string unitTestVm)
+            : base(admin, unitTestVm)
+        {
+        }
+
+        public override TestResult Execute(int paramSetId)
+        {
+            try
+            {
+                var param = new NameValueCollection();
+                _unitTestVm.ReadParameterValue(paramSetId, "LOGTYPE", param);
+                _unitTestVm.ReadParameterValue(paramSetId, "NUMENTRIES", param);
+
+                MgByteReader reader = null;
+                if (param["NUMENTRIES"] == null)
+                {
+                    reader = _serverAdmin.GetLog(param["LOGTYPE"]);
+                }
+                else
+                {
+                    reader = _serverAdmin.GetLog(param["LOGTYPE"], Convert.ToInt32(param["NUMENTRIES"]));
+                }
+
+                return TestResult.FromByteReader(reader);
+            }
+            catch (MgException ex)
+            {
+                return TestResult.FromMgException(ex);
+            }
+        }
+    }
+
+    public class GetLogByDate : ServerAdminOperationExecutor<GetLogByDate>
+    {
+        public GetLogByDate(MgServerAdmin admin, string unitTestVm)
+            : base(admin, unitTestVm)
+        {
+        }
+
+        public override TestResult Execute(int paramSetId)
+        {
+            try
+            {
+                var param = new NameValueCollection();
+                _unitTestVm.ReadParameterValue(paramSetId, "LOGTYPE", param);
+                _unitTestVm.ReadParameterValue(paramSetId, "FROMDATE", param);
+                _unitTestVm.ReadParameterValue(paramSetId, "TODATE", param);
+
+                string[] fromDatePieces = (param["FROMDATE"] ?? "").Split(',');
+                string[] toDatePieces = (param["TODATE"] ?? "").Split(',');
+
+                MgDateTime fromDate = null;
+                MgDateTime toDate = null;
+
+                if (fromDatePieces.Length == 3)
+                {
+                    fromDate = new MgDateTime(Convert.ToInt16(fromDatePieces[0]), Convert.ToInt16(fromDatePieces[1]), Convert.ToInt16(fromDatePieces[2]));
+                }
+                else if (fromDatePieces.Length == 7)
+                {
+                    fromDate = new MgDateTime(Convert.ToInt16(fromDatePieces[0]), Convert.ToInt16(fromDatePieces[1]), Convert.ToInt16(fromDatePieces[2]), Convert.ToInt16(fromDatePieces[3]), Convert.ToInt16(fromDatePieces[4]), Convert.ToInt16(fromDatePieces[5]), Convert.ToInt32(fromDatePieces[6]));
+                }
+
+                if (toDatePieces.Length == 3)
+                {
+                    toDate = new MgDateTime(Convert.ToInt16(toDatePieces[0]), Convert.ToInt16(toDatePieces[1]), Convert.ToInt16(toDatePieces[2]));
+                }
+                else if (toDatePieces.Length == 7)
+                {
+                    toDate = new MgDateTime(Convert.ToInt16(toDatePieces[0]), Convert.ToInt16(toDatePieces[1]), Convert.ToInt16(toDatePieces[2]), Convert.ToInt16(toDatePieces[3]), Convert.ToInt16(toDatePieces[4]), Convert.ToInt16(toDatePieces[5]), Convert.ToInt32(toDatePieces[6]));
+                }
+
+                MgByteReader reader = _serverAdmin.GetLog(param["LOGTYPE"] ?? "", fromDate, toDate);
+                return TestResult.FromByteReader(reader);
+            }
+            catch (MgException ex)
+            {
+                return TestResult.FromMgException(ex);
+            }
+        }
+    }
+
+    public class ClearLog : ServerAdminOperationExecutor<ClearLog>
+    {
+        public ClearLog(MgServerAdmin admin, string unitTestVm)
+            : base(admin, unitTestVm)
+        {
+        }
+
+        public override TestResult Execute(int paramSetId)
+        {
+            try
+            {
+                var param = new NameValueCollection();
+                _unitTestVm.ReadParameterValue(paramSetId, "LOGTYPE", param);
+
+                bool cleared = _serverAdmin.ClearLog(param["LOGTYPE"]);
+                return new TestResult(CommonUtility.BooleanToString(cleared), "text/plain");
+            }
+            catch (MgException ex)
+            {
+                return TestResult.FromMgException(ex);
+            }
+        }
+    }
+
+    /*
+    public class EnumerateLogs : ServerAdminOperationExecutor<EnumerateLogs>
+    {
+        public EnumerateLogs(MgServerAdmin admin, string unitTestVm)
+            : base(admin, unitTestVm)
+        {
+        }
+
+        public override TestResult Execute(int paramSetId)
+        {
+            try
+            {
+                return new TestResult();
+            }
+            catch (MgException ex)
+            {
+                return TestResult.FromMgException(ex);
+            }
+        }
+    }
+     */
+
+    public class DeleteLog : ServerAdminOperationExecutor<DeleteLog>
+    {
+        public DeleteLog(MgServerAdmin admin, string unitTestVm)
+            : base(admin, unitTestVm)
+        {
+        }
+
+        public override TestResult Execute(int paramSetId)
+        {
+            try
+            {
+                var param = new NameValueCollection();
+                _unitTestVm.ReadParameterValue(paramSetId, "FILENAME", param);
+
+                _serverAdmin.DeleteLog(param["FILENAME"]);
+                return new TestResult();
+            }
+            catch (MgException ex)
+            {
+                return TestResult.FromMgException(ex);
+            }
+        }
+    }
+
+    public class RenameLog : ServerAdminOperationExecutor<RenameLog>
+    {
+        public RenameLog(MgServerAdmin admin, string unitTestVm)
+            : base(admin, unitTestVm)
+        {
+        }
+
+        public override TestResult Execute(int paramSetId)
+        {
+            try
+            {
+                var param = new NameValueCollection();
+                _unitTestVm.ReadParameterValue(paramSetId, "OLDFILENAME", param);
+                _unitTestVm.ReadParameterValue(paramSetId, "NEWFILENAME", param);
+
+                _serverAdmin.RenameLog(param["OLDFILENAME"], param["NEWFILENAME"]);
+                return new TestResult();
+            }
+            catch (MgException ex)
+            {
+                return TestResult.FromMgException(ex);
+            }
+        }
+    }
+
+    public class EnumeratePackages : ServerAdminOperationExecutor<EnumeratePackages>
+    {
+        public EnumeratePackages(MgServerAdmin admin, string unitTestVm)
+            : base(admin, unitTestVm)
+        {
+        }
+
+        public override TestResult Execute(int paramSetId)
+        {
+            try
+            {
+                var packages = _serverAdmin.EnumeratePackages();
+                return new TestResult(CommonUtility.MgStringCollectionToString(packages), "text/plain");
+            }
+            catch (MgException ex)
+            {
+                return TestResult.FromMgException(ex);
+            }
+        }
+    }
+
+    public class DeletePackage : ServerAdminOperationExecutor<DeletePackage>
+    {
+        public DeletePackage(MgServerAdmin admin, string unitTestVm)
+            : base(admin, unitTestVm)
+        {
+        }
+
+        public override TestResult Execute(int paramSetId)
+        {
+            try
+            {
+                var param = new NameValueCollection();
+                _unitTestVm.ReadParameterValue(paramSetId, "PACKAGENAME", param);
+
+                _serverAdmin.DeletePackage(param["PACKAGENAME"]);
+                return new TestResult();
+            }
+            catch (MgException ex)
+            {
+                return TestResult.FromMgException(ex);
+            }
+        }
+    }
+
+    public class LoadPackage : ServerAdminOperationExecutor<LoadPackage>
+    {
+        public LoadPackage(MgServerAdmin admin, string unitTestVm)
+            : base(admin, unitTestVm)
+        {
+        }
+
+        public override TestResult Execute(int paramSetId)
+        {
+            try
+            {
+                var param = new NameValueCollection();
+                _unitTestVm.ReadParameterValue(paramSetId, "PACKAGENAME", param);
+
+                _serverAdmin.LoadPackage(param["PACKAGENAME"]);
+                return new TestResult();
+            }
+            catch (MgException ex)
+            {
+                return TestResult.FromMgException(ex);
+            }
+        }
+    }
+
+    public class GetPackageStatus : ServerAdminOperationExecutor<GetPackageStatus>
+    {
+        public GetPackageStatus(MgServerAdmin admin, string unitTestVm)
+            : base(admin, unitTestVm)
+        {
+        }
+
+        public override TestResult Execute(int paramSetId)
+        {
+            try
+            {
+                var param = new NameValueCollection();
+                _unitTestVm.ReadParameterValue(paramSetId, "PACKAGENAME", param);
+
+                MgPackageStatusInformation status = _serverAdmin.GetPackageStatus(param["PACKAGENAME"]);
+                string code = status.GetStatusCode();
+                return new TestResult(code, "text/plain");
+            }
+            catch (MgException ex)
+            {
+                return TestResult.FromMgException(ex);
+            }
+        }
+    }
+
+    public class GetPackageLog : ServerAdminOperationExecutor<GetPackageLog>
+    {
+        public GetPackageLog(MgServerAdmin admin, string unitTestVm)
+            : base(admin, unitTestVm)
+        {
+        }
+
+        public override TestResult Execute(int paramSetId)
+        {
+            try
+            {
+                var param = new NameValueCollection();
+                _unitTestVm.ReadParameterValue(paramSetId, "PACKAGENAME", param);
+
+                MgByteReader reader = _serverAdmin.GetPackageLog(param["PACKAGENAME"]);
+                return TestResult.FromByteReader(reader);
+            }
+            catch (MgException ex)
+            {
+                return TestResult.FromMgException(ex);
+            }
+        }
+    }
+}

Added: trunk/MgDev/UnitTest/WebTier/DotNet/TestMapGuideApi/SiteService/Operations.cs
===================================================================
--- trunk/MgDev/UnitTest/WebTier/DotNet/TestMapGuideApi/SiteService/Operations.cs	                        (rev 0)
+++ trunk/MgDev/UnitTest/WebTier/DotNet/TestMapGuideApi/SiteService/Operations.cs	2013-07-03 14:59:19 UTC (rev 7656)
@@ -0,0 +1,795 @@
+using OSGeo.MapGuide.Test.Common;
+using System;
+using System.Collections.Generic;
+using System.Collections.Specialized;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace OSGeo.MapGuide.Test.Operations
+{
+    public interface IMapGuideSession
+    {
+        string SessionID { get; set; }
+    }
+
+    public class CreateSession : SiteServiceOperationExecutor<CreateSession>
+    {
+        private IMapGuideSession _session;
+
+        public CreateSession(MgSite site, string unitTestVm, IMapGuideSession session)
+            : base(site, unitTestVm)
+        {
+            _session = session;
+        }
+
+        public override TestResult Execute(int paramSetId)
+        {
+            try
+            {
+                var user = new MgUserInformation();
+                user.SetMgUsernamePassword("Administrator", "admin");
+                user.SetLocale("en");
+
+                var site = new MgSite();
+                site.Open(user);
+
+                string session = site.CreateSession();
+                _session.SessionID = session;
+                site.Close();
+
+                return new TestResult(session, "text/plain");
+            }
+            catch (MgException ex)
+            {
+                return TestResult.FromMgException(ex);
+            }
+        }
+    }
+
+    public class DestroySession : SiteServiceOperationExecutor<DestroySession>
+    {
+        public DestroySession(MgSite site, string unitTestVm)
+            : base(site, unitTestVm)
+        {
+
+        }
+
+        public override TestResult Execute(int paramSetId)
+        {
+            try
+            {
+                //This is what PHP one is giving us
+                return new TestResult("Not Implemented Yet", "text/plain");
+            }
+            catch (MgException ex)
+            {
+                return TestResult.FromMgException(ex);
+            }
+        }
+    }
+
+    public class GetUserForSession : SiteServiceOperationExecutor<GetUserForSession>
+    {
+        private IMapGuideSession _session;
+
+        public GetUserForSession(MgSite site, string unitTestVm, IMapGuideSession session)
+            : base(site, unitTestVm)
+        {
+            _session = session;
+        }
+
+        public override TestResult Execute(int paramSetId)
+        {
+            try
+            {
+                var site = new MgSite();
+                var user = new MgUserInformation();
+                user.SetMgSessionId(_session.SessionID ?? "");
+                site.Open(user);
+                var userId = site.GetUserForSession();
+                site.Close();
+                return new TestResult(userId, "text/plain");
+            }
+            catch (MgException ex)
+            {
+                return TestResult.FromMgException(ex);
+            }
+        }
+    }
+
+    /*
+    public class GetSiteServerAddress : SiteServiceOperationExecutor<GetSiteServerAddress>
+    {
+        public GetSiteServerAddress(MgSite site, string unitTestVm)
+            : base(site, unitTestVm)
+        {
+
+        }
+
+        public override TestResult Execute(int paramSetId)
+        {
+            try
+            {
+                var result = _site.GetCurrentSiteAddress();
+                return new TestResult();
+            }
+            catch (MgException ex)
+            {
+                return TestResult.FromMgException(ex);
+            }
+        }
+    }
+     */
+
+    public class EnumerateUsers : SiteServiceOperationExecutor<EnumerateUsers>
+    {
+        public EnumerateUsers(MgSite site, string unitTestVm)
+            : base(site, unitTestVm)
+        {
+
+        }
+
+        public override TestResult Execute(int paramSetId)
+        {
+            try
+            {
+                var param = new NameValueCollection();
+                _unitTestVm.ReadParameterValue(paramSetId, "GROUP", param);
+                _unitTestVm.ReadParameterValue(paramSetId, "ROLE", param);
+                _unitTestVm.ReadParameterValue(paramSetId, "INCLUDEGROUPS", param);
+
+                MgByteReader reader = null;
+                if (param["ROLE"] != null)
+                {
+                    reader = _site.EnumerateUsers(param["GROUP"] ?? "", param["ROLE"] ?? "", (param["INCLUDEGROUPS"] == "1"));
+                }
+                else
+                {
+                    reader = _site.EnumerateUsers(param["GROUP"] ?? "");
+                }
+                return TestResult.FromByteReader(reader);
+            }
+            catch (MgException ex)
+            {
+                return TestResult.FromMgException(ex);
+            }
+        }
+    }
+
+    public class AddUser : SiteServiceOperationExecutor<AddUser>
+    {
+        public AddUser(MgSite site, string unitTestVm)
+            : base(site, unitTestVm)
+        {
+
+        }
+
+        public override TestResult Execute(int paramSetId)
+        {
+            try
+            {
+                var param = new NameValueCollection();
+                _unitTestVm.ReadParameterValue(paramSetId, "USERID", param);
+                _unitTestVm.ReadParameterValue(paramSetId, "USERNAME", param);
+                _unitTestVm.ReadParameterValue(paramSetId, "PASSWORD", param);
+                _unitTestVm.ReadParameterValue(paramSetId, "DESCRIPTION", param);
+
+                _site.AddUser(param["USERID"], param["USERNAME"], param["PASSWORD"], param["DESCRIPTION"]);
+                return new TestResult();
+            }
+            catch (MgException ex)
+            {
+                return TestResult.FromMgException(ex);
+            }
+        }
+    }
+
+    public class UpdateUser : SiteServiceOperationExecutor<UpdateUser>
+    {
+        public UpdateUser(MgSite site, string unitTestVm)
+            : base(site, unitTestVm)
+        {
+
+        }
+
+        public override TestResult Execute(int paramSetId)
+        {
+            try
+            {
+                var param = new NameValueCollection();
+                _unitTestVm.ReadParameterValue(paramSetId, "USERID", param);
+                _unitTestVm.ReadParameterValue(paramSetId, "NEWUSERID", param);
+                _unitTestVm.ReadParameterValue(paramSetId, "NEWUSERNAME", param);
+                _unitTestVm.ReadParameterValue(paramSetId, "NEWPASSWORD", param);
+                _unitTestVm.ReadParameterValue(paramSetId, "NEWDESCRIPTION", param);
+
+                _site.UpdateUser(param["USERID"], param["NEWUSERID"], param["NEWUSERNAME"], param["NEWPASSWORD"], param["NEWDESCRIPTION"]);
+                return new TestResult();
+            }
+            catch (MgException ex)
+            {
+                return TestResult.FromMgException(ex);
+            }
+        }
+    }
+
+    public class DeleteUsers : SiteServiceOperationExecutor<DeleteUsers>
+    {
+        public DeleteUsers(MgSite site, string unitTestVm)
+            : base(site, unitTestVm)
+        {
+
+        }
+
+        public override TestResult Execute(int paramSetId)
+        {
+            try
+            {
+                var param = new NameValueCollection();
+                _unitTestVm.ReadParameterValue(paramSetId, "USERS", param);
+
+                MgStringCollection users = CommonUtility.StringToMgStringCollection(param["USERS"]);
+
+                _site.DeleteUsers(users);
+                return new TestResult();
+            }
+            catch (MgException ex)
+            {
+                return TestResult.FromMgException(ex);
+            }
+        }
+    }
+
+    public class GrantRoleMembershipsToUsers : SiteServiceOperationExecutor<GrantRoleMembershipsToUsers>
+    {
+        public GrantRoleMembershipsToUsers(MgSite site, string unitTestVm)
+            : base(site, unitTestVm)
+        {
+
+        }
+
+        public override TestResult Execute(int paramSetId)
+        {
+            try
+            {
+                var param = new NameValueCollection();
+                _unitTestVm.ReadParameterValue(paramSetId, "ROLES", param);
+                _unitTestVm.ReadParameterValue(paramSetId, "USERS", param);
+
+                MgStringCollection roles = CommonUtility.StringToMgStringCollection(param["ROLES"]);
+                MgStringCollection users = CommonUtility.StringToMgStringCollection(param["USERS"]);
+
+                _site.GrantRoleMembershipsToUsers(roles, users);
+
+                return new TestResult();
+            }
+            catch (MgException ex)
+            {
+                return TestResult.FromMgException(ex);
+            }
+        }
+    }
+
+    public class RevokeRoleMembershipsFromUsers : SiteServiceOperationExecutor<RevokeRoleMembershipsFromUsers>
+    {
+        public RevokeRoleMembershipsFromUsers(MgSite site, string unitTestVm)
+            : base(site, unitTestVm)
+        {
+
+        }
+
+        public override TestResult Execute(int paramSetId)
+        {
+            try
+            {
+                var param = new NameValueCollection();
+                _unitTestVm.ReadParameterValue(paramSetId, "ROLES", param);
+                _unitTestVm.ReadParameterValue(paramSetId, "USERS", param);
+
+                MgStringCollection roles = CommonUtility.StringToMgStringCollection(param["ROLES"]);
+                MgStringCollection users = CommonUtility.StringToMgStringCollection(param["USERS"]);
+
+                _site.RevokeRoleMembershipsFromUsers(roles, users);
+
+                return new TestResult();
+            }
+            catch (MgException ex)
+            {
+                return TestResult.FromMgException(ex);
+            }
+        }
+    }
+
+    public class GrantGroupMembershipsToUsers : SiteServiceOperationExecutor<GrantGroupMembershipsToUsers>
+    {
+        public GrantGroupMembershipsToUsers(MgSite site, string unitTestVm)
+            : base(site, unitTestVm)
+        {
+
+        }
+
+        public override TestResult Execute(int paramSetId)
+        {
+            try
+            {
+                var param = new NameValueCollection();
+                _unitTestVm.ReadParameterValue(paramSetId, "GROUPS", param);
+                _unitTestVm.ReadParameterValue(paramSetId, "USERS", param);
+
+                MgStringCollection groups = CommonUtility.StringToMgStringCollection(param["GROUPS"]);
+                MgStringCollection users = CommonUtility.StringToMgStringCollection(param["USERS"]);
+
+                _site.GrantGroupMembershipsToUsers(groups, users);
+
+                return new TestResult();
+            }
+            catch (MgException ex)
+            {
+                return TestResult.FromMgException(ex);
+            }
+        }
+    }
+
+    public class RevokeGroupMembershipsFromUsers : SiteServiceOperationExecutor<RevokeGroupMembershipsFromUsers>
+    {
+        public RevokeGroupMembershipsFromUsers(MgSite site, string unitTestVm)
+            : base(site, unitTestVm)
+        {
+
+        }
+
+        public override TestResult Execute(int paramSetId)
+        {
+            try
+            {
+                var param = new NameValueCollection();
+                _unitTestVm.ReadParameterValue(paramSetId, "GROUPS", param);
+                _unitTestVm.ReadParameterValue(paramSetId, "USERS", param);
+
+                MgStringCollection groups = CommonUtility.StringToMgStringCollection(param["GROUPS"]);
+                MgStringCollection users = CommonUtility.StringToMgStringCollection(param["USERS"]);
+
+                _site.RevokeGroupMembershipsFromUsers(groups, users);
+
+                return new TestResult();
+            }
+            catch (MgException ex)
+            {
+                return TestResult.FromMgException(ex);
+            }
+        }
+    }
+
+    public class EnumerateGroups : SiteServiceOperationExecutor<EnumerateGroups>
+    {
+        public EnumerateGroups(MgSite site, string unitTestVm)
+            : base(site, unitTestVm)
+        {
+
+        }
+
+        public override TestResult Execute(int paramSetId)
+        {
+            try
+            {
+                var param = new NameValueCollection();
+                _unitTestVm.ReadParameterValue(paramSetId, "USER", param);
+                _unitTestVm.ReadParameterValue(paramSetId, "ROLE", param);
+
+                MgByteReader reader = _site.EnumerateGroups(param["USER"] ?? "", param["ROLE"] ?? "");
+                return TestResult.FromByteReader(reader);
+            }
+            catch (MgException ex)
+            {
+                return TestResult.FromMgException(ex);
+            }
+        }
+    }
+
+    public class EnumerateGroups2 : SiteServiceOperationExecutor<EnumerateGroups2>
+    {
+        public EnumerateGroups2(MgSite site, string unitTestVm)
+            : base(site, unitTestVm)
+        {
+
+        }
+
+        public override TestResult Execute(int paramSetId)
+        {
+            try
+            {
+                var param = new NameValueCollection();
+                _unitTestVm.ReadParameterValue(paramSetId, "USER", param);
+                _unitTestVm.ReadParameterValue(paramSetId, "LOGIN", param);
+                _unitTestVm.ReadParameterValue(paramSetId, "PASSWORD", param);
+
+                var userInfo = new MgUserInformation();
+                userInfo.SetMgUsernamePassword(param["LOGIN"], param["PASSWORD"]);
+                userInfo.SetLocale("en");
+
+                var site = new MgSite();
+                site.Open(userInfo);
+
+                MgByteReader reader = site.EnumerateGroups(param["USER"]);
+                site.Close();
+
+                return TestResult.FromByteReader(reader);
+            }
+            catch (MgException ex)
+            {
+                return TestResult.FromMgException(ex);
+            }
+        }
+    }
+
+    public class EnumerateRoles2 : SiteServiceOperationExecutor<EnumerateRoles2>
+    {
+        public EnumerateRoles2(MgSite site, string unitTestVm)
+            : base(site, unitTestVm)
+        {
+
+        }
+
+        public override TestResult Execute(int paramSetId)
+        {
+            try
+            {
+                var param = new NameValueCollection();
+                _unitTestVm.ReadParameterValue(paramSetId, "USER", param);
+                _unitTestVm.ReadParameterValue(paramSetId, "LOGIN", param);
+                _unitTestVm.ReadParameterValue(paramSetId, "PASSWORD", param);
+
+                var userInfo = new MgUserInformation();
+                userInfo.SetMgUsernamePassword(param["LOGIN"], param["PASSWORD"]);
+                userInfo.SetLocale("en");
+
+                var site = new MgSite();
+                site.Open(userInfo);
+
+                MgStringCollection roles = site.EnumerateRoles(param["USER"]);
+                site.Close();
+
+                return new TestResult(CommonUtility.MgStringCollectionToString(roles), "text/plain");
+            }
+            catch (MgException ex)
+            {
+                return TestResult.FromMgException(ex);
+            }
+        }
+    }
+
+    public class AddGroup : SiteServiceOperationExecutor<AddGroup>
+    {
+        public AddGroup(MgSite site, string unitTestVm)
+            : base(site, unitTestVm)
+        {
+
+        }
+
+        public override TestResult Execute(int paramSetId)
+        {
+            try
+            {
+                var param = new NameValueCollection();
+                _unitTestVm.ReadParameterValue(paramSetId, "GROUP", param);
+                _unitTestVm.ReadParameterValue(paramSetId, "DESCRIPTION", param);
+
+                _site.AddGroup(param["GROUP"] ?? "", param["DESCRIPTION"] ?? "");
+                return new TestResult();
+            }
+            catch (MgException ex)
+            {
+                return TestResult.FromMgException(ex);
+            }
+        }
+    }
+
+    public class UpdateGroup : SiteServiceOperationExecutor<UpdateGroup>
+    {
+        public UpdateGroup(MgSite site, string unitTestVm)
+            : base(site, unitTestVm)
+        {
+
+        }
+
+        public override TestResult Execute(int paramSetId)
+        {
+            try
+            {
+                var param = new NameValueCollection();
+                _unitTestVm.ReadParameterValue(paramSetId, "GROUP", param);
+                _unitTestVm.ReadParameterValue(paramSetId, "NEWGROUP", param);
+                _unitTestVm.ReadParameterValue(paramSetId, "NEWDESCRIPTION", param);
+
+                _site.UpdateGroup(param["GROUP"] ?? "", param["NEWGROUP"] ?? "", param["NEWDESCRIPTION"] ?? "");
+                return new TestResult();
+            }
+            catch (MgException ex)
+            {
+                return TestResult.FromMgException(ex);
+            }
+        }
+    }
+
+    public class DeleteGroups : SiteServiceOperationExecutor<DeleteGroups>
+    {
+        public DeleteGroups(MgSite site, string unitTestVm)
+            : base(site, unitTestVm)
+        {
+
+        }
+
+        public override TestResult Execute(int paramSetId)
+        {
+            try
+            {
+                var param = new NameValueCollection();
+                _unitTestVm.ReadParameterValue(paramSetId, "GROUPS", param);
+
+                MgStringCollection groups = CommonUtility.StringToMgStringCollection(param["GROUPS"]);
+                _site.DeleteGroups(groups);
+
+                return new TestResult();
+            }
+            catch (MgException ex)
+            {
+                return TestResult.FromMgException(ex);
+            }
+        }
+    }
+
+    public class GrantRoleMembershipsToGroups : SiteServiceOperationExecutor<GrantRoleMembershipsToGroups>
+    {
+        public GrantRoleMembershipsToGroups(MgSite site, string unitTestVm)
+            : base(site, unitTestVm)
+        {
+
+        }
+
+        public override TestResult Execute(int paramSetId)
+        {
+            try
+            {
+                var param = new NameValueCollection();
+                _unitTestVm.ReadParameterValue(paramSetId, "ROLES", param);
+                _unitTestVm.ReadParameterValue(paramSetId, "GROUPS", param);
+
+                MgStringCollection roles = CommonUtility.StringToMgStringCollection(param["ROLES"]);
+                MgStringCollection groups = CommonUtility.StringToMgStringCollection(param["GROUPS"]);
+
+                _site.GrantRoleMembershipsToGroups(roles, groups);
+
+                return new TestResult();
+            }
+            catch (MgException ex)
+            {
+                return TestResult.FromMgException(ex);
+            }
+        }
+    }
+
+    public class RevokeRoleMembershipsFromGroups : SiteServiceOperationExecutor<RevokeRoleMembershipsFromGroups>
+    {
+        public RevokeRoleMembershipsFromGroups(MgSite site, string unitTestVm)
+            : base(site, unitTestVm)
+        {
+
+        }
+
+        public override TestResult Execute(int paramSetId)
+        {
+            try
+            {
+                var param = new NameValueCollection();
+                _unitTestVm.ReadParameterValue(paramSetId, "ROLES", param);
+                _unitTestVm.ReadParameterValue(paramSetId, "GROUPS", param);
+
+                MgStringCollection roles = CommonUtility.StringToMgStringCollection(param["ROLES"]);
+                MgStringCollection groups = CommonUtility.StringToMgStringCollection(param["GROUPS"]);
+
+                _site.RevokeRoleMembershipsFromGroups(roles, groups);
+
+                return new TestResult();
+            }
+            catch (MgException ex)
+            {
+                return TestResult.FromMgException(ex);
+            }
+        }
+    }
+
+    public class EnumerateRoles : SiteServiceOperationExecutor<EnumerateRoles>
+    {
+        public EnumerateRoles(MgSite site, string unitTestVm)
+            : base(site, unitTestVm)
+        {
+
+        }
+
+        public override TestResult Execute(int paramSetId)
+        {
+            try
+            {
+                var param = new NameValueCollection();
+                _unitTestVm.ReadParameterValue(paramSetId, "USER", param);
+                _unitTestVm.ReadParameterValue(paramSetId, "GROUP", param);
+
+                MgStringCollection roles = _site.EnumerateRoles(param["USER"], param["GROUP"]);
+
+                return new TestResult(CommonUtility.MgStringCollectionToString(roles), "text/plain");
+            }
+            catch (MgException ex)
+            {
+                return TestResult.FromMgException(ex);
+            }
+        }
+    }
+
+    public class EnumerateServers : SiteServiceOperationExecutor<EnumerateServers>
+    {
+        public EnumerateServers(MgSite site, string unitTestVm)
+            : base(site, unitTestVm)
+        {
+
+        }
+
+        public override TestResult Execute(int paramSetId)
+        {
+            try
+            {
+                MgByteReader reader = _site.EnumerateServers();
+                return TestResult.FromByteReader(reader);
+            }
+            catch (MgException ex)
+            {
+                return TestResult.FromMgException(ex);
+            }
+        }
+    }
+
+    public class AddServer : SiteServiceOperationExecutor<AddServer>
+    {
+        public AddServer(MgSite site, string unitTestVm)
+            : base(site, unitTestVm)
+        {
+
+        }
+
+        public override TestResult Execute(int paramSetId)
+        {
+            try
+            {
+                var param = new NameValueCollection();
+                _unitTestVm.ReadParameterValue(paramSetId, "NAME", param);
+                _unitTestVm.ReadParameterValue(paramSetId, "DESCRIPTION", param);
+                _unitTestVm.ReadParameterValue(paramSetId, "ADDRESS", param);
+
+                _site.AddServer(param["NAME"], param["DESCRIPTION"], param["ADDRESS"]);
+                return new TestResult();
+            }
+            catch (MgException ex)
+            {
+                return TestResult.FromMgException(ex);
+            }
+        }
+    }
+
+    public class UpdateServer : SiteServiceOperationExecutor<UpdateServer>
+    {
+        public UpdateServer(MgSite site, string unitTestVm)
+            : base(site, unitTestVm)
+        {
+
+        }
+
+        public override TestResult Execute(int paramSetId)
+        {
+            try
+            {
+                var param = new NameValueCollection();
+                _unitTestVm.ReadParameterValue(paramSetId, "OLDNAME", param);
+                _unitTestVm.ReadParameterValue(paramSetId, "NEWNAME", param);
+                _unitTestVm.ReadParameterValue(paramSetId, "NEWDESCRIPTION", param);
+                _unitTestVm.ReadParameterValue(paramSetId, "NEWADDRESS", param);
+
+                _site.UpdateServer(param["OLDNAME"], param["NEWNAME"], param["NEWDESCRIPTION"], param["NEWADDRESS"]);
+                return new TestResult();
+            }
+            catch (MgException ex)
+            {
+                return TestResult.FromMgException(ex);
+            }
+        }
+    }
+
+    public class RemoveServer : SiteServiceOperationExecutor<RemoveServer>
+    {
+        public RemoveServer(MgSite site, string unitTestVm)
+            : base(site, unitTestVm)
+        {
+
+        }
+
+        public override TestResult Execute(int paramSetId)
+        {
+            try
+            {
+                var param = new NameValueCollection();
+                _unitTestVm.ReadParameterValue(paramSetId, "NAME", param);
+
+                _site.RemoveServer(param["NAME"]);
+                return new TestResult();
+            }
+            catch (MgException ex)
+            {
+                return TestResult.FromMgException(ex);
+            }
+        }
+    }
+
+    /*
+    public class EnumerateServicesOnServer : SiteServiceOperationExecutor<EnumerateServicesOnServer>
+    {
+        public EnumerateServicesOnServer(MgSite site, string unitTestVm)
+            : base(site, unitTestVm)
+        {
+
+        }
+
+        public override TestResult Execute(int paramSetId)
+        {
+            try
+            {
+                return new TestResult();
+            }
+            catch (MgException ex)
+            {
+                return TestResult.FromMgException(ex);
+            }
+        }
+    }
+
+    public class AddServicesToServer : SiteServiceOperationExecutor<AddServicesToServer>
+    {
+        public AddServicesToServer(MgSite site, string unitTestVm)
+            : base(site, unitTestVm)
+        {
+
+        }
+
+        public override TestResult Execute(int paramSetId)
+        {
+            try
+            {
+                return new TestResult();
+            }
+            catch (MgException ex)
+            {
+                return TestResult.FromMgException(ex);
+            }
+        }
+    }
+    
+    public class RemoveServicesFromServer : SiteServiceOperationExecutor<RemoveServicesFromServer>
+    {
+        public RemoveServicesFromServer(MgSite site, string unitTestVm)
+            : base(site, unitTestVm)
+        {
+
+        }
+
+        public override TestResult Execute(int paramSetId)
+        {
+            try
+            {
+                return new TestResult();
+            }
+            catch (MgException ex)
+            {
+                return TestResult.FromMgException(ex);
+            }
+        }
+    }
+     */
+}

Modified: trunk/MgDev/UnitTest/WebTier/DotNet/TestMapGuideApi/TestMapGuideApi.csproj
===================================================================
--- trunk/MgDev/UnitTest/WebTier/DotNet/TestMapGuideApi/TestMapGuideApi.csproj	2013-07-02 15:49:52 UTC (rev 7655)
+++ trunk/MgDev/UnitTest/WebTier/DotNet/TestMapGuideApi/TestMapGuideApi.csproj	2013-07-03 14:59:19 UTC (rev 7656)
@@ -82,8 +82,11 @@
     <Compile Include="Properties\AssemblyInfo.cs" />
     <Compile Include="MapGuideTestExecutorCollection.cs" />
     <Compile Include="RenderingService\RenderingServiceOperationExecutor.cs" />
+    <Compile Include="ServerAdmin\Operations.cs" />
     <Compile Include="ServerAdmin\ServerAdminOperationExecutor.cs" />
+    <Compile Include="SiteService\Operations.cs" />
     <Compile Include="SiteService\SiteServiceOperationExecutor.cs" />
+    <Compile Include="WebLayout\Operations.cs" />
     <Compile Include="WebLayout\WebLayoutOperationExecutor.cs" />
   </ItemGroup>
   <ItemGroup>

Added: trunk/MgDev/UnitTest/WebTier/DotNet/TestMapGuideApi/WebLayout/Operations.cs
===================================================================
--- trunk/MgDev/UnitTest/WebTier/DotNet/TestMapGuideApi/WebLayout/Operations.cs	                        (rev 0)
+++ trunk/MgDev/UnitTest/WebTier/DotNet/TestMapGuideApi/WebLayout/Operations.cs	2013-07-03 14:59:19 UTC (rev 7656)
@@ -0,0 +1,621 @@
+using OSGeo.MapGuide.Test.Common;
+using System;
+using System.Collections.Generic;
+using System.Collections.Specialized;
+using System.Globalization;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace OSGeo.MapGuide.Test.Operations
+{
+    public class WL_GetTitle : WebLayoutOperationExecutor<WL_GetTitle>
+    {
+        public WL_GetTitle(IWebLayoutCreator layout, string unitTestVm)
+            : base(layout, unitTestVm)
+        {
+
+        }
+
+        public override TestResult Execute(int paramSetId)
+        {
+            try
+            {
+                CreateWebLayoutFromResource(paramSetId);
+                return new TestResult(_wl.GetTitle(), "text/plain");
+            }
+            catch (MgException ex)
+            {
+                return TestResult.FromMgException(ex);   
+            }
+        }
+    }
+
+    public class WL_GetMapDefinition : WebLayoutOperationExecutor<WL_GetMapDefinition>
+    {
+        public WL_GetMapDefinition(IWebLayoutCreator layout, string unitTestVm)
+            : base(layout, unitTestVm)
+        {
+
+        }
+
+        public override TestResult Execute(int paramSetId)
+        {
+            try
+            {
+                CreateWebLayoutFromResource(paramSetId);
+                return new TestResult(_wl.GetMapDefinition(), "text/plain");
+            }
+            catch (MgException ex)
+            {
+                return TestResult.FromMgException(ex);
+            }
+        }
+    }
+
+    public class WL_GetScale : WebLayoutOperationExecutor<WL_GetScale>
+    {
+        public WL_GetScale(IWebLayoutCreator layout, string unitTestVm)
+            : base(layout, unitTestVm)
+        {
+
+        }
+
+        public override TestResult Execute(int paramSetId)
+        {
+            try
+            {
+                CreateWebLayoutFromResource(paramSetId);
+                return new TestResult(_wl.GetScale().ToString(CultureInfo.InvariantCulture), "text/plain");
+            }
+            catch (MgException ex)
+            {
+                return TestResult.FromMgException(ex);
+            }
+        }
+    }
+
+    public class WL_GetCenter : WebLayoutOperationExecutor<WL_GetCenter>
+    {
+        public WL_GetCenter(IWebLayoutCreator layout, string unitTestVm)
+            : base(layout, unitTestVm)
+        {
+
+        }
+
+        public override TestResult Execute(int paramSetId)
+        {
+            try
+            {
+                CreateWebLayoutFromResource(paramSetId);
+                var center = _wl.GetCenter();
+                if (center == null)
+                {
+                    return new TestResult("", "text/plain");
+                }
+                else
+                {
+                    var coord = center.Coordinate;
+                    return new TestResult(coord.GetX() + "/" + coord.GetY(), "text/plain");
+                }
+            }
+            catch (MgException ex)
+            {
+                return TestResult.FromMgException(ex);
+            }
+        }
+    }
+
+    public class WL_ShowToolbar : WebLayoutOperationExecutor<WL_ShowToolbar>
+    {
+        public WL_ShowToolbar(IWebLayoutCreator layout, string unitTestVm)
+            : base(layout, unitTestVm)
+        {
+
+        }
+
+        public override TestResult Execute(int paramSetId)
+        {
+            try
+            {
+                CreateWebLayoutFromResource(paramSetId);
+                var tb = _wl.GetToolBar();
+                return new TestResult(CommonUtility.BooleanToString(tb.IsVisible()), "text/plain");
+            }
+            catch (MgException ex)
+            {
+                return TestResult.FromMgException(ex);
+            }
+        }
+    }
+
+    public class WL_ShowStatusbar : WebLayoutOperationExecutor<WL_ShowStatusbar>
+    {
+        public WL_ShowStatusbar(IWebLayoutCreator layout, string unitTestVm)
+            : base(layout, unitTestVm)
+        {
+
+        }
+
+        public override TestResult Execute(int paramSetId)
+        {
+            try
+            {
+                CreateWebLayoutFromResource(paramSetId);
+                var sb = _wl.GetStatusBar();
+                return new TestResult(CommonUtility.BooleanToString(sb.IsVisible()), "text/plain");
+            }
+            catch (MgException ex)
+            {
+                return TestResult.FromMgException(ex);
+            }
+        }
+    }
+
+    public class WL_ShowTaskpane : WebLayoutOperationExecutor<WL_ShowTaskpane>
+    {
+        public WL_ShowTaskpane(IWebLayoutCreator layout, string unitTestVm)
+            : base(layout, unitTestVm)
+        {
+
+        }
+
+        public override TestResult Execute(int paramSetId)
+        {
+            try
+            {
+                CreateWebLayoutFromResource(paramSetId);
+                var tp = _wl.GetTaskPane();
+                return new TestResult(CommonUtility.BooleanToString(tp.IsVisible()), "text/plain");
+            }
+            catch (MgException ex)
+            {
+                return TestResult.FromMgException(ex);
+            }
+        }
+    }
+
+    public class WL_ShowTaskbar : WebLayoutOperationExecutor<WL_ShowTaskbar>
+    {
+        public WL_ShowTaskbar(IWebLayoutCreator layout, string unitTestVm)
+            : base(layout, unitTestVm)
+        {
+
+        }
+
+        public override TestResult Execute(int paramSetId)
+        {
+            try
+            {
+                CreateWebLayoutFromResource(paramSetId);
+                var tp = _wl.GetTaskPane();
+                var tb = tp.GetTaskBar();
+                return new TestResult(CommonUtility.BooleanToString(tb.IsVisible()), "text/plain");
+            }
+            catch (MgException ex)
+            {
+                return TestResult.FromMgException(ex);
+            }
+        }
+    }
+
+    public class WL_ShowLegend : WebLayoutOperationExecutor<WL_ShowLegend>
+    {
+        public WL_ShowLegend(IWebLayoutCreator layout, string unitTestVm)
+            : base(layout, unitTestVm)
+        {
+
+        }
+
+        public override TestResult Execute(int paramSetId)
+        {
+            try
+            {
+                CreateWebLayoutFromResource(paramSetId);
+                var ip = _wl.GetInformationPane();
+                return new TestResult(CommonUtility.BooleanToString(ip.IsLegendBandVisible()), "text/plain");
+            }
+            catch (MgException ex)
+            {
+                return TestResult.FromMgException(ex);
+            }
+        }
+    }
+
+    public class WL_ShowProperties : WebLayoutOperationExecutor<WL_ShowProperties>
+    {
+        public WL_ShowProperties(IWebLayoutCreator layout, string unitTestVm)
+            : base(layout, unitTestVm)
+        {
+
+        }
+
+        public override TestResult Execute(int paramSetId)
+        {
+            try
+            {
+                CreateWebLayoutFromResource(paramSetId);
+                var ip = _wl.GetInformationPane();
+                return new TestResult(CommonUtility.BooleanToString(ip.IsPropertiesBandVisible()), "text/plain");
+            }
+            catch (MgException ex)
+            {
+                return TestResult.FromMgException(ex);
+            }
+        }
+    }
+
+    public class WL_GetTaskPaneWidth : WebLayoutOperationExecutor<WL_GetTaskPaneWidth>
+    {
+        public WL_GetTaskPaneWidth(IWebLayoutCreator layout, string unitTestVm)
+            : base(layout, unitTestVm)
+        {
+
+        }
+
+        public override TestResult Execute(int paramSetId)
+        {
+            try
+            {
+                CreateWebLayoutFromResource(paramSetId);
+                var tp = _wl.GetTaskPane();
+                return new TestResult(tp.GetWidth().ToString(), "text/plain");
+            }
+            catch (MgException ex)
+            {
+                return TestResult.FromMgException(ex);
+            }
+        }
+    }
+
+    public class WL_GetInformationPaneWidth : WebLayoutOperationExecutor<WL_GetInformationPaneWidth>
+    {
+        public WL_GetInformationPaneWidth(IWebLayoutCreator layout, string unitTestVm)
+            : base(layout, unitTestVm)
+        {
+
+        }
+
+        public override TestResult Execute(int paramSetId)
+        {
+            try
+            {
+                CreateWebLayoutFromResource(paramSetId);
+                var ip = _wl.GetInformationPane();
+                return new TestResult(ip.GetWidth().ToString(), "text/plain");
+            }
+            catch (MgException ex)
+            {
+                return TestResult.FromMgException(ex);
+            }
+        }
+    }
+
+    public class WL_GetInitialTaskUrl : WebLayoutOperationExecutor<WL_GetInitialTaskUrl>
+    {
+        public WL_GetInitialTaskUrl(IWebLayoutCreator layout, string unitTestVm)
+            : base(layout, unitTestVm)
+        {
+
+        }
+
+        public override TestResult Execute(int paramSetId)
+        {
+            try
+            {
+                CreateWebLayoutFromResource(paramSetId);
+                var tp = _wl.GetTaskPane();
+                return new TestResult(tp.GetInitialTaskUrl(), "text/plain");
+            }
+            catch (MgException ex)
+            {
+                return TestResult.FromMgException(ex);
+            }
+        }
+    }
+
+    public class WL_ShowContextMenu : WebLayoutOperationExecutor<WL_ShowContextMenu>
+    {
+        public WL_ShowContextMenu(IWebLayoutCreator layout, string unitTestVm)
+            : base(layout, unitTestVm)
+        {
+
+        }
+
+        public override TestResult Execute(int paramSetId)
+        {
+            try
+            {
+                CreateWebLayoutFromResource(paramSetId);
+                var ctx = _wl.GetContextMenu();
+                return new TestResult(CommonUtility.BooleanToString(ctx.IsVisible()), "text/plain");
+            }
+            catch (MgException ex)
+            {
+                return TestResult.FromMgException(ex);
+            }
+        }
+    }
+
+    public class WL_TestUiItem : WebLayoutOperationExecutor<WL_TestUiItem>
+    {
+        public WL_TestUiItem(IWebLayoutCreator layout, string unitTestVm)
+            : base(layout, unitTestVm)
+        {
+
+        }
+
+        public override TestResult Execute(int paramSetId)
+        {
+            try
+            {
+                CreateWebLayoutFromResource(paramSetId);
+
+                MgWebWidgetCollection coll = null;
+                var param = new NameValueCollection();
+                _unitTestVm.ReadParameterValue(paramSetId, "CONTAINER", param);
+                _unitTestVm.ReadParameterValue(paramSetId, "INDEX", param);
+
+                switch (param["CONTAINER"])
+                {
+                    case "toolbar":
+                        var tb = _wl.GetToolBar();
+                        coll = tb.GetWidgets();
+                        break;
+                    case "tasklist":
+                        var tp = _wl.GetTaskPane();
+                        var tbar = tp.GetTaskBar();
+                        coll = tbar.GetTaskList();
+                        break;
+                    case "contextmenu":
+                        coll = _wl.GetContextMenu();
+                        break;
+                }
+
+                var widget = coll.GetWidget(Convert.ToInt32(param["INDEX"]));
+                if (widget == null)
+                    return new TestResult("Null widget", "text/plain");
+                else
+                    return new TestResult(FormatProperties(widget), "text/plain");
+            }
+            catch (MgException ex)
+            {
+                return TestResult.FromMgException(ex);
+            }
+        }
+    }
+
+    public class WL_HomeTooltip : WebLayoutOperationExecutor<WL_HomeTooltip>
+    {
+        public WL_HomeTooltip(IWebLayoutCreator layout, string unitTestVm)
+            : base(layout, unitTestVm)
+        {
+
+        }
+
+        public override TestResult Execute(int paramSetId)
+        {
+            try
+            {
+                CreateWebLayoutFromResource(paramSetId);
+                var tp = _wl.GetTaskPane();
+                var tbar = tp.GetTaskBar();
+                var tbuttons = tbar.GetTaskButtons();
+                var home = (MgWebTaskBarWidget)tbuttons.GetWidget(MgWebTaskButtonType.Home);
+                return new TestResult(home.GetTooltip(), "text/plain");
+            }
+            catch (MgException ex)
+            {
+                return TestResult.FromMgException(ex);
+            }
+        }
+    }
+
+    public class WL_HomeDescription : WebLayoutOperationExecutor<WL_HomeDescription>
+    {
+        public WL_HomeDescription(IWebLayoutCreator layout, string unitTestVm)
+            : base(layout, unitTestVm)
+        {
+
+        }
+
+        public override TestResult Execute(int paramSetId)
+        {
+            try
+            {
+                CreateWebLayoutFromResource(paramSetId);
+                var tp = _wl.GetTaskPane();
+                var tbar = tp.GetTaskBar();
+                var tbuttons = tbar.GetTaskButtons();
+                var home = (MgWebTaskBarWidget)tbuttons.GetWidget(MgWebTaskButtonType.Home);
+                return new TestResult(home.GetDescription(), "text/plain");
+            }
+            catch (MgException ex)
+            {
+                return TestResult.FromMgException(ex);
+            }
+        }
+    }
+
+    public class WL_BackTooltip : WebLayoutOperationExecutor<WL_BackTooltip>
+    {
+        public WL_BackTooltip(IWebLayoutCreator layout, string unitTestVm)
+            : base(layout, unitTestVm)
+        {
+
+        }
+
+        public override TestResult Execute(int paramSetId)
+        {
+            try
+            {
+                CreateWebLayoutFromResource(paramSetId);
+                var tp = _wl.GetTaskPane();
+                var tbar = tp.GetTaskBar();
+                var tbuttons = tbar.GetTaskButtons();
+                var back = (MgWebTaskBarWidget)tbuttons.GetWidget(MgWebTaskButtonType.Back);
+                return new TestResult(back.GetTooltip(), "text/plain");
+            }
+            catch (MgException ex)
+            {
+                return TestResult.FromMgException(ex);
+            }
+        }
+    }
+
+    public class WL_BackDescription : WebLayoutOperationExecutor<WL_BackDescription>
+    {
+        public WL_BackDescription(IWebLayoutCreator layout, string unitTestVm)
+            : base(layout, unitTestVm)
+        {
+
+        }
+
+        public override TestResult Execute(int paramSetId)
+        {
+            try
+            {
+                CreateWebLayoutFromResource(paramSetId);
+                var tp = _wl.GetTaskPane();
+                var tbar = tp.GetTaskBar();
+                var tbuttons = tbar.GetTaskButtons();
+                var back = (MgWebTaskBarWidget)tbuttons.GetWidget(MgWebTaskButtonType.Back);
+                return new TestResult(back.GetDescription(), "text/plain");
+            }
+            catch (MgException ex)
+            {
+                return TestResult.FromMgException(ex);
+            }
+        }
+    }
+
+    public class WL_ForwardTooltip : WebLayoutOperationExecutor<WL_ForwardTooltip>
+    {
+        public WL_ForwardTooltip(IWebLayoutCreator layout, string unitTestVm)
+            : base(layout, unitTestVm)
+        {
+
+        }
+
+        public override TestResult Execute(int paramSetId)
+        {
+            try
+            {
+                CreateWebLayoutFromResource(paramSetId);
+                var tp = _wl.GetTaskPane();
+                var tbar = tp.GetTaskBar();
+                var tbuttons = tbar.GetTaskButtons();
+                var fwd = (MgWebTaskBarWidget)tbuttons.GetWidget(MgWebTaskButtonType.Forward);
+                return new TestResult(fwd.GetTooltip(), "text/plain");
+            }
+            catch (MgException ex)
+            {
+                return TestResult.FromMgException(ex);
+            }
+        }
+    }
+
+    public class WL_ForwardDescription : WebLayoutOperationExecutor<WL_ForwardDescription>
+    {
+        public WL_ForwardDescription(IWebLayoutCreator layout, string unitTestVm)
+            : base(layout, unitTestVm)
+        {
+
+        }
+
+        public override TestResult Execute(int paramSetId)
+        {
+            try
+            {
+                CreateWebLayoutFromResource(paramSetId);
+                var tp = _wl.GetTaskPane();
+                var tbar = tp.GetTaskBar();
+                var tbuttons = tbar.GetTaskButtons();
+                var fwd = (MgWebTaskBarWidget)tbuttons.GetWidget(MgWebTaskButtonType.Forward);
+                return new TestResult(fwd.GetDescription(), "text/plain");
+            }
+            catch (MgException ex)
+            {
+                return TestResult.FromMgException(ex);
+            }
+        }
+    }
+
+    public class WL_TasksName : WebLayoutOperationExecutor<WL_TasksName>
+    {
+        public WL_TasksName(IWebLayoutCreator layout, string unitTestVm)
+            : base(layout, unitTestVm)
+        {
+
+        }
+
+        public override TestResult Execute(int paramSetId)
+        {
+            try
+            {
+                CreateWebLayoutFromResource(paramSetId);
+                var tp = _wl.GetTaskPane();
+                var tbar = tp.GetTaskBar();
+                var tbuttons = tbar.GetTaskButtons();
+                var tasks = (MgWebTaskBarWidget)tbuttons.GetWidget(MgWebTaskButtonType.Tasks);
+                return new TestResult(tasks.GetName(), "text/plain");
+            }
+            catch (MgException ex)
+            {
+                return TestResult.FromMgException(ex);
+            }
+        }
+    }
+
+    public class WL_TasksTooltip : WebLayoutOperationExecutor<WL_TasksTooltip>
+    {
+        public WL_TasksTooltip(IWebLayoutCreator layout, string unitTestVm)
+            : base(layout, unitTestVm)
+        {
+
+        }
+
+        public override TestResult Execute(int paramSetId)
+        {
+            try
+            {
+                CreateWebLayoutFromResource(paramSetId);
+                var tp = _wl.GetTaskPane();
+                var tbar = tp.GetTaskBar();
+                var tbuttons = tbar.GetTaskButtons();
+                var tasks = (MgWebTaskBarWidget)tbuttons.GetWidget(MgWebTaskButtonType.Tasks);
+                return new TestResult(tasks.GetTooltip(), "text/plain");
+            }
+            catch (MgException ex)
+            {
+                return TestResult.FromMgException(ex);
+            }
+        }
+    }
+
+    public class WL_TasksDescription : WebLayoutOperationExecutor<WL_TasksDescription>
+    {
+        public WL_TasksDescription(IWebLayoutCreator layout, string unitTestVm)
+            : base(layout, unitTestVm)
+        {
+
+        }
+
+        public override TestResult Execute(int paramSetId)
+        {
+            try
+            {
+                CreateWebLayoutFromResource(paramSetId);
+                var tp = _wl.GetTaskPane();
+                var tbar = tp.GetTaskBar();
+                var tbuttons = tbar.GetTaskButtons();
+                var tasks = (MgWebTaskBarWidget)tbuttons.GetWidget(MgWebTaskButtonType.Tasks);
+                return new TestResult(tasks.GetDescription(), "text/plain");
+            }
+            catch (MgException ex)
+            {
+                return TestResult.FromMgException(ex);
+            }
+        }
+    }
+}

Modified: trunk/MgDev/UnitTest/WebTier/DotNet/TestMapGuideApi/WebLayout/WebLayoutOperationExecutor.cs
===================================================================
--- trunk/MgDev/UnitTest/WebTier/DotNet/TestMapGuideApi/WebLayout/WebLayoutOperationExecutor.cs	2013-07-02 15:49:52 UTC (rev 7655)
+++ trunk/MgDev/UnitTest/WebTier/DotNet/TestMapGuideApi/WebLayout/WebLayoutOperationExecutor.cs	2013-07-03 14:59:19 UTC (rev 7656)
@@ -8,6 +8,11 @@
 
 namespace OSGeo.MapGuide.Test.Operations
 {
+    public interface IWebLayoutCreator
+    {
+        MgWebLayout CreateWebLayout(MgResourceIdentifier resId);
+    }
+
     /// <summary>
     /// The base class of all test executors using the MgWebLayout
     /// </summary>
@@ -15,11 +20,74 @@
     public abstract class WebLayoutOperationExecutor<T> : PlatformApiTestExecutor
     {
         protected MgWebLayout _wl;
+        protected IWebLayoutCreator _creator;
 
-        protected WebLayoutOperationExecutor(MgWebLayout wl, string unitTestVm)
+        protected WebLayoutOperationExecutor(IWebLayoutCreator wl, string unitTestVm)
             : base(typeof(T).Name.ToUpper(), ApiTypes.Platform, unitTestVm)
         {
-            _wl = wl;
+            _creator = wl;
         }
+
+        protected void CreateWebLayoutFromResource(int paramSetId)
+        {
+            if (_wl != null)
+                return;
+
+            _unitTestVm.Execute("Select ParamValue from Params WHERE ParamSet={0} AND ParamName=\"WEBLAYOUT\"", paramSetId);
+            string wlId = _unitTestVm.GetString("ParamValue");
+            if (string.IsNullOrEmpty(wlId))
+            {
+                wlId = "Library://UnitTest/layouts/Test.WebLayout";
+            }
+            MgResourceIdentifier resId = new MgResourceIdentifier(wlId);
+            _wl = _creator.CreateWebLayout(resId);
+        }
+
+        protected string FormatProperties(MgWebWidget it)
+        {
+            string name = "";
+            switch (it.GetType())
+            { 
+                case MgWebWidgetType.Separator:
+                    name = "";
+                    break;
+                case MgWebWidgetType.Command:
+                    var cmd = ((MgWebCommandWidget)it).GetCommand();
+                    name = cmd.GetLabel();
+                    break;
+                case MgWebWidgetType.Flyout:
+                    name = ((MgWebFlyoutWidget)it).GetLabel();
+                    break;
+            }
+
+            string str = "[" + name + "/" + it.GetType();
+            if (it.GetType() == MgWebWidgetType.Separator)
+            {
+                return str + "]";
+            }
+            else if (it.GetType() == MgWebWidgetType.Command)
+            {
+                var cmd = ((MgWebCommandWidget)it).GetCommand();
+                return str + "/" + cmd.GetName() + "]";
+            }
+            else if (it.GetType() == MgWebWidgetType.Flyout)
+            {
+                var fly = ((MgWebFlyoutWidget)it);
+                str = str + "/" + fly.GetIconUrl();
+                var coll = fly.GetSubItems();
+                for (int i = 0; i < coll.GetCount(); i++)
+                {
+                    var widget = coll.GetWidget(i);
+                    str = str + "/" + FormatProperties(widget);
+                }
+                str = str + "]";
+            }
+            else
+            {
+                return "[** error **]";
+            }
+
+            return str;
+        }
     }
 }
\ No newline at end of file



More information about the mapguide-commits mailing list