public void ScopeCopyFieldsTest() { // Use the Assert class to test conditions. var resText = "Protected text"; var Id = new EntityId(5, 3); var res = new ScopeRes(); res.Text.Value = resText; res.Id = Id; var outRes = new ScopeRes(); res.AvailableScopes["textRead"].SetFields(outRes, res); // Text has been copied Assert.AreEqual(Id, outRes.Id); // Text has been copied Assert.AreEqual(resText, outRes.Text.Value); // the old text is still there Assert.AreEqual(resText, res.Text.Value); }
public void ScopeCommandsUnauthorizedTest() { // Use the Assert class to test conditions. var resText = "Protected text"; var Id = new EntityId(5, 3); var res = new ScopeRes(); res.Text.Value = resText; res.Id = Id; var grantedSlugs = new string[] { "text" }; Assert.IsFalse(res.AvailableScopes.IsAllowedToExecute("getText", grantedSlugs)); grantedSlugs = new string[] { "textRead" }; Assert.IsFalse(res.AvailableScopes.IsAllowedToExecute("setText", grantedSlugs)); }