Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
F
FIT-Connect-SDK - .NET
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
FIT-Connect
FIT-Connect-SDK - .NET
Commits
87c3184f
Commit
87c3184f
authored
2 years ago
by
Klaus Fischer
Browse files
Options
Downloads
Patches
Plain Diff
Need to add a new contructor to Attachment class
parent
de77d86a
No related branches found
No related tags found
2 merge requests
!28
773 direct submission status
,
!27
Draft: Issue/830 http header add version
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
E2ETest/StraightForwardTest.cs
+5
-1
5 additions, 1 deletion
E2ETest/StraightForwardTest.cs
FitConnect/SubmissionBuilder.cs
+22
-1
22 additions, 1 deletion
FitConnect/SubmissionBuilder.cs
with
27 additions
and
2 deletions
E2ETest/StraightForwardTest.cs
+
5
−
1
View file @
87c3184f
...
@@ -20,6 +20,10 @@ public class StraightForwardTest : EndToEndTestBase {
...
@@ -20,6 +20,10 @@ public class StraightForwardTest : EndToEndTestBase {
.
WithJsonData
(
@"{""data"":""value""}"
)
.
WithJsonData
(
@"{""data"":""value""}"
)
.
WithAttachments
(
new
Attachment
(
"Test.pdf"
,
"Attachment #1"
),
.
WithAttachments
(
new
Attachment
(
"Test.pdf"
,
"Attachment #1"
),
new
Attachment
(
"Test.pdf"
,
"Attachment #2"
))
new
Attachment
(
"Test.pdf"
,
"Attachment #2"
))
.
WithAttachments
(
new
Attachment
(
"Test.pdf"
,
"Attachment #3"
))
// .WithAttachments("TestForm.pdf", "StreamReader",
// System.Net.Mime.MediaTypeNames.Application.Pdf,
// new FileStream("Test.pdf", FileMode.Open, FileAccess.Read))
.
Build
();
.
Build
();
var
submission
=
Sender
.
SendAsync
(
outgoing
).
Result
;
var
submission
=
Sender
.
SendAsync
(
outgoing
).
Result
;
...
@@ -86,7 +90,7 @@ public class StraightForwardTest : EndToEndTestBase {
...
@@ -86,7 +90,7 @@ public class StraightForwardTest : EndToEndTestBase {
attachments
.
First
().
Filename
.
Should
().
Be
(
"Test.pdf"
);
attachments
.
First
().
Filename
.
Should
().
Be
(
"Test.pdf"
);
attachments
.
TrueForAll
(
a
=>
a
.
Description
?.
StartsWith
(
"Attachment #"
)
??
false
).
Should
()
attachments
.
TrueForAll
(
a
=>
a
.
Description
?.
StartsWith
(
"Attachment #"
)
??
false
).
Should
()
.
BeTrue
();
.
BeTrue
();
attachments
.
Count
.
Should
().
Be
(
3
);
subscriberWithSubmission
.
AcceptSubmissionAsync
().
Wait
();
subscriberWithSubmission
.
AcceptSubmissionAsync
().
Wait
();
}
}
...
...
This diff is collapsed.
Click to expand it.
FitConnect/SubmissionBuilder.cs
+
22
−
1
View file @
87c3184f
...
@@ -19,8 +19,29 @@ public class SubmissionBuilder : ISubmissionWithDestination,
...
@@ -19,8 +19,29 @@ public class SubmissionBuilder : ISubmissionWithDestination,
return
WithAttachments
(
attachments
.
ToArray
());
return
WithAttachments
(
attachments
.
ToArray
());
}
}
public
ISubmissionWithData
WithAttachments
(
string
fileName
,
string
description
,
string
mimeType
,
FileStream
fileStream
)
{
byte
[]
buffer
=
null
;
using
(
fileStream
)
{
buffer
=
new
byte
[
fileStream
.
Length
];
fileStream
.
Read
(
buffer
,
0
,
(
int
)
fileStream
.
Length
);
}
var
attachment
=
new
Attachment
(
fileName
,
description
,
mimeType
)
{
Content
=
buffer
};
return
WithAttachments
(
attachment
);
}
public
ISubmissionWithData
WithAttachments
(
params
Attachment
[]
attachments
)
{
public
ISubmissionWithData
WithAttachments
(
params
Attachment
[]
attachments
)
{
_submissionToSend
.
Attachments
=
attachments
;
_submissionToSend
.
Attachments
??=
new
Attachment
[]
{
};
foreach
(
var
attachment
in
attachments
)
{
_submissionToSend
.
Attachments
=
_submissionToSend
.
Attachments
.
Append
(
attachment
).
ToArray
();
}
return
this
;
return
this
;
}
}
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment