示例#1
0
        static bool CheckSLMigrationLicense(ILogger logger, string activationAppPath, HashSet <string> flags)
        {
            //if the user tries to use the SL Migration edition, we check whether it is allowed or not here even though it has nothing to do with the Xaml Preprocessor because it is the only thing that the user cannot remove from the targets.
            if (!ActivationHelpers.IsFeatureEnabled(Constants.ENTERPRISE_EDITION_FEATURE_ID, flags) && !ActivationHelpers.IsFeatureEnabled(Constants.SL_MIGRATION_EDITION_FEATURE_ID, flags))
            {
                // Display the ActivationApp:
                string explanationToDisplayInActivationApp = string.Format("You need the Silverlight Migration Edition in order to compile Silverlight-compatible projects.");
                string explanationToDisplayInErrorsWindow  = explanationToDisplayInActivationApp + " It can be obtained from http://www.cshtml5.com - Please rebuild the project to try again.";
                ActivationHelpers.DisplayActivationApp(activationAppPath, Constants.SL_MIGRATION_EDITION_FEATURE_ID, explanationToDisplayInActivationApp);

                // If we are in trial mode, we can continue without displaying any errors, otherwise we must stop compilation and raise the error:
                int unused;
                if (TrialHelpers.IsTrial(Constants.SL_MIGRATION_EDITION_FEATURE_ID, out unused) == TrialHelpers.TrialStatus.Running) //Note: we don't check for the enterprise edition since there is no trial for this edition.
                {
                    //do nothing
                    return(true);
                }
                else
                {
                    logger.WriteError(explanationToDisplayInErrorsWindow);
                    return(false);
                }
            }
            return(true);
        }
示例#2
0
        private IObservable <ConnectionResultContainer> ConnectAsync(string localAddress, int port)
        {
            if (localAddress == null)
            {
                return(Observable.Return(new ConnectionResultContainer(ConnectionResult.WifiDisabled)));
            }

            bool hasCustomIpAddress = !string.IsNullOrWhiteSpace(this.userSettings.ServerAddress);

            return(Observable.If(() => hasCustomIpAddress,
                                 Observable.Return(this.userSettings.ServerAddress),
                                 NetworkMessenger.Instance.DiscoverServerAsync(localAddress, port))
                   .SelectMany(address =>
            {
                string password = null;

                // We don't want users that aren't premium or in the trial period to send any
                // existing password
                if (this.userSettings.IsPremium || TrialHelpers.IsInTrialPeriod(AppConstants.TrialTime, this.clock, this.installationDateFetcher))
                {
                    password = string.IsNullOrWhiteSpace(this.userSettings.AdministratorPassword) ?
                               null : this.userSettings.AdministratorPassword;
                }

                return NetworkMessenger.Instance.ConnectAsync(address, port, this.userSettings.UniqueIdentifier, password);
            }));
        }
            public void ExpirationIsOnExactSameTicks()
            {
                var clock = Substitute.For <IClock>();

                clock.Now.Returns(DateTimeOffset.MinValue + AppConstants.TrialTime);

                var installationDateFetcher = Substitute.For <IInstallationDateFetcher>();

                installationDateFetcher.GetInstallationDate().Returns(DateTimeOffset.MinValue);

                Assert.False(TrialHelpers.IsInTrialPeriod(AppConstants.TrialTime, clock, installationDateFetcher));
            }
            public void OneTickBeforeExpirationIsInTrialPeriod()
            {
                var clock = Substitute.For <IClock>();

                clock.Now.Returns(DateTimeOffset.MinValue + AppConstants.TrialTime - TimeSpan.FromTicks(1));

                var installationDateFetcher = Substitute.For <IInstallationDateFetcher>();

                installationDateFetcher.GetInstallationDate().Returns(DateTimeOffset.MinValue);

                Assert.True(TrialHelpers.IsInTrialPeriod(AppConstants.TrialTime, clock, installationDateFetcher));
            }
            public void SmokeTest()
            {
                var clock = Substitute.For <IClock>();

                clock.Now.Returns(DateTimeOffset.MinValue + TimeSpan.FromDays(2));

                var installationDateFetcher = Substitute.For <IInstallationDateFetcher>();

                installationDateFetcher.GetInstallationDate().Returns(DateTimeOffset.MinValue + TimeSpan.FromDays(1));

                Assert.Equal(TimeSpan.FromDays(6), TrialHelpers.GetRemainingTrialTime(TimeSpan.FromDays(7), clock, installationDateFetcher));
            }
            public void ReturnsNegativeValueForExpiredTime()
            {
                var clock = Substitute.For <IClock>();

                clock.Now.Returns(DateTimeOffset.MinValue + TimeSpan.FromDays(8));

                var installationDateFetcher = Substitute.For <IInstallationDateFetcher>();

                installationDateFetcher.GetInstallationDate().Returns(DateTimeOffset.MinValue);

                Assert.Equal(TimeSpan.FromDays(-1), TrialHelpers.GetRemainingTrialTime(TimeSpan.FromDays(7), clock, installationDateFetcher));
            }
        private NetworkMessenger()
        {
            this.gate                   = new SemaphoreSlim(1, 1);
            this.messagePipeline        = new Subject <NetworkMessage>();
            this.disconnected           = new Subject <Unit>();
            this.connectionEstablished  = new Subject <Unit>();
            this.connectionInfoReceived = new Subject <ConnectionInfo>();

            this.client = new Subject <ITcpClient>();

            this.isConnected = this.Disconnected.Select(_ => false)
                               .Merge(this.connectionEstablished.Select(_ => true))
                               .StartWith(false)
                               .Do(x => this.Log().Info("Connection status: {0}", x ? "Connected" : "Disconnected"))
                               .ToProperty(this, x => x.IsConnected);
            var connectConn = this.IsConnected;

            var pipeline = this.client.Select(x => Observable.Defer(() => x.GetStream().ReadNextMessageAsync()
                                                                    .ToObservable())
                                              .Repeat()
                                              .LoggedCatch(this, null, "Error while reading the next network message")
                                              .TakeWhile(m => m != null)
                                              .TakeUntil(this.Disconnected))
                           .Switch()
                           .Publish();

            this.messagePipeline           = pipeline.ObserveOn(RxApp.TaskpoolScheduler);
            this.messagePipelineConnection = pipeline.Connect();

            var pushMessages = this.messagePipeline.Where(x => x.MessageType == NetworkMessageType.Push)
                               .Select(x => x.Payload.ToObject <PushInfo>());

            this.PlaylistChanged = pushMessages.Where(x => x.PushAction == PushAction.UpdateCurrentPlaylist)
                                   .Select(x => x.Content.ToObject <NetworkPlaylist>());

            this.PlaybackStateChanged = pushMessages.Where(x => x.PushAction == PushAction.UpdatePlaybackState)
                                        .Select(x => x.Content["state"].ToObject <NetworkPlaybackState>());

            this.PlaybackTimeChanged = pushMessages.Where(x => x.PushAction == PushAction.UpdateCurrentPlaybackTime)
                                       .Select(x => x.Content["currentPlaybackTime"].ToObject <TimeSpan>());

            var settings = Locator.Current.GetService <UserSettings>();

            if (settings == null)
            {
                throw new InvalidOperationException("No user settings registered!");
            }

            this.accessPermission = pushMessages.Where(x => x.PushAction == PushAction.UpdateAccessPermission)
                                    .Select(x => x.Content["accessPermission"].ToObject <NetworkAccessPermission>())
                                    .Merge(this.connectionInfoReceived.Select(x => x.AccessPermission))
                                    .Select(x => TrialHelpers.GetAccessPermissionForPremiumState(x, settings.IsPremium ||
                                                                                                 TrialHelpers.IsInTrialPeriod(AppConstants.TrialTime)))
                                    .ToProperty(this, x => x.AccessPermission);
            var connectAccessPermission = this.AccessPermission;

            this.guestSystemInfo = pushMessages.Where(x => x.PushAction == PushAction.UpdateGuestSystemInfo)
                                   .Select(x => x.Content.ToObject <GuestSystemInfo>())
                                   .Merge(this.connectionInfoReceived.Select(x => x.GuestSystemInfo))
                                   .ToProperty(this, x => x.GuestSystemInfo);
            var connectGuestSystemInfo = this.GuestSystemInfo;
        }
示例#8
0
        public void OnLoaded()
        {
            //LicenseCheckerBrowserContainer.Visibility = Visibility.Visible;
            bool onLoginPage = Browser.URL == LoginURL;

            if (_needToRedirectAfterLogout)
            {
                if (onLoginPage)
                {
                    _needToRedirectAfterLogout = false;
                    return;
                }
                Browser.LoadURL(LoginURL);
                return;
            }

            if (onLoginPage)
            {
                _wasLogged = IsLogged();
                ButtonGoToLoginPage.Visibility = Visibility.Collapsed;
            }
            else
            {
                MainWindow.ButtonProfil.Visibility = Visibility.Collapsed;
                ButtonKeyActivation.Visibility     = Visibility.Collapsed;
                ButtonHobbyist.Visibility          = Visibility.Collapsed;
                ButtonGoToLoginPage.Visibility     = Visibility.Visible;
            }

            UpdateUsername();
            if (IsLogged())
            {
                // we check activated keys
                if (IsCommercialKeyActivated())
                {
                    OnCommercialKeyActivated();
                    Enable = false;
                }
                // we check for the community key
                else if (IsCommunityKeyActivated())
                {
                    Enable = false;
                }
                // we check for trial versions
                else
                {
                    TrialHelpers.TrialStatus trialStatus;
                    do
                    {
                        trialStatus = TrialHelpers.IsTrial(TrialFeatureID, out _numberOfTrialDaysLeft);
                        switch (trialStatus)
                        {
                        case TrialHelpers.TrialStatus.NotStarted:
                            StartTrial(TrialFeatureID);
                            break;

                        case TrialHelpers.TrialStatus.Running:
                            OnTrialRunning(TrialFeatureID);
                            break;

                        case TrialHelpers.TrialStatus.Expired:
                            OnTrialExpired(TrialFeatureID);
                            break;

                        default:
                            break;
                        }
                    } while (trialStatus == TrialHelpers.TrialStatus.NotStarted);
                }
            }
            else if (_wasLogged)
            {
                if (onLoginPage)
                {
                    LogOut();
                    _needToRedirectAfterLogout = true;
                }
            }
        }
示例#9
0
        public ConnectionFragment()
        {
            var settings    = Locator.Current.GetService <UserSettings>();
            var wifiService = Locator.Current.GetService <IWifiService>();

            this.ViewModel = new ConnectionViewModel(settings, wifiService.GetIpAddress);

            this.WhenActivated(() =>
            {
                var disposable = new CompositeDisposable();

                var connectOrDisconnectCommand = this.ViewModel.WhenAnyValue(x => x.IsConnected)
                                                 .Select(x => x ? (IReactiveCommand)this.ViewModel.DisconnectCommand : this.ViewModel.ConnectCommand);

                connectOrDisconnectCommand.SampleAndCombineLatest(this.ConnectButton.Events().Click, (command, args) => command)
                .Where(x => x.CanExecute(null))
                .Subscribe(x => x.Execute(null))
                .DisposeWith(disposable);

                connectOrDisconnectCommand.SelectMany(x => x.CanExecuteObservable)
                .BindTo(this.ConnectButton, x => x.Enabled)
                .DisposeWith(disposable);

                this.ViewModel.ConnectCommand.IsExecuting
                .CombineLatest(this.ViewModel.WhenAnyValue(x => x.IsConnected), (connecting, connected) =>
                               connected ? Resource.String.disconnect : connecting?Resource.String.connecting: Resource.String.connect)
                .Select(Resources.GetString)
                .BindTo(this.ConnectButton, x => x.Text)
                .DisposeWith(disposable);

                this.ViewModel.ConnectCommand.Select(result =>
                {
                    switch (result.ConnectionResult)
                    {
                    case ConnectionResult.Failed:
                        return(Resources.GetString(Resource.String.connection_failed));

                    case ConnectionResult.ServerVersionToLow:
                        return(string.Format(Resources.GetString(Resource.String.required_server_version), result.ServerVersion.ToString(3)));

                    case ConnectionResult.Successful:
                        {
                            var playlistFragment = new PlaylistFragment();

                            this.FragmentManager.BeginTransaction()
                            .Replace(Resource.Id.ContentFrame, playlistFragment)
                            .Commit();

                            switch (result.AccessPermission)
                            {
                            case NetworkAccessPermission.Admin:
                                return(Resources.GetString(Resource.String.connected_as_admin));

                            case NetworkAccessPermission.Guest:
                                return(Resources.GetString(Resource.String.connected_as_guest));
                            }
                            break;
                        }

                    case ConnectionResult.Timeout:
                        return(Resources.GetString(Resource.String.connection_timeout));

                    case ConnectionResult.WrongPassword:
                        return(Resources.GetString(Resource.String.wrong_password));

                    case ConnectionResult.WifiDisabled:
                        return(Resources.GetString(Resource.String.wifi_enable_error));
                    }

                    throw new InvalidOperationException("This shouldn't happen");
                })
                .ObserveOn(RxApp.MainThreadScheduler)
                .Subscribe(x => Toast.MakeText(this.Activity, x, ToastLength.Long).Show())
                .DisposeWith(disposable);

                TimeSpan remainingTrialTime = TrialHelpers.GetRemainingTrialTime(AppConstants.TrialTime);

                // We don't want to immediately scare the user with the display of the remaining trial period, so give it some time
                bool displayTrialPeriod = !settings.IsPremium && remainingTrialTime < TimeSpan.FromDays(4);
                this.TrialExpirationTextView.Visibility = this.TrialExpirationExplanationTextview.Visibility =
                    displayTrialPeriod ? ViewStates.Visible : ViewStates.Gone;

                if (displayTrialPeriod)
                {
                    string expirationMessage = remainingTrialTime > TimeSpan.Zero ?
                                               Resources.GetString(Resource.String.trial_expiration) :
                                               Resources.GetString(Resource.String.trial_expiration_expired);

                    this.TrialExpirationTextView.Text = string.Format(expirationMessage,
                                                                      remainingTrialTime.Duration().Humanize(culture: new CultureInfo("en-US")));

                    this.TrialExpirationExplanationTextview.Text = Resources.GetString(Resource.String.trial_expiration_explanation);
                }

                return(disposable);
            });
        }
示例#10
0
        public static bool Check(Microsoft.Build.Framework.ITaskItem[] references, string allowedReferencesAsString, string activationAppPath, string flagsString, ILogger logger, bool isBridgeBasedVersion, string nameOfAssembliesThatDoNotContainUserCode, string projectDir, string referencesPaths, string typeForwardingAssemblyPath)
        {
            List <string> referencesThatAreOK            = new List <string>();
            List <string> referencesThatAreNotCompatible = new List <string>();

#if REQUIRE_PRO_EDITION_FOR_REFERENCING_ASSEMBLIES
            List <string> referencesThatRequireToUpgradeToTheProEdition = new List <string>();
#endif
            List <string> referencesThatRequireNewerVersionOfTheCompiler          = new List <string>();
            string        overall_minimumRequiredCompilerVersionFriendlyNameIfAny = null;

            HashSet <string> flags = (flagsString != null ? new HashSet <string>(flagsString.Split(';')) : new HashSet <string>());

            foreach (Microsoft.Build.Framework.ITaskItem taskItem in (references ?? new Microsoft.Build.Framework.ITaskItem[] { }))
            {
                string referencedName          = GetAssemblyNameFromIdentity(taskItem.GetMetadata("identity")); //Note: "GetMetadata" and "GetAssemblyName" never return null.
                string referencedHintPathIfAny = taskItem.GetMetadata("HintPath");                              //Note: "GetMetadata" never return null.

                ResultEnum result;
                string     minimumRequiredCompilerVersionFriendlyNameIfAny;
                IsReferenceAcceptable(referencedName, referencedHintPathIfAny, allowedReferencesAsString, flags, isBridgeBasedVersion, nameOfAssembliesThatDoNotContainUserCode, projectDir, referencesPaths, typeForwardingAssemblyPath, out result, out minimumRequiredCompilerVersionFriendlyNameIfAny);
                switch (result)
                {
                case ResultEnum.ReferenceIsOK:
                    referencesThatAreOK.Add(referencedName);
                    break;

                case ResultEnum.ReferenceIsNotCompatible:
                    referencesThatAreNotCompatible.Add(referencedName);
                    break;

                case ResultEnum.ReferenceRequiresNewerVersionOfTheCompiler:
                    referencesThatRequireNewerVersionOfTheCompiler.Add(referencedName);
                    overall_minimumRequiredCompilerVersionFriendlyNameIfAny = minimumRequiredCompilerVersionFriendlyNameIfAny;
                    break;

#if REQUIRE_PRO_EDITION_FOR_REFERENCING_ASSEMBLIES
                case ResultEnum.ReferenceRequiresToUpgradeToTheProEdition:
                    referencesThatRequireToUpgradeToTheProEdition.Add(referencedName);
                    break;
#endif
                default:
                    throw new NotSupportedException();
                }
            }

            if (referencesThatAreNotCompatible.Count == 1)
            {
                logger.WriteError(string.Format("Please remove the reference \"{0}\" from the Project references.  - Note: a CSHTML5 project can only reference assemblies compiled with CSHTML5. Sometimes Visual Studio automatically adds references such as \"System\" but those references should be removed. Other errors below can be ignored.", referencesThatAreNotCompatible[0]));
                return(false);
            }
            else if (referencesThatAreNotCompatible.Count > 1)
            {
                logger.WriteError(string.Format("Please remove the following references from the Project references: {0}  - Note: a CSHTML5 project can only reference assemblies compiled with CSHTML5. Sometimes Visual Studio automatically adds references such as \"System\" but those references should be removed. Other errors below can be ignored.", string.Join(", ", referencesThatAreNotCompatible)));
                return(false);
            }
            else if (referencesThatRequireNewerVersionOfTheCompiler.Count > 0)
            {
                if (referencesThatRequireNewerVersionOfTheCompiler.Count == 1)
                {
                    logger.WriteError(string.Format("The referenced assembly '{1}' requires a newer version of the CSHTML5 compiler ({0} or newer). You can download it from: http://www.cshtml5.com", overall_minimumRequiredCompilerVersionFriendlyNameIfAny ?? "", referencesThatRequireNewerVersionOfTheCompiler[0]));
                }
                else
                {
                    logger.WriteError(string.Format("The following referenced assemblies require a newer version of the CSHTML5 compiler ({0} or newer): {1}", overall_minimumRequiredCompilerVersionFriendlyNameIfAny ?? "", string.Join(", ", referencesThatRequireNewerVersionOfTheCompiler)));
                }
                return(false);
            }
#if REQUIRE_PRO_EDITION_FOR_REFERENCING_ASSEMBLIES
            else if (referencesThatRequireToUpgradeToTheProEdition.Count > 0)
            {
                // Display the ActivationApp:
                string explanationToDisplayInActivationApp = string.Format("Referencing compiled DLLs such as '{0}' requires the Professional Edition of CSHTML5. You can work around this limitation if you have the source code of '{0}': just add the project to the solution and reference it instead of referencing the compiled DLL. With the Free Edition, projects can reference other projects in the same solution, but they cannot reference external compiled DLLs. Upgrade to the Pro Edition to remove all the limitations.", referencesThatRequireToUpgradeToTheProEdition[0] + ".dll");
                //string explanationToDisplayInActivationApp = string.Format("With the Free Edition, projects can reference other projects in the same solution, but referencing a compiled DLL such as \"{0}\" requires the Professional Edition of C#/XAML for HTML5.", referencesThatRequireToUpgradeToTheProEdition[0] + ".dll");
                string explanationToDisplayInErrorsWindow = explanationToDisplayInActivationApp + " It can be obtained from http://www.cshtml5.com - Please rebuild the project to try again.";
                ActivationHelpers.DisplayActivationApp(activationAppPath, Constants.PROFESSIONAL_EDITION_FEATURE_ID, explanationToDisplayInActivationApp);

                // If we are in trial mode, we can continue without displaying any errors, otherwise we must stop compilation and raise the error:
                int unused;
                if (TrialHelpers.IsTrial(Constants.SL_MIGRATION_EDITION_FEATURE_ID, out unused) == TrialHelpers.TrialStatus.Running)
                {
                    return(true);
                }
                else
                {
                    if (TrialHelpers.IsTrial(Constants.PROFESSIONAL_EDITION_FEATURE_ID, out unused) == TrialHelpers.TrialStatus.Running)
                    {
                        return(true);
                    }
                    else
                    {
                        logger.WriteError(explanationToDisplayInErrorsWindow);
                        return(false);
                    }
                }
            }
#endif
            else
            {
                return(true);
            }
        }
示例#11
0
        public override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);

            this.Activity.ActionBar.SetTitle(Resource.String.settings);

            this.userSettings    = Locator.Current.GetService <UserSettings>();
            this.androidSettings = Locator.Current.GetService <AndroidSettings>();

            this.AddPreferencesFromResource(Resource.Layout.Settings);

            var portPref = (EditTextPreference)this.FindPreference(this.GetString(Resource.String.preference_port));

            portPref.EditText.InputType = InputTypes.ClassNumber;
            portPref.EditText.Events().TextChanged
            .Select(x => Int32.Parse(new string(x.Text.ToArray())))
            .Where(x => !NetworkHelpers.IsPortValid(x))
            .Subscribe(x =>
            {
                portPref.EditText.Error = this.GetString(Resource.String.preference_port_validation_error);
            });
            portPref.BindToSetting(this.userSettings, x => x.Port, x => x.Text, x => int.Parse(x.ToString()), x => x.ToString(), NetworkHelpers.IsPortValid);

            var ipAddressPref = (EditTextPreference)this.FindPreference(this.GetString(Resource.String.preference_ipaddress));

            ipAddressPref.EditText.InputType = InputTypes.ClassPhone;
            ipAddressPref.EditText.Events().TextChanged
            .Select(x => new string(x.Text.ToArray()))
            .Where(x => !IsValidIpAddress(x))
            .Subscribe(x =>
            {
                ipAddressPref.EditText.Error = this.GetString(Resource.String.preference_ipaddress_validation_error);
            });
            ipAddressPref.BindToSetting(this.userSettings, x => x.ServerAddress, x => x.Text, x => (string)x, x => x, IsValidIpAddress);

            var saveEnergyPref = (SwitchPreference)this.FindPreference(this.GetString(Resource.String.preference_save_energy));

            saveEnergyPref.BindToSetting(this.androidSettings, x => x.SaveEnergy, x => x.Checked, x => bool.Parse(x.ToString()));

            var passwordPreference = (EditTextPreference)this.FindPreference(this.GetString(Resource.String.preference_administrator_password));

            passwordPreference.BindToSetting(this.userSettings, x => x.AdministratorPassword, x => x.Text, x => (string)x);
            this.userSettings.WhenAnyValue(x => x.IsPremium, x => x || TrialHelpers.IsInTrialPeriod(AppConstants.TrialTime))
            .BindTo(passwordPreference, x => x.Enabled);

            Preference premiumButton = this.FindPreference(this.GetString(Resource.String.preference_purchase_premium));

            premiumButton.Events().PreferenceClick.Select(_ => this.PurchasePremium().ToObservable()
                                                          .Catch <Unit, Exception>(ex => Observable.Start(() => this.TrackInAppPurchaseException(ex))))
            .Concat()
            .Subscribe();

            Preference restorePremiumButton = this.FindPreference(this.GetString(Resource.String.preference_restore_premium));

            restorePremiumButton.Events().PreferenceClick.Select(_ => this.RestorePremium().ToObservable()
                                                                 .Catch <Unit, Exception>(ex => Observable.Start(() => this.TrackInAppPurchaseException(ex))))
            .Concat()
            .Subscribe();

            Preference versionPreference = this.FindPreference(this.GetString(Resource.String.preference_version));

            versionPreference.Summary = this.Activity.PackageManager.GetPackageInfo(this.Activity.PackageName, 0).VersionName;

            var virtualServerPreference = (SwitchPreference)this.FindPreference(this.GetString(Resource.String.preference_virtual_server));

            virtualServerPreference.Persistent = false;
            virtualServerPreference.Events().PreferenceChange
            .Subscribe(x =>
            {
                if ((bool)x.NewValue)
                {
                    NetworkMessenger.Override(new VirtualNetworkMessenger());
                }

                else
                {
                    NetworkMessenger.ResetOverride();
                }
            });

#if !DEBUG && !DEVELOPMENT
            var developmentCategory = (PreferenceCategory)this.FindPreference(this.GetString(Resource.String.preference_development));

            var screen = (PreferenceScreen)this.FindPreference(this.GetString(Resource.String.preference_main_screen));
            screen.RemovePreference(developmentCategory);
#endif
        }
 public void PremiumAndGuestReturnsGuest()
 {
     Assert.Equal(NetworkAccessPermission.Guest,
                  TrialHelpers.GetAccessPermissionForPremiumState(NetworkAccessPermission.Guest, true));
 }
 public void PremiumAndAdminReturnsAdmin()
 {
     Assert.Equal(NetworkAccessPermission.Admin,
                  TrialHelpers.GetAccessPermissionForPremiumState(NetworkAccessPermission.Admin, true));
 }
 public void NotPremiumAndAdminReturnsGuest()
 {
     Assert.Equal(NetworkAccessPermission.Guest,
                  TrialHelpers.GetAccessPermissionForPremiumState(NetworkAccessPermission.Admin, false));
 }