Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MSpec #29

Open
antarr opened this issue Jan 13, 2017 · 0 comments
Open

MSpec #29

antarr opened this issue Jan 13, 2017 · 0 comments

Comments

@antarr
Copy link

antarr commented Jan 13, 2017

Does Smocks support MSpec ? Below is my attempt at using it in MSpec. I'm getting a null reference error on the line that says Smock.Run().

private Establish context = () =>
        {
            SetupMocks();
        };  

        private static void SetupMocks()
        {
            Smock.Run(context =>
            {
                context.Setup(() => StorageUtils.GetContainer("ProximaFileStoreConnectionString", "templates")).Returns(BlobContainer("ProximaFileStoreConnectionString", "templates"));
            });
        }

        private static CloudBlobContainer BlobContainer(string key, string containerName)
        {
            var connectionString = ConfigurationManager.ConnectionStrings[key].ConnectionString;

            var storageAccount = CloudStorageAccount.Parse(connectionString);
            var blobClient = storageAccount.CreateCloudBlobClient();
            var container = blobClient.GetContainerReference(containerName);
            container.CreateIfNotExists();
            var perm = new BlobContainerPermissions { PublicAccess = BlobContainerPublicAccessType.Blob };
            container.SetPermissions(perm);

            return container;
        }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant