public void TestResourceGET() { const string TestUsername = "******"; const string RoleName = "CISPro_Admin"; const int TestPageSize = 15; const string TestLanguage = "da"; CswNbtObjClassUser testUser = _createTestUser(TestUsername, RoleName, TestPageSize, TestLanguage); CswNbtResource Resource = new CswNbtResource(); CswNbtAPIGenericRequest Request = new CswNbtAPIGenericRequest("User", testUser.NodeId.PrimaryKey.ToString()); string error = string.Empty; try { CswNbtWebServiceREAD.GetResource(TestData.CswNbtResources, Resource, Request); } catch (Exception ex) { error = ex.Message; } Assert.IsEmpty(error, "GETing a resource failed with exception: " + error); //When CIS-53085 is finished, we may want to consider verifying the prop values at the top of this method is equal to the resource fetched }
public void TestUpdate() { CswNbtObjClassUser TestUser = _createTestUser("Username1", "CISPro_Admin", 15, "en"); CswNbtAPIGenericRequest Request = new CswNbtAPIGenericRequest("User", TestUser.NodeId.PrimaryKey.ToString()); CswNbtResource FetchedResource = new CswNbtResource(); CswNbtWebServiceREAD.GetResource(TestData.CswNbtResources, FetchedResource, Request); CswNbtMetaDataNodeType UserNT = TestData.CswNbtResources.MetaData.getNodeType("User"); CswNbtMetaDataNodeTypeProp UserNameProp = UserNT.getNodeTypeProp("Username"); const string NewFirstName = "EditedFirstName"; FetchedResource.PropertyData.properties["First Name"].values["text"] = NewFirstName; CswNbtAPIGenericRequest EditRequest = new CswNbtAPIGenericRequest("User", TestUser.NodeId.PrimaryKey.ToString()) { ResourceToUpdate = FetchedResource }; CswNbtResource EditedResource = new CswNbtResource(); string error = string.Empty; try { CswNbtWebServiceUPDATE.Edit(TestData.CswNbtResources, EditedResource, EditRequest); } catch (Exception ex) { error = ex.Message; } Assert.IsEmpty(error, "Edit failed with the following exception: " + error); CswNbtObjClassUser EditedUser = TestData.CswNbtResources.Nodes.GetNode(TestUser.NodeId); Assert.AreEqual(EditedUser.FirstNameProperty.Text, NewFirstName, "Test first name did not have the same first name as the one supplied for the API EDIT request"); }