public void Initialize()
 {
     AutoMapperConfigurator.Configure();
     _repositoryMock = new Mock<IRepository<StoredProtocol>>();
     _storedProtocol = new StoredProtocol {}; // TODO insert data 
     _protocol = new Protocol {}; // TODO insert data 
 }
Esempio n. 2
0
        /// <summary>
        /// Method for converting a Protocol to CSV and exporting it as JSON
        /// </summary>
        /// <param name="protocol">The Protocol to be converted and exported</param>
        /// <returns></returns>
        public string ExportCsvFile(Protocol protocol)
        {
            if (protocol == null)
            {
                throw new ArgumentNullException(nameof(protocol));
        }

            return JsonConvert.SerializeObject(CsvConverter.Convert(protocol));
        }
Esempio n. 3
0
 /// <summary>
 ///     Creates the rows of the CSV file. The Rows are based on the data kept in the fields of a Study and its Phases
 /// </summary>
 /// <param name="protocol">The given protocol to be exported</param>
 /// <param name="builder">The given StringBuilder which appends the string to be exported</param>
 private static void CreateRows(Protocol protocol, StringBuilder builder)
 {
     var i = 1;
     AppendCriteria(protocol.ExclusionCriteria, builder);
     AppendCriteria(protocol.InclusionCriteria, builder);
     foreach (var phase in protocol.StudyPhases)
     {
         builder.Append($"{protocol.StudyName};{protocol.StudyDescription};Phase{i++};");
         AppendRoles(phase.AssignedRole, builder);
     }
 }
Esempio n. 4
0
        /// <summary>
        ///     Converts the given Protocol to a string using the CSV format which can be exported by an ExportHandler
        /// </summary>
        /// <param name="protocol">The Protocol which is to be exported</param>
        /// <returns></returns>
        public static string Convert(Protocol protocol)
        {
            if (protocol == null)
            {
                throw new ArgumentNullException(null, "The given Protocol cannot be null");
            }
            var builder = new StringBuilder();

            CreateColumns(builder);
            CreateRows(protocol, builder);

            return builder.ToString();
        }
 public static void UpdateProtocol(Protocol protocol)
 {
 }
 public static void ReadProtocol(Protocol protocol)
 {
 }