Exemple #1
0
        public void DoesThePermissionDeserializationReturnJson()
        {
            Role a = new Role()
            {
                roleid      = 99,
                title       = "some text that came from testing",
                permissions = new List <RolePermissions>(),
            };

            a.permissions.Add(new RolePermissions()
            {
                keyid = "Some Role Name",
                value = "Some value to the role name"
            }
                              );
            a.permissions.Add(new RolePermissions()
            {
                keyid = "Some other Role Name",
                value = "Some other value to the role name"
            }
                              );

            var expectedJson = "[{\"keyid\":\"Some Role Name\",\"value\":\"Some value to the role name\"},{\"keyid\":\"Some other Role Name\",\"value\":\"Some other value to the role name\"}]";

            var result = _testRepo.ConvertPermissions(a.permissions);

            Assert.AreEqual(expectedJson, result);
        }