public override void Execute() { NHapi.Base.NormativeDatabase.Instance.OpenNewConnection(ConnectionString); Console.WriteLine("Using Database:{0}", NHapi.Base.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; } }
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 void makeAll_SegmentsCreated_SegmentDefinitionGiven() { // Arrange var baseFolder = GetBaseFolder(); var version = GetVersion(); ConfigurationSettings.XmlFilename = "Mocks\\reverse-nHapi.xml"; var messageTargetFolder = GetTargetFolder("Message"); var groupTargetFolder = GetTargetFolder("Group"); // Act SegmentGenerator.makeAll(baseFolder, version); // Assert // TODO }
public void makeAll_SegmentMSHCreated_SegmentDefinitionGiven() { // Arrange var baseFolder = GetBaseFolder(); var version = GetVersion(); var source = new SegmentProviderMock(); var targetFolder = GetTargetFolder("Segment"); var segment = new SegmentDefinitionContainerMock(); segment.Description = "Message Header"; source.Segments["MSH"] = segment; int fieldCount = 1; AddField(segment.Elements, fieldCount++, "ST", "R", 1, 1, 0, "Field Separator"); AddField(segment.Elements, fieldCount++, "ST", "R", 1, 4, 0, "Encoding Characters"); AddField(segment.Elements, fieldCount++, "HD", "O", 1, 227, 0, "Sending Application"); AddField(segment.Elements, fieldCount++, "HD", "O", 1, 227, 0, "Sending Facility"); AddField(segment.Elements, fieldCount++, "HD", "O", 1, 227, 0, "Receiving Application"); AddField(segment.Elements, fieldCount++, "HD", "O", 1, 227, 0, "Receiving Facility"); AddField(segment.Elements, fieldCount++, "TS", "R", 1, 26, 0, "Date/Time Of Message"); AddField(segment.Elements, fieldCount++, "ST", "O", 1, 40, 0, "Security"); AddField(segment.Elements, fieldCount++, "MSG", "R", 1, 15, 0, "Message Type"); AddField(segment.Elements, fieldCount++, "ST", "R", 1, 20, 0, "Message Control ID"); AddField(segment.Elements, fieldCount++, "PT", "R", 1, 3, 0, "Processing ID"); AddField(segment.Elements, fieldCount++, "VID", "R", 1, 60, 0, "Version ID"); AddField(segment.Elements, fieldCount++, "NM", "O", 1, 15, 0, "Sequence Number"); AddField(segment.Elements, fieldCount++, "ST", "O", 1, 180, 0, "Continuation Pointer"); AddField(segment.Elements, fieldCount++, "ID", "O", 1, 2, 155, "Accept Acknowledgment Type"); AddField(segment.Elements, fieldCount++, "ID", "O", 1, 2, 155, "Application Acknowledgment Type"); AddField(segment.Elements, fieldCount++, "ID", "O", 1, 3, 399, "Country Code"); AddField(segment.Elements, fieldCount++, "ID", "O", 0, 16, 211, "Character Set"); AddField(segment.Elements, fieldCount++, "CE", "O", 1, 250, 0, "Principal Language Of Message"); AddField(segment.Elements, fieldCount++, "ID", "O", 1, 20, 356, "Alternate Character Set Handling Scheme"); AddField(segment.Elements, fieldCount++, "EI", "O", 0, 427, 0, "Message Profile Identifier"); DataProviderFactory.Instance.SetProvider(source); // Act SegmentGenerator.makeAll(baseFolder, version); // Assert Assert.IsTrue(File.Exists($"{targetFolder}MSH.cs")); }