public void Create_Update_Delete_App()
        {
            var newApp = new ApplicationType
            {
                app_name             = testData.NewAppName + _rand.Next(99999),
                business_criticality = testData.NewAppCriticality,
                business_owner       = "Jammy Jam",
                business_owner_email = "*****@*****.**",
            };
            var result = _repo.CreateApp(newApp);

            Assert.IsNotNull(result);

            var created = _repo.GetAllApps()
                          .Single(x => x.app_name == newApp.app_name);

            Assert.IsNotNull(created);

            result.app_name             = testData.UpdatedAppName;
            result.business_criticality = testData.UpdatedAppCriticality;

            var updatedApp = _repo.UpdateApp(result);

            Assert.AreEqual(testData.UpdatedAppName, updatedApp.app_name);
            Assert.AreEqual(testData.UpdatedAppCriticality, updatedApp.business_criticality);

            _repo.DeleteApp(
                new ApplicationType {
                app_id = created.app_id
            }
                );

            created = _repo.GetAllApps()
                      .SingleOrDefault(x => x.app_name == newApp.app_name);

            Assert.IsNull(created);
        }
Example #2
0
        public bool CreateApp(ApplicationProfile app)
        {
            var newApp = _veracodeRepository.CreateApp(new ApplicationType
            {
                app_name             = app.application_name,
                business_owner       = app.business_owner,
                business_owner_email = app.business_owner_email,
                business_criticality = VeracodeEnumConverter.Convert(app.criticality),
                policy = app.application_name
            });

            return(_veracodeRepository
                   .GetAllApps()
                   .Any(x => x.app_name == app.application_name));
        }