public void Configure()
        {
            var logger = ServicesProvider.GetService <ILoggerFactory>()
                         .CreateLogger <Program>();

            logger.LogDebug("Starting application");
        }
        public void TestReportUnimicroUserNotMappedException(int userId, int unitId)
        {
            var externalSystemFactory = ServicesProvider.GetService <IExternalSystemFactory>();

            var entityMapService = A.Fake <IEntityMapService>();

            A.CallTo(() => entityMapService.SearchEntityMaps(A <SearchQueryEntityMap> .Ignored))
            .Returns(new List <EntityMap>());
            var currentUserContext = new StaticUserContext(new UserContext {
                UserId = userId
            });
            var timeRegService = new TimeRegServiceBuilder()
                                 .WithExternalSystemFactory(externalSystemFactory)
                                 .WithCurrentUserContext(currentUserContext)
                                 .WithIntegrationService(_integrationService)
                                 .WithValidator(new UnimicroValidator(_integrationService, entityMapService))
                                 .Build();

            ReportController Controller = new ReportController(timeRegService, Mapper);

            // Assert
            Assert.NotNull(Controller);
            var thrownException = Assert.ThrowsAsync <ForbiddenException>(async() => await Controller.GetHourBalance(unitId, 1337));

            Assert.AreEqual("Employee is not mapped", thrownException.Message);
        }
示例#3
0
 public Episode(EpisodeResponse response)
 {
     Id                 = response.Id;
     Title              = response.Title;
     Description        = response.Description;
     Published          = response.Published;
     Duration           = response.Duration;
     Url                = response.Url;
     listenLaterService = ServicesProvider.GetService <ListenLaterService>();
     IsInListenLater    = listenLaterService.IsInListenLater(this);
 }
示例#4
0
    public async Task <bool> HasWifiOrCanPlayWithOutWifiAsync()
    {
#if __MACCATALYST__
        var connectivity = ServicesProvider.GetService <Platforms.MacCatalyst.ConnectivityService>();
        return(await connectivity.IsConnected());
#else
        if (Config.Desktop)
        {
            return(true);
        }

        var canPlayMusic = false;
        var current      = Connectivity.NetworkAccess;

        if (current != NetworkAccess.Internet)
        {
            await Shell.Current.DisplayAlert("Not internet", "Check your connection", "close");
        }
        else
        {
            var profiles = Connectivity.ConnectionProfiles;
            var hasWifi  = profiles.Contains(ConnectionProfile.WiFi);

            if (!Settings.IsWifiOnlyEnabled || hasWifi)
            {
                canPlayMusic = true;
            }
            else
            {
                await Shell.Current.DisplayAlert("You need wifi", "Go to Settings to desactivate this option", "close");
            }
        }

        return(canPlayMusic);
#endif
    }
示例#5
0
 /// <summary>
 ///
 /// </summary>
 /// <returns></returns>
 public InlineKeyboardButtonBuilder CreateInlineKeyboardButtonBuilder()
 {
     return(ServicesProvider.GetService <InlineKeyboardButtonBuilder>());
 }
示例#6
0
 public Player()
 {
     InitializeComponent();
     this.playerService = ServicesProvider.GetService <PlayerService>();
     this.IsVisible     = false;
 }
示例#7
0
 public static object GetService(Type type)
 {
     return(ServicesProvider.GetService(type));
 }
示例#8
0
 public static TService GetService <TService>() where TService : class
 {
     return(ServicesProvider.GetService <TService>());
 }