예제 #1
0
        public void TestAddGroupPass()
        {
            // Arrange
            int    userID         = 1;
            string groupName      = "12345";
            bool   expectedResult = true;

            // Act + Assert
            Assert.AreEqual(expectedResult, groupManager.AddGroup(userID, groupName));
        }
예제 #2
0
 public ActionResult CreateGroup(Group group)
 {
     ViewBag.Title = "Create New Group";
     try
     {
         if (_groupManager.AddGroup(group))
         {
             return(RedirectToAction("GroupsList", new { message = "Group Added Successfully" }));
         }
     }
     catch (Exception)
     {
         return(View());
     }
     return(View());
 }
        /// <summary>
        /// Parses the json message sent and converts it into a GroupImpl object using a json serializer.
        /// </summary>
        /// <param name="json"> the json message to be parsed.</param>
        /// <exception cref="ArgumentException"> thrown if the json message is null or empty.</exception>
        private void ProcessNewGroupUpdate(string json)
        {
            if (String.IsNullOrEmpty(json))
            {
                throw new ArgumentException("json");
            }

            try
            {
                IGroup newGroup = JsonConvert.DeserializeObject <GroupImpl>(json);
                groupManager.AddGroup(newGroup.GroupId, newGroup.GroupName, newGroup.IsValid);
            }
            catch (Exception exc)
            {
                log.Error(String.Format("Failed to deserialize json [{0}] into new group update. Exception raised [{1}]", json, exc.Message));
            }
        }
예제 #4
0
 public ActionResult AddGroup(Groups group)
 {
     mngr.AddGroup(group);
     return(RedirectToAction("Index"));
 }