-
Notifications
You must be signed in to change notification settings - Fork 163
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
67a53c6
commit 553912c
Showing
5 changed files
with
50 additions
and
50 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -14,61 +14,61 @@ namespace Box.V2.Test | |
[TestClass] | ||
public class BoxSignTemplatesManagerTest : BoxResourceManagerTest | ||
{ | ||
private readonly BoxSignTemplatesManager _signTemplatesManager; | ||
private readonly BoxSignTemplatesManager _signTemplatesManager; | ||
|
||
public BoxSignTemplatesManagerTest() | ||
{ | ||
_signTemplatesManager = new BoxSignTemplatesManager(Config.Object, Service, Converter, AuthRepository); | ||
} | ||
public BoxSignTemplatesManagerTest() | ||
{ | ||
_signTemplatesManager = new BoxSignTemplatesManager(Config.Object, Service, Converter, AuthRepository); | ||
} | ||
|
||
[TestMethod] | ||
public async Task GetSignTemplateById_Success() | ||
{ | ||
/** Arrange **/ | ||
const string signTemplateId = "93153068-5420-467b-b8ef-8e54bfb7be42"; | ||
IBoxRequest boxRequest = null; | ||
Handler.Setup(h => h.ExecuteAsync<BoxSignTemplate>(It.IsAny<IBoxRequest>())) | ||
.Returns(Task.FromResult<IBoxResponse<BoxSignTemplate>>(new BoxResponse<BoxSignTemplate>() | ||
{ | ||
Status = ResponseStatus.Success, | ||
ContentString = LoadFixtureFromJson("Fixtures/BoxSignTemplate/GetSignTemplate200.json") | ||
})) | ||
.Callback<IBoxRequest>(r => boxRequest = r); | ||
[TestMethod] | ||
public async Task GetSignTemplateById_Success() | ||
{ | ||
/** Arrange **/ | ||
const string signTemplateId = "93153068-5420-467b-b8ef-8e54bfb7be42"; | ||
IBoxRequest boxRequest = null; | ||
Handler.Setup(h => h.ExecuteAsync<BoxSignTemplate>(It.IsAny<IBoxRequest>())) | ||
.Returns(Task.FromResult<IBoxResponse<BoxSignTemplate>>(new BoxResponse<BoxSignTemplate>() | ||
{ | ||
Status = ResponseStatus.Success, | ||
ContentString = LoadFixtureFromJson("Fixtures/BoxSignTemplate/GetSignTemplate200.json") | ||
})) | ||
.Callback<IBoxRequest>(r => boxRequest = r); | ||
|
||
/*** Act ***/ | ||
BoxSignTemplate response = await _signTemplatesManager.GetSignTemplateByIdAsync(signTemplateId); | ||
/*** Act ***/ | ||
BoxSignTemplate response = await _signTemplatesManager.GetSignTemplateByIdAsync(signTemplateId); | ||
|
||
/*** Assert ***/ | ||
// Request check | ||
Assert.IsNotNull(boxRequest); | ||
Assert.AreEqual(RequestMethod.Get, boxRequest.Method); | ||
Assert.AreEqual(new Uri("https://api.box.com/2.0/sign_templates/93153068-5420-467b-b8ef-8e54bfb7be42"), boxRequest.AbsoluteUri); | ||
/*** Assert ***/ | ||
// Request check | ||
Assert.IsNotNull(boxRequest); | ||
Assert.AreEqual(RequestMethod.Get, boxRequest.Method); | ||
Assert.AreEqual(new Uri("https://api.box.com/2.0/sign_templates/93153068-5420-467b-b8ef-8e54bfb7be42"), boxRequest.AbsoluteUri); | ||
|
||
// Response check | ||
Assert.AreEqual(signTemplateId, response.Id); | ||
Assert.AreEqual("requirements-dev.pdf", response.Name); | ||
Assert.AreEqual("Please sign this document.\n\nKind regards", response.EmailMessage); | ||
Assert.AreEqual("Someone ([email protected]) has requested your signature on a document", response.EmailSubject); | ||
Assert.AreEqual("1234567890", response.ParentFolder.Id); | ||
Assert.AreEqual(1, response.SourceFiles.Count); | ||
Assert.AreEqual("1234567890", response.SourceFiles[0].Id); | ||
Assert.AreEqual("https://app.box.com/sign/ready-sign-link/59917816-c12b-4ef6-8f1d-aaaaaaa", response.ReadySignLink.Url); | ||
} | ||
// Response check | ||
Assert.AreEqual(signTemplateId, response.Id); | ||
Assert.AreEqual("requirements-dev.pdf", response.Name); | ||
Assert.AreEqual("Please sign this document.\n\nKind regards", response.EmailMessage); | ||
Assert.AreEqual("Someone ([email protected]) has requested your signature on a document", response.EmailSubject); | ||
Assert.AreEqual("1234567890", response.ParentFolder.Id); | ||
Assert.AreEqual(1, response.SourceFiles.Count); | ||
Assert.AreEqual("1234567890", response.SourceFiles[0].Id); | ||
Assert.AreEqual("https://app.box.com/sign/ready-sign-link/59917816-c12b-4ef6-8f1d-aaaaaaa", response.ReadySignLink.Url); | ||
} | ||
|
||
[TestMethod] | ||
public async Task GetSignTemplates_Success() | ||
{ | ||
/** Arrange **/ | ||
IBoxRequest boxRequest = null; | ||
Handler.Setup(h => h.ExecuteAsync<BoxCollectionMarkerBased<BoxSignTemplate>>(It.IsAny<IBoxRequest>())) | ||
[TestMethod] | ||
public async Task GetSignTemplates_Success() | ||
{ | ||
/** Arrange **/ | ||
IBoxRequest boxRequest = null; | ||
Handler.Setup(h => h.ExecuteAsync<BoxCollectionMarkerBased<BoxSignTemplate>>(It.IsAny<IBoxRequest>())) | ||
.Returns(Task.FromResult<IBoxResponse<BoxCollectionMarkerBased<BoxSignTemplate>>>(new BoxResponse<BoxCollectionMarkerBased<BoxSignTemplate>>() | ||
{ | ||
Status = ResponseStatus.Success, | ||
ContentString = LoadFixtureFromJson("Fixtures/BoxSignTemplate/GetAllSignTemplates200.json") | ||
})) | ||
.Callback<IBoxRequest>(r => boxRequest = r); | ||
|
||
/*** Act ***/ | ||
/*** Act ***/ | ||
BoxCollectionMarkerBased<BoxSignTemplate> response = await _signTemplatesManager.GetSignTemplatesAsync(1000, "JV9IRGZmieiBasejOG9yDCRNgd2ymoZIbjsxbJMjIs3kioVii"); | ||
|
||
/*** Assert ***/ | ||
|
@@ -77,9 +77,9 @@ public async Task GetSignTemplates_Success() | |
Assert.AreEqual(RequestMethod.Get, boxRequest.Method); | ||
Assert.AreEqual(new Uri("https://api.box.com/2.0/sign_templates?limit=1000&marker=JV9IRGZmieiBasejOG9yDCRNgd2ymoZIbjsxbJMjIs3kioVii"), boxRequest.AbsoluteUri); | ||
|
||
// Response check | ||
Assert.AreEqual(1, response.Entries.Count); | ||
// Response check | ||
Assert.AreEqual(1, response.Entries.Count); | ||
Assert.AreEqual("93153068-5420-467b-b8ef-8e54bfb7be42", response.Entries[0].Id); | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
using System.Threading.Tasks; | ||
using System.Threading.Tasks; | ||
using Box.V2.Models; | ||
using Box.V2.Models.Request; | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters