Esempio n. 1
0
        private async Task CreateProject()
        {
            // Arrange
            var view  = nameof(ProjectView).ToLower();
            var input = new TestProjectModel()
            {
                Name = "Testproject"
            };

            // Act
            var text   = await new HttpTestClient().Post(_token, view, input);
            var output = JsonConvert.DeserializeObject <ProjectView>(text);

            _projectId = (Guid)output?.ProjectId;

            // Assert
            Assert.AreEqual(output.Name, input.Name, "Testproject not created correctly");
        }
Esempio n. 2
0
        /// <summary>
        /// Update project detail
        /// </summary>
        internal void UpdateProjectData()
        {
            var    testRepository = mongoRepository.GetTestProjectRepository;
            string projectName    = ConfigurationManager.AppSettings["ProjectName"];
            string regulatory     = ConfigurationManager.AppSettings["Regulator"];
            bool   isActive       = bool.Parse(ConfigurationManager.AppSettings["IsActive"]);

            if ((projectName != null || projectName.Trim() != string.Empty) &&
                (regulatory != null || regulatory.Trim() != string.Empty))
            {
                if (!testRepository.GetAll().Any(a => a.ProjectName == projectName &&
                                                 a.Regulator == regulatory))
                {
                    TestProjectModel testProjectModel = new TestProjectModel()
                    {
                        ProjectName = projectName,
                        Regulator   = regulatory,
                        CreatedDTM  = DateTime.UtcNow
                    };

                    testRepository.Create(testProjectModel);
                }
                else if (testRepository.GetAll().Any(a => a.ProjectName == projectName &&
                                                     a.Regulator != regulatory))
                {
                    TestProjectModel testProjectModel = new TestProjectModel
                    {
                        ProjectName = projectName,
                        Regulator   = regulatory
                    };
                    testRepository.Create(testProjectModel);
                }
                else if (testRepository.IsActive(projectName) != isActive)
                {
                    testRepository.GetId(projectName);
                    testRepository.Update(new TestProjectModel()
                    {
                        IsActive = isActive
                    });
                }
            }
        }