Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 3630674
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 19, 20262026-05-19T00:18:01+00:00 2026-05-19T00:18:01+00:00

I am fiddling around trying to install an application via ClickOnce – with certain

  • 0

I am fiddling around trying to install an application via ClickOnce – with certain minimum permissions. I’d like to unit test to assert that my application does not use any additional functionality disallowed by the wanted security policy.

Can I in my unit test specify that I want to use the specified manifest to regulate permissions, make calls to my library and then assert that no security exceptions are thrown?

If so, how?

Thanks!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-19T00:18:01+00:00Added an answer on May 19, 2026 at 12:18 am

    If you want to unit test (test in isolation) you have to

    • test permissionLogic and you have to
    • test that your contrologic (i.e. MVVM) uses the permission logic.

    Test SecurityManager for permissionLogic

    you can extract the permissionLogic to a class of its own with methods

    public class SecurityManager
    {
     bool IsAllowedToPrint(User user);
     bool IsAllowedToAdminister(User user);
    }
    

    then you write unit tests

     User user = CreateAdimistrator();
     Assert.AreEqual(true, securityManager.IsAllowedToAdminister(user));
    

    Contrologic (i.e. MVVM) uses permission logic

    create a mock-SecurityManager that always allow/disallow functionality.
    and write unit tests for the controller if it reacts as expected.

    var allowEverythingMock = CreateSecurityManagerMockThatAllowsEverything();
    var mvvm = CreateMvvm(allowEverythingMock );
    Assert.IsNotNull(mvvm.GetAdminGui());
    

    I am not shure if there is an easy way to create an integration-test where Click-Once-App actually uses the real SecurityManager and the result gets verified.

    Update after getting more infos on what the goal is

    write unit tests for the controller if it reacts as expected.

    var controller = CreateCreate(Permission.Low);
    
    try
    {
       // File io is not allowed with low permissions
       controller.SaveTextAsFile("HellowWorld", @"c:\temp\UnittestResult.txt");
       Assert.Fail("The Controller should have forbidden this");
    } catch(PermissionException pex) {
       // everything is ok. This specific exception was expected.
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I've been fiddling around with CHESS , which seems like an incredibly useful tool.
I'm fiddling around with the AVCamDemo from Apple. Apart from trying to get my
I'm fiddling around with scala's XML capabilities, trying to produce some xhtml form. Here's
I was fiddling around with the menu bar via Tools->Customize (the menu bar seems
I've been fiddling with ASP.NET MVC since the CTP, and I like a lot
I came across a problem in my current application that required fiddling with the
I recently started fiddling around with as3, which look pretty good, problem is I
After fiddling around with an issue I am having I have come to this
I'm fiddling around with the C/C++ version of Eclipse to build a simple GTK
I'm just fiddling around with user scripts in chrome right now, so please bear

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.