Ejemplo n.º 1
0
        public void SetUp()
        {
            _mpProgramService = new Mock <MPServices.IProgramRepository>();
            _fixture          = new ProgramService(_mpProgramService.Object);

            AutoMapperConfig.RegisterMappings();
        }
Ejemplo n.º 2
0
            public void DD_Get_With_Module_Description_Test()
            {
                string desc = "BSHSI - Outreach & Enrollment";

                ProgramService ps = new ProgramService
                {
                    ProgramDataManager  = new StubProgramDataManager(),
                    Helpers             = new StubHelper(),
                    CommonFormatterUtil = new StubCommonFormatterUtil()
                };

                GetProgramDetailsSummaryRequest request = new GetProgramDetailsSummaryRequest
                {
                    Context        = "NG",
                    ContractNumber = "InHealth001",
                    PatientId      = "",
                    ProgramId      = "",
                    UserId         = "nguser",
                    Version        = 1.0
                };

                GetProgramDetailsSummaryResponse response = ps.Get(request);
                ModuleDetail module = response.Program.Modules.Find(m => m.SourceId == "532b5585a381168abe00042c");
                string       mDesc  = module.Description.Trim();

                Assert.AreEqual(desc, mDesc, true);
            }
Ejemplo n.º 3
0
            public void DD_Get_Action_Objectives_Test()
            {
                ProgramService ps = new ProgramService
                {
                    ProgramDataManager  = new StubProgramDataManager(),
                    Helpers             = new StubHelper(),
                    CommonFormatterUtil = new StubCommonFormatterUtil()
                };

                GetProgramDetailsSummaryRequest request = new GetProgramDetailsSummaryRequest
                {
                    Context        = "NG",
                    ContractNumber = "InHealth001",
                    PatientId      = "",
                    ProgramId      = "",
                    UserId         = "nguser",
                    Version        = 1.0
                };

                GetProgramDetailsSummaryResponse response = ps.Get(request);
                ModuleDetail             module           = response.Program.Modules.Find(m => m.SourceId == "532b5585a381168abe00042c");
                ActionsDetail            action           = module.Actions.Find(a => a.SourceId == "123456789012345678901234");
                List <ObjectiveInfoData> objs             = action.Objectives;

                Assert.IsNotNull(objs);
            }
        public async Task FindAsyncShouldReturnCorrectResultWithFilterAndOrder()
        {
            // Arrange
            var db = this.GetDatabase();

            var firstCourse = new Program {
                Id = 1, Name = "First"
            };
            var secondCourse = new Program {
                Id = 2, Name = "Second"
            };
            var thirdCourse = new Program {
                Id = 3, Name = "Third"
            };

            db.AddRange(firstCourse, secondCourse, thirdCourse);

            await db.SaveChangesAsync();

            var programService = new ProgramService(db);

            // Act
            var result = await programService.FindAsync("t");

            // Assert
            result
            .Should()
            .Match(r => r.ElementAt(0).Id == 3 &&
                   r.ElementAt(1).Id == 1)
            .And
            .HaveCount(2);
        }
    private static async Task Main(string[] args)
    {
        if (args.Length == 1 && args[0] == "install")
        {
            await Console.Out.WriteLineAsync("Running installers...")
            .ConfigureAwait(false);

            var endpointConfiguration = CreateConfiguration();
            endpointConfiguration.EnableInstallers();
            await Endpoint.Create(endpointConfiguration)
            .ConfigureAwait(false);

            return;
        }

        using (var service = new ProgramService())
        {
            // to run interactive from a console or as a windows service
            if (!Environment.UserInteractive)
            {
                Run(service);
                return;
            }

            Console.Title           = "Shipping";
            Console.CancelKeyPress += (sender, e) => { service.OnStop(); };
            service.OnStart(null);
            Console.WriteLine("\r\nPress enter key to stop program\r\n");
            Console.Read();
            service.OnStop();
        }
    }
Ejemplo n.º 6
0
            public void DD_Get_Module_AssignedOn_Test()
            {
                DateTime?time = Convert.ToDateTime("1/1/1999");

                ProgramService ps = new ProgramService
                {
                    ProgramDataManager  = new StubProgramDataManager(),
                    Helpers             = new StubHelper(),
                    CommonFormatterUtil = new StubCommonFormatterUtil()
                };

                GetProgramDetailsSummaryRequest request = new GetProgramDetailsSummaryRequest
                {
                    Context        = "NG",
                    ContractNumber = "InHealth001",
                    PatientId      = "",
                    ProgramId      = "",
                    UserId         = "nguser",
                    Version        = 1.0
                };

                GetProgramDetailsSummaryResponse response = ps.Get(request);
                ModuleDetail module = response.Program.Modules.Find(m => m.SourceId == "532b5585a381168abe00042c");
                DateTime?    mTime  = module.AssignDate;

                Assert.AreEqual(time, mTime);
            }
        /// <summary>
        /// Initializes a new instance of BrowseViewModel class.
        /// </summary>
        public BrowseViewModel(ProgramEditor commandHistory, ProgramEditor commandInput)
        {
            DeclareCommands();

            this.commandInput            = commandInput;
            commandInput.PreviewKeyDown += commandInput_PreviewKeyDown;
            commandInput.TextChanged    += commandInput_TextChanged;

            this.commandHistory = commandHistory;
            commandHistory.PreviewMouseWheel += commandHistory_PreviewMouseWheel;

            MessageList = new MessageList();
            Settings    = DriverSettings.CreateDefaultSettings();

            //this should be removed later on
            manipulator    = new E3JManipulator(DriverSettings.CreateDefaultSettings());
            programService = new ProgramService(manipulator);

            RemotePrograms = new ObservableCollection <RemoteProgram>(new List <RemoteProgram>())
            {
                new RemoteProgram("Pierwszy", 2567, "10-03-15 11:12:56"),
                new RemoteProgram("Wtorek", 1200, "08-06-17 09:34:43"),
                new RemoteProgram("Asd", 45, "17-11-24 04:32:23"),
                new RemoteProgram("qwerty", 52789, "29-09-32 18:14:32")
            };
        }
 private void UpdateStatus()
 {
     foreach (var rec in ProgramService.RecipeService.Items)
     {
         if (rec.IsAbandoned == false)
         {
             if (rec.TestRecords.All(o => o.Status == TestStatus.Abandoned))
             {
                 rec.IsAbandoned = true;
                 ProgramService.RecipeService.SuperUpdate(rec);
             }
         }
     }
     foreach (var pro in ProgramService.Items)
     {
         if (pro.IsInvalid == false)
         {
             if (pro.Recipes.All(o => o.IsAbandoned == true))
             {
                 pro.IsInvalid = true;
                 ProgramService.SuperUpdate(pro);
             }
         }
     }
 }
Ejemplo n.º 9
0
        private void uploadButton_Click(object sender, EventArgs e)
        {
            var programService = new ProgramService(manipulator);
            var program        = new Driver.Program("test");

            program.Content = richTextBoxProgram.Text;
        }
Ejemplo n.º 10
0
            public void Success()
            {
                PutProgramToPatientRequest request = new PutProgramToPatientRequest
                {
                    UserId            = "123456789012345678901234",
                    Context           = "NG",
                    ContractNumber    = "InHealth001",
                    ContractProgramId = "123456789012345678901111",
                    PatientId         = "222256789012345678902222",
                    Token             = "222256789012349999999999",
                    Version           = 1.0
                };

                ProgramService ps = new ProgramService
                {
                    CommonFormatterUtil = new StubCommonFormatterUtil(),
                    Helpers             = new StubHelper(),
                    ProgramDataManager  = new StubProgramDataManager()
                };

                PutProgramToPatientResponse response = ps.Put(request);
                int control = 1;

                Assert.AreEqual(control, response.Outcome.Result);
            }
Ejemplo n.º 11
0
        private ProgramService GetProgramService()
        {
            var userId  = User.Identity.GetUserId();
            var service = new ProgramService(userId);

            return(service);
        }
Ejemplo n.º 12
0
 public ProgramController(SignInManager <ApplicationUser> signInManager, ApplicationDbContext db,
                          ProgramService programService)
 {
     _signInManager  = signInManager;
     _db             = db;
     _programService = programService;
 }
Ejemplo n.º 13
0
        public async Task SignOutTraineeAsyncShouldSaveCorrectDataWithValidProgramIdAndTraineeId()
        {
            // Arrange
            var db             = this.GetDatabase();
            var programService = new ProgramService(db);

            const int    programId = 1;
            const string traineeId = "TestTrainee";

            var program = new Program
            {
                Id        = programId,
                StartDate = DateTime.MaxValue,
                Clients   = new List <TraineeProgram>()
            };

            db.Add(program);
            await db.SaveChangesAsync();

            // Act
            var result = await programService.SignUpUserAsync(programId, traineeId);

            var signOut = await programService.SignOutUserAsync(programId, traineeId);

            // Assert
            result
            .Should()
            .Be(true);

            signOut
            .Should()
            .Be(true);
        }
Ejemplo n.º 14
0
            public void DD_Get_Action_AssignedBy_Test()
            {
                string         ctrl = "123456789011111111112233";
                ProgramService ps   = new ProgramService
                {
                    ProgramDataManager  = new StubProgramDataManager(),
                    Helpers             = new StubHelper(),
                    CommonFormatterUtil = new StubCommonFormatterUtil()
                };

                GetProgramDetailsSummaryRequest request = new GetProgramDetailsSummaryRequest
                {
                    Context        = "NG",
                    ContractNumber = "InHealth001",
                    PatientId      = "",
                    ProgramId      = "",
                    UserId         = "nguser",
                    Version        = 1.0
                };

                GetProgramDetailsSummaryResponse response = ps.Get(request);
                ModuleDetail  module = response.Program.Modules.Find(m => m.SourceId == "532b5585a381168abe00042c");
                ActionsDetail action = module.Actions.Find(a => a.SourceId == "123456789012345678901234");

                Assert.AreEqual(ctrl, action.AssignBy);
            }
Ejemplo n.º 15
0
        private void runButton_Click(object sender, EventArgs e)
        {
            var programService = new ProgramService(manipulator);
            var programs       = programService.ReadProgramInfo();
            var programa       = programService.DownloadProgram(programs[0]);

            programService.RunProgram.programa;
        }
        public void TestGetProgramFromSerivce()
        {
            int programId = 44559;

            IProgramService programService = new ProgramService();
            Program         program        = programService.GetProgramById(programId);

            Assert.IsNotNull(program);
        }
Ejemplo n.º 17
0
    public static void Validate(ProgramService service)
    {
        var type         = service.GetType();
        var bindingFlags = BindingFlags.Instance | BindingFlags.NonPublic;
        var onStart      = type.GetMethod("OnStart", bindingFlags, null, new[] { typeof(string[]) }, null);

        EnsureNotOverriden(onStart);
        var onStop = type.GetMethod("OnStop", bindingFlags);

        EnsureNotOverriden(onStop);
    }
Ejemplo n.º 18
0
        public ActionResult Program()
        {
            if (!UserValid())
            {
                return(RedirectToAction("Index", "Home"));
            }
            ProgramService ProgramSvc = new ProgramService();

            ViewBag.Title = "Program";
            ViewData      = MVCUtil.PopulateCRUDViewData(typeof(program), "Program", ProgramSvc, Request, ViewData);
            return(View("~/Views/Shared/EntityMng.cshtml"));
        }
Ejemplo n.º 19
0
 public MyEventsController(EventService eventService, ProgramService programService,
                           FileService fileService, EmailSender emailSender, IAuthorizationService authorizationService,
                           IMapper mapper, ILogger <MyEventsController> logger)
 {
     _eventService         = eventService;
     _programService       = programService;
     _fileService          = fileService;
     _emailSender          = emailSender;
     _authorizationService = authorizationService;
     _mapper = mapper;
     _logger = logger;
 }
Ejemplo n.º 20
0
 public ProfileController(UserManager <User> userManager, SignInManager <User> signInManager,
                          UserService userService, EventService eventService, RewardService rewardService,
                          ProgramService programService, IMapper mapper, ILogger <ProfileController> logger)
 {
     _userManager    = userManager;
     _signInManager  = signInManager;
     _userService    = userService;
     _eventService   = eventService;
     _rewardService  = rewardService;
     _programService = programService;
     _mapper         = mapper;
     _logger         = logger;
 }
Ejemplo n.º 21
0
 static void Main()
 {
     using var service = new ProgramService();
     if (ServiceHelper.IsService())
     {
         Run(service);
         return;
     }
     service.OnStart(null);
     Console.WriteLine("Bus started. Press any key to exit");
     Console.ReadKey();
     service.OnStop();
 }
        public List <string> GenerateAnalysis(string guidName)
        {
            List <string> stringsToReturn = new List <string>();

            var    assetsRelativePath = @"../../../../DemoMLNet.Task.ObjectDetection.Console/assets";
            string assetsPath         = ProgramService.GetAbsolutePath(assetsRelativePath);
            var    modelFilePath      = Path.Combine(assetsPath, "Model", "TinyYolo2_model.onnx");
            var    imagesFolder       = Path.Combine(assetsPath, "images");
            var    outputFolder       = Path.Combine(assetsPath, "images", "output");

            MLContext mlContext = new MLContext();

            try
            {
                IEnumerable <ImageNetData> images = ImageNetData.ReadFromFile(imagesFolder);
                IDataView imageDataView           = mlContext.Data.LoadFromEnumerable(images);

                var modelScorer = new OnnxModelScorer(imagesFolder, modelFilePath, mlContext);

                // Use model to score data
                IEnumerable <float[]> probabilities = modelScorer.Score(imageDataView);

                YoloOutputParser parser = new YoloOutputParser();

                var boundingBoxes =
                    probabilities
                    .Select(probability => parser.ParseOutputs(probability))
                    .Select(boxes => parser.FilterBoundingBoxes(boxes, 5, .5F));

                for (var i = 0; i < images.Count(); i++)
                {
                    if (images.ElementAt(i).Label == guidName + ".jpg")
                    {
                        string imageFileName = images.ElementAt(i).Label;
                        IList <YoloBoundingBox> detectedObjects = boundingBoxes.ElementAt(i);

                        ProgramService.DrawBoundingBox(imagesFolder, outputFolder, imageFileName, detectedObjects);

                        stringsToReturn = ProgramService.LogDetectedObjects(imageFileName, detectedObjects);
                    }
                    //Console.WriteLine("========= End of Process..Hit any Key ========");
                }
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.ToString());
            }

            return(stringsToReturn);
        }
Ejemplo n.º 23
0
        private async void SendProgram()
        {
            var programService = new ProgramService(manipulator);
            var program        = new Driver.Program("test")
            {
                Content = richTextBoxRead.Text
            };
            await programService.UploadProgram(program);

            var programs = await programService.ReadProgramInfo();

            var programa = await programService.DownloadProgram(programs[0]);

            richTextBoxRead.Text = programa.Content;
        }
Ejemplo n.º 24
0
 static void Main()
 {
     using (var service = new ProgramService())
     {
         // so we can run interactive from Visual Studio or as a windows service
         if (Environment.UserInteractive)
         {
             service.OnStart(null);
             Console.WriteLine("\r\nPress enter key to stop program\r\n");
             Console.Read();
             service.OnStop();
             return;
         }
         Run(service);
     }
 }
Ejemplo n.º 25
0
 static void Main()
 {
     using (ProgramService service = new ProgramService())
     {
         if (Environment.UserInteractive)
         {
             service.OnStart(null);
             Console.WriteLine("Bus created and configured");
             Console.WriteLine("Press any key to exit");
             Console.ReadKey();
             service.OnStop();
             return;
         }
         Run(service);
     }
 }
Ejemplo n.º 26
0
 static void Main()
 {
     using (var service = new ProgramService())
     {
         // so we can run interactive from Visual Studio or as a windows service
         if (Environment.UserInteractive)
         {
             service.OnStart(null);
             Console.WriteLine("\r\nPress enter key to stop program\r\n");
             Console.Read();
             service.OnStop();
             return;
         }
         Run(service);
     }
 }
Ejemplo n.º 27
0
 static void Main()
 {
     using (ProgramService service = new ProgramService())
     {
         if (Environment.UserInteractive)
         {
             service.OnStart(null);
             Console.WriteLine("Bus created and configured");
             Console.WriteLine("Press any key to exit");
             Console.ReadKey();
             service.OnStop();
             return;
         }
         Run(service);
     }
 }
Ejemplo n.º 28
0
        private void Window_Loaded(object sender, RoutedEventArgs e)
        {
            RecordService recordService = new RecordService();

            records = new RecordCollection(recordService.GetAll());

            ProgramService programService = new ProgramService();

            programs = new ProgramCollection(programService.GetAll());

            dgridTvRecord.ItemsSource = records.collecion;
            dgridProgram.ItemsSource  = programs.collecion;

            ChannelService channelService = new ChannelService();

            channels = new ChannelCollection(channelService.GetAll());
        }
Ejemplo n.º 29
0
        public void Test_EnqueueNewRequest()
        {
            MockHttpClient mockHttp = new MockHttpClient();

            mockHttp.PrepareGetAsyncResponse(
                new HttpResponseMessage
            {
                StatusCode = HttpStatusCode.OK
            }
                );

            ProgramService  service = new ProgramService("test/url", mockHttp);
            RequestsManager manager = new RequestsManager(service);

            manager.EnqueueNewRequest();
            Assert.AreEqual(1, manager.TotalActiveRequests());
        }
Ejemplo n.º 30
0
        public ActionResult ProgramSvc()
        {
            bool        Access   = UserValid();
            WebResponse Response = new WebResponse();

            if (!Access || !StringUtil.NotNullAndNotBlank(Request.Form["Action"]))
            {
                return(Json(Response));
            }
            string         Action    = Request.Form["Action"].ToString();
            ProgramService EntitySvc = new ProgramService();

            switch (Action)
            {
            case "List":
                Response = MVCUtil.generateResponseList(EntitySvc, Request, LoggedUser, new string[]
                {
                    "id", "name", "description", "sect_id"
                }, typeof(program));
                break;

            case "Form":
                Response = MVCUtil.generateResponseWithForm(typeof(program), EntitySvc, Request);
                break;

            case "Post":
                program Program = (program)ObjectUtil.FillObjectWithMap(new program(), BaseService.ReqToDict(Request));
                if (Program != null)
                {
                    string[] ObjParamToSend = new string[] {
                        "id", "name", "description", "sect_id"
                    };
                    Response = MVCUtil.UpdateEntity(EntitySvc, Program, ObjParamToSend, Response);
                }
                break;

            case "Delete":
                Response = MVCUtil.DeleteEntity(EntitySvc, Request, Response);
                break;

            default:
                break;
            }
            return(Json(Response));
        }
Ejemplo n.º 31
0
 public static void Main()
 {
     using (var service = new ProgramService())
     {
         // to run interactive from a console or as a windows service
         if (ServiceHelper.IsService())
         {
             Run(service);
             return;
         }
         Console.Title           = "NServiceBusWindowsService";
         Console.CancelKeyPress += (sender, e) => { service.OnStop(); };
         service.OnStart(null);
         Console.WriteLine("\r\nPress enter key to stop program\r\n");
         Console.Read();
         service.OnStop();
     }
 }
Ejemplo n.º 32
0
    static void Main()
    {
        using (var service = new ProgramService())
        {
            if (ServiceHelper.IsService())
            {
                Run(service);
                return;
            }
            Console.Title = "Samples.FirstEndpoint";
            service.OnStart(null);

            Console.WriteLine("\r\nEndpoint created and configured; press any key to stop program\r\n");
            Console.ReadKey();

            service.OnStop();
        }
    }
Ejemplo n.º 33
0
    static void Main()
    {
        Console.Title = "Samples.FirstEndpoint";
        using (ProgramService service = new ProgramService())
        {
            if (Environment.UserInteractive)
            {
                service.OnStart(null);

                Console.WriteLine("\r\nBus created and configured; press any key to stop program\r\n");
                Console.ReadKey();

                service.OnStop();

                return;
            }
            Run(service);
        }
    }