Example #1
0
        public void RevertToOriginalValues_SetsIdAndNameToOriginalValues()
        {
            var userGroup = new UserGroupDto {
                Id = Guid.NewGuid(), Name = "some name"
            };

            BindingModel.Populate(new UserGroupDto[0], userGroup);
            BindingModel.Id   = Guid.NewGuid();
            BindingModel.Name = "some other name";

            BindingModel.RevertToOriginalValues();

            Assert.AreEqual(userGroup.Id, BindingModel.Id);
            Assert.AreEqual(userGroup.Name, BindingModel.Name);
        }
Example #2
0
        public void RevertToOriginalValues_SetsSelectedUserGroupBackToOriginalParentUserGroup()
        {
            var suitableParentGroups = new[] { new UserGroupDto {
                                                   Id = Guid.NewGuid(), Name = "some parent"
                                               } };
            var userGroup = new UserGroupDto {
                Id = Guid.NewGuid(), Name = "some name", ParentId = suitableParentGroups[0].Id
            };

            BindingModel.Populate(suitableParentGroups, userGroup);
            BindingModel.SelectedParentUserGroup = BindingModel.SuitableParentUserGroups[0];

            BindingModel.RevertToOriginalValues();

            Assert.AreEqual(BindingModel.SelectedParentUserGroup, BindingModel.SuitableParentUserGroups[1]);
        }
 public void Cancel()
 {
     BindingModel.RevertToOriginalValues();
 }