Ejemplo n.º 1
0
 public static bool RequiresAssignedNationalSocieties(this _Role r) =>
 r == _Role.SystemCoordinator ||
 r == _Role.DataCoordinator;
Ejemplo n.º 2
0
 public static bool RequiresLocation(this _Role r) =>
 r == _Role.DataVerifier ||
 r == _Role.DataConsumer;
Ejemplo n.º 3
0
 public static bool RequiresPositionAndDutyStation(this _Role r) =>
 r == _Role.DataOwner;
Ejemplo n.º 4
0
 /// <summary>
 /// Represents if NationalSociety, PrefferedLanguage and MobilePhoneNumbers is mandatory for the given Role r
 /// </summary>
 /// <param name="r">Staff role</param>
 /// <returns>true if mandatory</returns>
 public static bool RequiresExtensiveInfo(this _Role r) =>
 r == _Role.DataOwner ||
 r == _Role.DataCoordinator ||
 r == _Role.SystemCoordinator ||
 r == _Role.DataVerifier;
Ejemplo n.º 5
0
 public static bool RequiresAgeAndSex(this _Role r) =>
 r == _Role.DataVerifier;
Ejemplo n.º 6
0
        public static void GenerateCorrectAddStaffUserCommands()
        {
            StringBuilder sb = new StringBuilder();
            const int     numRegistrations = 100;

            var roleVals = Enum.GetValues(typeof(_Role));


            List <RegisterNewAdminUser>          admins              = new List <RegisterNewAdminUser>();
            List <RegisterNewStaffDataConsumer>  dataConsumers       = new List <RegisterNewStaffDataConsumer>();
            List <RegisterNewDataCoordinator>    dataCoordinator     = new List <RegisterNewDataCoordinator>();
            List <RegisterNewDataOwner>          dataOwners          = new List <RegisterNewDataOwner>();
            List <RegisterNewStaffDataVerifier>  dataVerifiers       = new List <RegisterNewStaffDataVerifier>();
            List <RegisterNewSystemConfigurator> systemConfigurators = new List <RegisterNewSystemConfigurator>();


            for (var i = 0; i < numRegistrations; i++)
            {
                //TODO: Should we depend on _Role?
                //TODO: Maybe create another class to create commands dynamically, like in Domain.Specs
                _Role role = (_Role)roleVals.GetValue(rng.Next(roleVals.Length));

                switch (role)
                {
                case _Role.Admin:
                    admins.Add(CreateRegisterNewAdminUserCommand());
                    break;

                case _Role.DataConsumer:
                    dataConsumers.Add(CreateRegisterNewDataConsumerCommand());
                    break;

                case _Role.DataCoordinator:
                    dataCoordinator.Add(CreateRegisterNewDataCoordinatorCommand());
                    break;

                case _Role.DataOwner:
                    dataOwners.Add(CreateRegisterNewDataOwnerCommand());
                    break;

                case _Role.DataVerifier:
                    dataVerifiers.Add(CreateRegisterNewStaffDataVerifierCommand());
                    break;

                case _Role.SystemCoordinator:
                    systemConfigurators.Add(CreateRegisterNewSystemConfiguratorCommand());
                    break;
                }
            }
            using (var file = File.CreateText("./TestData/Admins.json"))
            {
                file.WriteLine(JsonConvert.SerializeObject(admins, Formatting.Indented));
            }
            using (var file = File.CreateText("./TestData/DataConsumers.json"))
            {
                file.WriteLine(JsonConvert.SerializeObject(dataConsumers, Formatting.Indented));
            }
            using (var file = File.CreateText("./TestData/DataCoordinators.json"))
            {
                file.WriteLine(JsonConvert.SerializeObject(dataCoordinator, Formatting.Indented));
            }
            using (var file = File.CreateText("./TestData/DataOwners.json"))
            {
                file.WriteLine(JsonConvert.SerializeObject(dataOwners, Formatting.Indented));
            }
            using (var file = File.CreateText("./TestData/DataVerifiers.json"))
            {
                file.WriteLine(JsonConvert.SerializeObject(dataVerifiers, Formatting.Indented));
            }
            using (var file = File.CreateText("./TestData/SystemConfigurators.json"))
            {
                file.WriteLine(JsonConvert.SerializeObject(systemConfigurators, Formatting.Indented));
            }
        }