Exemple #1
0
 public async Task GetPersons_AsHacker_ShouldReturnBadRequest_WhenUnknownPlant()
 => await ParticipantsControllerTestsHelper.GetPersonsAsync(
     UserType.Hacker,
     TestFactory.UnknownPlant,
     "p",
     HttpStatusCode.BadRequest,
     "is not a valid plant");
        public async Task GetPersons_AsViewer_NoMatchingPersons_ShouldReturnEmptyList()
        {
            // Act
            var proCoSysPersons = await ParticipantsControllerTestsHelper.GetPersonsAsync(
                UserType.Viewer,
                TestFactory.PlantWithAccess,
                "searchStringWithNoMatchingPersons");

            // Assert
            Assert.AreEqual(0, proCoSysPersons.Count);
        }
        public async Task GetPersons_AsViewer_ShouldGetPersons()
        {
            // Act
            var proCoSysPersons = await ParticipantsControllerTestsHelper.GetPersonsAsync(
                UserType.Viewer,
                TestFactory.PlantWithAccess,
                "p");

            // Assert
            Assert.AreEqual(2, proCoSysPersons.Count);
            var proCoSysPerson = proCoSysPersons.First();

            Assert.AreEqual("UserName1", proCoSysPerson.UserName);
            Assert.AreEqual("FirstName1", proCoSysPerson.FirstName);
            Assert.AreEqual("LastName1", proCoSysPerson.LastName);
        }
Exemple #4
0
 public async Task GetPersons_AsHacker_ShouldReturnForbidden_WhenPermissionMissing()
 => await ParticipantsControllerTestsHelper.GetPersonsAsync(
     UserType.Hacker,
     TestFactory.PlantWithAccess,
     "p",
     HttpStatusCode.Forbidden);
Exemple #5
0
 public async Task GetPersons_AsAnonymous_ShouldReturnUnauthorized()
 => await ParticipantsControllerTestsHelper.GetPersonsAsync(
     UserType.Anonymous,
     TestFactory.UnknownPlant,
     "p",
     HttpStatusCode.Unauthorized);