anchor.diff:    TFHIRUtilityTests = Class (TObject)
     private
     public
  +    [TestCase] Procedure TestZipPartCreation;
       [TestCase] Procedure TestZipGeneration;
     end;
   
  
positive.code: 
  { TFHIRAttachmentHelper }
  
  Function GetExtForMimeType(mimeType: String): String;
  Var
    fReg: TRegistry;
    ts : TStringList;
    s : String;
  Begin
    mimeType := lowercase(mimeType);
    if (mimeType = 'text/css') Then
      result := '.css'
    Else if mimeType = 'image/x-icon' Then
      result := '.ico'
    Else if mimeType = 'image/png' Then
      result := '.png'
    Else if mimeType = 'image/gif' Then
      result := '.gif'
    Else if mimeType = 'image/jpeg' Then
      result := '.jpg'
    Else if mimeType = 'video/mpeg' Then
      result := '.mpg'
    Else if mimeType = 'text/javascript' Then
      result := '.js'
    Else
    Begin
      Try
        fReg := TRegistry.Create;
        Try
          fReg.RootKey := HKEY_LOCAL_MACHINE;
          fReg.OpenKeyReadOnly('Software\Classes');
          ts := TStringList.Create;
          try
            freg.GetKeyNames(ts);
            fReg.CloseKey;
            for s in ts do
            begin
              fReg.OpenKeyReadOnly('Software\Classes\'+s);
              if freg.ReadString('Content Type').ToLower = mimeType then
                exit('.'+s);
              fReg.CloseKey;
          end;
          finally
            ts.Free;
          end;
        Finally
          freg.Free;
        End;
      Except
      End;
    End;
    If Result = '' Then
      Result := '.bin';
  End;
  
  
  function TFHIRAttachmentHelper.asZipPart(i: integer): TAdvZipPart;
  begin
    result := TAdvZipPart.Create;
    try
      result.Size := Length(data);
      if length(data) > 0 then
        move(result.Data^, data[0], length(data));
      result.Name := title;
      result.Comment := contentType;
      if result.Name = '' then
        result.Name := 'file'+inttostr(i)+GetExtForMimeType(result.Comment);
      result.Link;
    finally
      result.Free;
  
negative.code:   finally
      dr.Free;
    end;
  end;
  
  procedure TFHIRUtilityTests.TestZipPartCreation;
  var
    att : TFhirAttachment;
    p : TAdvZipPart;
  begin
    att := TFHIRAttachment.create;
    try
      att.title := 'test';
      att.data := TEncoding.UTF8.GetBytes('Some test text');
      att.contentType := 'text/plain';
      p := att.asZipPart(0);
      try
        Assert.IsTrue(p.Name = 'test.txt');
        Assert.IsTrue(p.Size > 0);
        Assert.IsTrue(p.Comment = 'text/plain');
      finally
        p.Free;
      end;
    finally
      att.Free;
    end;
  end;
  
  initialization
  