How can i test Access Control in Swift? - ios

Swift Access Control have three type Public,Internal,Private
I can create a project to test if i use Internal or Private
Private can only use in same source file
Internal can only use in same module(or same project)
but how can i test Public?
I don't know how to create two different module to test "Public"
Swift Access Control

Related

KeyVaultClient and KeyVaultCredentials not present in new SDKs

We were using KeyVaultClient and KeyVaultCredentials classes as provided in the SDK -
com.microsoft.azure
azure-keyvault
Recently got a warning that this library is deprecated and is divided into 3 libraries - azure-keyvault-security-certificates, azure-keyvault-security-secrets and azure-keyvault-security-keys but I could not find these classes in any of the libraries. Am I still supposed to use azure-keyvault for these classes?
Depending on what functionality of Key Vault you want to use, instead of a KeyVaultClient you would use a CertificateClient, KeyClient or SecretClient.
For example, you can instantiate a simple client the following way:
KeyClient keyClient = new KeyClientBuilder()
.vaultUrl("<your-key-vault-url>")
.credential(new DefaultAzureCredentialBuilder().build())
.buildClient();
There are many more methods you can use in a client builder to customize the resulting client.
As for a replacement for KeyVaultCredentials, client builders allow you to authenticate the client to be created via the credential() method, so you can choose the way that best fits your solution. For more information on the available credential types and their diffecences you can check the Azure Identity README.

Updating acl file using JS in hyperledger-composer

I am working on hyperledger playground. I have found that the access rules for participants can be specified manually on acl file in hyperledger composer. But is there a way that allows me to add rules to this file using JS?
Example:
There is an organization. It has some assets, and its number of employees is not fixed. As the admin adds new employees, their access rights on these assets is not known beforehand.
Is there a way such that as new employees are added, I can dynamically create rules for them, modifying the .acl file by script?
see the condition property in the reference doc https://hyperledger.github.io/composer/latest/reference/acl_language. As the condition property accepts code, you can invoke functions that exist within your business network .js files, however these functions are not allowed to invoke the composer runtime API. A summary of those functions not allowed can be found here
https://hyperledger.github.io/composer/latest/api/runtime-api
If you try to use them it will throw an error.

Can we share App class in Today- Widget-Extension

I am developing an application where I have to use my some class in Today- Widget-Extension. But I am not getting any way to access those class.
Is it possible to access application class in Today- Widget-Extension.
It is possible. First you need to set targets of your class to both aplication and extension. Second you need to put public keyword to your class. You can read more on that here.

Dynamic Creating Named DataCache programmatically

With
new DataCache("myCacheName");
I can successfully access existing named cached in my managed AzureCacheService.
Using a name which was not created in the management portal raises an DataCacheException telling me that the cache doesnt exist.
Now I want dynamically create a new named DataCaches.
I can't find anything about this in the msdn documentation. Also Neither the DataCache nor the DataCacheFactory api are offering methods for creating
Isn't this supported? Any hints are welcome
Currently , configuration of named cache related properties within a managed cache (which includes creation of named caches, changing it's properties etc) can only be done via Azure portal from within the 'configure' tab. Doing it programmatically is not supported.

How to test a Service Layer in MVC4?

I have a web application with three layers: Web > Services > Core. I've just added a Services.Tests unit tests project and I'm trying to figure out how to get started.
I've added a reference from the Services.Tests project to the Services project. I then created an instance of the Services.service class in my Test class:
[TestClass]
public class CrudTests
{
private readonly SetServices _setService = new SetServices();
[TestMethod]
public void TestMethod()
{
But I got an error about _setService needing a reference to my Core project.
First question: Why do I need to reference my core project if the Services project already references it?
I've added the reference and ran the empty test, which passed. I then tried to call one of the basic methods within my service class:
[TestMethod]
public void TestMethod()
{
_setService.CreateSet("Test Set", "Test Set Details", null);
But I get a providerIncompatileException.
Second question: What is the recommended way to create/use a dedicated test database?
Third question: How do I tell my tests project which database to use?
By parts,
Why do I need to reference my core project if the Services project already references it?
Project references aren't inheritable, as per this answer. The fact that Services has a dependency on Core does not imply that whoever consumes Services needs to know anything about Core, or for that matter uses any logic exclusively defined in Core.
What is the recommended way to create/use a dedicated test database?
It depends entirely on what database, what ORM, what framework, etc. There aren't fixed ways to do it.
How do I tell my tests project which database to use?
In the same way you tell the application to do it: through the configuration. Simply create a DatabaseStub and hard-code the test database information in it.

Resources