Exemplo n.º 1
0
        public void Execute()
        {
            if (!string.IsNullOrEmpty(ConnectionString))
            {
                ConfigurationSettings.ConnectionString = ConnectionString;
            }

            Console.WriteLine("Using Database:{0}", NormativeDatabase.Instance.Connection.ConnectionString);
            Console.WriteLine("Base Path:{0}", BasePath);

            switch (MessageTypeToBuild)
            {
            case MessageType.All:
                SourceGenerator.MakeAll(BasePath, Version);
                break;

            case MessageType.EventMapping:
                SourceGenerator.MakeEventMapping(BasePath, Version);
                break;

            case MessageType.Segment:
                SegmentGenerator.MakeAll(BasePath, Version);
                break;

            case MessageType.Message:
                MessageGenerator.MakeAll(BasePath, Version);
                break;

            case MessageType.DataType:
                DataTypeGenerator.MakeAll(BasePath, Version);
                break;
            }
        }
        public async Task MakeAll_GeneratesAllDataTypes(string version)
        {
            // Arrange
            var results = new ConcurrentDictionary <string, string>();

            FileAbstraction.UsingImplementation((filePath, bytes) =>
            {
                results.TryAdd(filePath, Encoding.UTF8.GetString(bytes));
            });

            ConfigurationSettings.ConnectionString = this.Configuration.GetConnectionString("Hl7Database");

            // Act
            DataTypeGenerator.MakeAll("basepath", version);

            // Assert
            Assert.IsNotEmpty(results);

            await Verifier.Verify(results)
            .UseTextForParameters(version.Replace(".", string.Empty));
        }