示例#1
0
        public static void Main(string[] args)
        {
            //string fileToLoad = "drugfile_forparsing";
            string fileToLoad = "input_BNF_ertapenem";

            SetJsonConverter();
            string           path             = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location);
            ParseCommand     command          = new ParseCommand(path + "\\" + fileToLoad + ".json");
            DrugsInput       parsedInput      = command.Execute();
            SerializeCommand serializeCommand = new SerializeCommand(parsedInput);
            string           resultJson       = serializeCommand.Execute();

            WriteJsonToFile(resultJson);
        }
示例#2
0
        public void ValidDrugInput_Serialize_Success()
        {
            // Arrange
            IList <Drug> drugs = new List <Drug> {
                DrugFactory.GetDrug("testname1", "testIndication1", "testRoute"),
                DrugFactory.GetDrug("testname2", "testIndication2", "testRoute")
            };
            DrugsInput input = new DrugsInput {
                Drugs = drugs
            };
            SerializeCommand command = new SerializeCommand(input);

            // Act
            var result = command.Execute();

            // Assert
            Assert.Contains("testname1", result);
            Assert.Contains("testIndication1", result);
            Assert.Contains("testname2", result);
            Assert.Contains("testIndication2", result);
            Assert.DoesNotContain("testRoute", result);
            Assert.Contains("TestRoute", result);
        }