Skip to content

Commit 7db7f14

Browse files
authored
Merge pull request #154 from signnow/feature/complex-text-tags
SNSP-6514 | Complex Text Tags
2 parents 0fc281e + f370041 commit 7db7f14

21 files changed

+701
-44
lines changed

CHANGELOG.md

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,20 +5,26 @@ The format is based on [Keep a Changelog](http://keepachangelog.com)
55
and this project adheres to [Semantic Versioning](http://semver.org).
66

77
## [Unreleased] - TBD
8+
9+
10+
## [1.2.0] - 2023-07-03
811
### Added
912
- Added Readme and License files to Nuget package
1013
- `OAuth2Service`: added ability to configure token expiration time
1114
- Added OAuth2 service to SignNow service container
1215
- All the services can use custom HttpClient via constructor of class [#148](https://github.com/signnow/SignNow.NET/issues/148)
16+
- Complex Text Tags support while upload document with Fields
1317

1418
### Changed
1519
- `OAuth2Service` moved to `SignNow.Net.Services` namespace
1620

21+
1722
## [1.1.1] - 2023-05-02
1823
### Added
1924
- Properties for sign invite that allows you to prefill text in the Signature field, allows for signers to use their saved signature, allows recipients reassign this invite to another email address, allow recipients decline the invite.
2025
- Add support for field type `stamp` [#149](https://github.com/signnow/SignNow.NET/issues/149)
2126

27+
2228
## [1.1.0] - 2023-01-23
2329
### Added
2430
- The `Thumbnail` property on `Model.SignNowDocument`, which allows you to get document thumbnails in small, medium and large image sizes
@@ -40,6 +46,7 @@ and this project adheres to [Semantic Versioning](http://semver.org).
4046
### Changed
4147
- `FieldJsonAttributes` added to `ISignNowFields` that allows you to get Field attributes
4248

49+
4350
## [0.9.0] - 2021-07-07
4451
### Added
4552
- `IUserService.GetModifiedDocumentsAsync` that allows to get all modified documents for User
@@ -52,11 +59,13 @@ and this project adheres to [Semantic Versioning](http://semver.org).
5259
- `IFolderService.RenameFolderAsync` that allows you to renames a folder.
5360
- `IDocumentService.MoveDocumentAsync` that allows you to move the document to a specified folder.
5461

62+
5563
## [0.8.0] - 2021-04-26
5664
### Added
5765
- `IDocumentService.CreateTemplateFromDocumentAsync` that allows to create template by flattening an existing document
5866
- `IDocumentService.CreateDocumentFromTemplateAsync` that allows to create document from the template
5967

68+
6069
## [0.7.0] - 2021-03-28
6170
### Added
6271
- `ISignInvite.CreateInviteAsync` that allows to create embedded signing invite for a document
@@ -66,6 +75,7 @@ and this project adheres to [Semantic Versioning](http://semver.org).
6675
### Changed
6776
- Changed JsonConverter for `Model.SignNowInvite` properties
6877

78+
6979
## [0.6.0-beta] - 2020-11-17
7080
### Added
7181
- Carbon Copy for freeform invite and role-based invite [#106](https://github.com/signnow/SignNow.NET/issues/106)
@@ -87,6 +97,7 @@ and this project adheres to [Semantic Versioning](http://semver.org).
8797
### Fixed
8898
- Fixed `Models.FieldContents.RadiobuttonContent` converting error [#104](https://github.com/signnow/SignNow.NET/issues/104)
8999

100+
90101
## [0.5.1-beta] - 2020-04-18
91102
### Changed
92103
- Upgraded netcore version from 2.x to 3.x for `SignNow.Net.Test`
@@ -172,8 +183,10 @@ and this project adheres to [Semantic Versioning](http://semver.org).
172183
[create role-based invite]: https://github.com/signnow/SignNow.NET/blob/develop/README.md#create-role-based-invite
173184
[create freeform invite]: https://github.com/signnow/SignNow.NET/blob/develop/README.md#create-freeform-invite
174185

175-
176-
[Unreleased]: https://github.com/signnow/SignNow.NET/compare/1.1.0...HEAD
186+
<!-- Links to compare changes from previous version vs new version -->
187+
[Unreleased]: https://github.com/signnow/SignNow.NET/compare/1.2.0...HEAD
188+
[1.1.1]: https://github.com/signnow/SignNow.NET/compare/1.1.1...1.2.0
189+
[1.1.1]: https://github.com/signnow/SignNow.NET/compare/1.1.0...1.1.1
177190
[1.1.0]: https://github.com/signnow/SignNow.NET/compare/1.0.0...1.1.0
178191
[1.0.0]: https://github.com/signnow/SignNow.NET/compare/0.9.0...1.0.0
179192
[0.9.0]: https://github.com/signnow/SignNow.NET/compare/0.8.0...0.9.0

SignNow.Net.Examples/ExamplesRunner.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ public ExamplesRunner()
8080
/// <summary>
8181
/// Delete test document after test.
8282
/// </summary>
83-
public void DeleteTestDocument(string disposableDocumentId)
83+
private void DeleteTestDocument(string disposableDocumentId)
8484
{
8585
if (string.IsNullOrEmpty(disposableDocumentId))
8686
{
Lines changed: 199 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,199 @@
1+
using System;
2+
using System.Collections.Generic;
3+
using Microsoft.VisualStudio.TestTools.UnitTesting;
4+
using SignNow.Net.Model.ComplexTags;
5+
6+
namespace UnitTests.Models.ComplexTags
7+
{
8+
[TestClass]
9+
public class ComplexTagsTest
10+
{
11+
[TestMethod]
12+
public void ShouldSerializeAttachmentsTag()
13+
{
14+
var tag = new AttachmentTag
15+
{
16+
Height = 100,
17+
Width = 200,
18+
Label = "label_name",
19+
Required = true,
20+
Role = "Role_1",
21+
TagName = "attached document"
22+
};
23+
24+
var expected = @"{
25+
""type"": ""attachments"",
26+
""label"": ""label_name"",
27+
""tag_name"": ""attached document"",
28+
""role"": ""Role_1"",
29+
""required"": true,
30+
""width"": 200,
31+
""height"": 100
32+
}";
33+
34+
Assert.That.JsonEqual(expected, tag);
35+
}
36+
37+
[TestMethod]
38+
public void ShouldSerializeCheckBoxTag()
39+
{
40+
var tag = new CheckBoxTag
41+
{
42+
Height = 12,
43+
Width = 12,
44+
Required = true,
45+
Role = "CLIENT",
46+
TagName = "CheckboxTagExample"
47+
};
48+
49+
var expected = @"{
50+
""type"": ""checkbox"",
51+
""tag_name"": ""CheckboxTagExample"",
52+
""role"": ""CLIENT"",
53+
""required"": true,
54+
""width"": 12,
55+
""height"": 12
56+
}";
57+
58+
Assert.That.JsonEqual(expected, tag);
59+
}
60+
61+
[TestMethod]
62+
public void ShouldSerializeDropdownTag()
63+
{
64+
var tag = new DropdownTag
65+
{
66+
TagName = "DropdownTagExample",
67+
Role = "CLIENT",
68+
Required = true,
69+
EnumerationOptions = new List<string> {"All", "None"},
70+
Width = 100,
71+
Height = 15,
72+
};
73+
74+
var expected = @"{
75+
""type"": ""enumeration"",
76+
""custom_defined_option"": false,
77+
""enumeration_options"": [
78+
""All"",
79+
""None""
80+
],
81+
""tag_name"": ""DropdownTagExample"",
82+
""role"": ""CLIENT"",
83+
""required"": true,
84+
""width"": 100,
85+
""height"": 15
86+
}";
87+
88+
Assert.That.JsonEqual(expected, tag);
89+
}
90+
91+
[TestMethod]
92+
public void ShouldSerializeHyperlinkTag()
93+
{
94+
var tag = new HyperlinkTag
95+
{
96+
TagName = "hyperlink_example",
97+
PageNumber = 0,
98+
Role = "CLIENT",
99+
Name = "HyperlinkTagExampleUID",
100+
Required = true,
101+
Width = 100,
102+
Height = 15,
103+
Link = new Uri("https://signnow.com"),
104+
Label = "signNow main page",
105+
Hint = "click"
106+
};
107+
108+
var expected = @"{
109+
""type"": ""hyperlink"",
110+
""page_number"": 0,
111+
""name"": ""HyperlinkTagExampleUID"",
112+
""link"": ""https://signnow.com"",
113+
""hint"": ""click"",
114+
""label"": ""signNow main page"",
115+
""tag_name"": ""hyperlink_example"",
116+
""role"": ""CLIENT"",
117+
""required"": true,
118+
""width"": 100,
119+
""height"": 15
120+
}";
121+
122+
Assert.That.JsonEqual(expected, tag);
123+
}
124+
125+
[TestMethod]
126+
public void ShouldSerializeInitialsTag()
127+
{
128+
var tag = new InitialsTag
129+
{
130+
TagName = "InitialsTagExample",
131+
Role = "CLIENT",
132+
Required = true,
133+
Height = 15,
134+
Width = 40,
135+
};
136+
137+
var expected = @"{
138+
""type"": ""initials"",
139+
""tag_name"": ""InitialsTagExample"",
140+
""role"": ""CLIENT"",
141+
""required"": true,
142+
""width"": 40,
143+
""height"": 15
144+
}";
145+
146+
Assert.That.JsonEqual(expected, tag);
147+
}
148+
149+
[TestMethod]
150+
public void ShouldSerializeSignatureTag()
151+
{
152+
var tag = new SignatureTag
153+
{
154+
TagName = "SignatureTagExample",
155+
Role = "CLIENT",
156+
Required = true,
157+
Height = 15,
158+
Width = 400,
159+
};
160+
161+
var expected = @"{
162+
""type"": ""signature"",
163+
""tag_name"": ""SignatureTagExample"",
164+
""role"": ""CLIENT"",
165+
""required"": true,
166+
""width"": 400,
167+
""height"": 15
168+
}";
169+
170+
Assert.That.JsonEqual(expected, tag);
171+
}
172+
173+
[TestMethod]
174+
public void ShouldSerializeTextTag()
175+
{
176+
var tag = new TextTag
177+
{
178+
TagName = "TextTagExample",
179+
Role = "CLIENT",
180+
Label = "Label1",
181+
Required = true,
182+
Height = 150,
183+
Width = 400,
184+
};
185+
186+
var expected = @"{
187+
""type"": ""text"",
188+
""label"": ""Label1"",
189+
""tag_name"": ""TextTagExample"",
190+
""role"": ""CLIENT"",
191+
""required"": true,
192+
""width"": 400,
193+
""height"": 150
194+
}";
195+
196+
Assert.That.JsonEqual(expected, tag);
197+
}
198+
}
199+
}
Lines changed: 79 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,79 @@
1+
using Microsoft.VisualStudio.TestTools.UnitTesting;
2+
using SignNow.Net.Model.ComplexTags;
3+
4+
namespace UnitTests.Models.ComplexTags
5+
{
6+
[TestClass]
7+
public class RadioButtonTagTest
8+
{
9+
[TestMethod]
10+
public void ShouldProperSerialize()
11+
{
12+
var radioButton = new RadioButtonTag("Group_name")
13+
{
14+
TagName = "radio_group_1",
15+
PageNumber = 0,
16+
Role = "Signer 1",
17+
Required = true,
18+
X = 36,
19+
Y = 246,
20+
Width = 340,
21+
Height = 13,
22+
};
23+
24+
radioButton.AddOption("value-1", 0, 0);
25+
radioButton.AddOption("value-2", 0, 14, 1);
26+
radioButton.AddOption("value-3", 0, 28);
27+
28+
var expected = @"{
29+
""type"":""radiobutton"",
30+
""name"":""Group_name"",
31+
""page_number"": 0,
32+
""x"": 36,
33+
""y"": 246,
34+
""radio"": [
35+
{
36+
""page_number"": 0,
37+
""x"": 36,
38+
""y"": 246,
39+
""width"": 13,
40+
""height"": 13,
41+
""value"": ""value-1"",
42+
""checked"": 0,
43+
""x-offset"": 0,
44+
""y-offset"": 0
45+
},
46+
{
47+
""page_number"": 0,
48+
""x"": 36,
49+
""y"": 246,
50+
""width"": 13,
51+
""height"": 13,
52+
""value"": ""value-2"",
53+
""checked"": 1,
54+
""x-offset"": 0,
55+
""y-offset"": 14
56+
},
57+
{
58+
""page_number"": 0,
59+
""x"": 36,
60+
""y"": 246,
61+
""width"": 13,
62+
""height"": 13,
63+
""value"": ""value-3"",
64+
""checked"": 0,
65+
""x-offset"": 0,
66+
""y-offset"": 28
67+
}
68+
],
69+
""tag_name"": ""radio_group_1"",
70+
""role"": ""Signer 1"",
71+
""required"": true,
72+
""width"": 340,
73+
""height"": 13
74+
}";
75+
76+
Assert.That.JsonEqual(expected, radioButton);
77+
}
78+
}
79+
}

0 commit comments

Comments
 (0)