-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #39 from bookfx/zh/split-name
split Box.Name into NameGlobally and NameLocally
- Loading branch information
Showing
31 changed files
with
333 additions
and
130 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
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
namespace BookFx.Tests.Renders | ||
{ | ||
using BookFx.Epplus; | ||
using BookFx.Renders; | ||
using FluentAssertions; | ||
using FsCheck.Xunit; | ||
using Xunit; | ||
|
||
[Properties(MaxTest = 10)] | ||
public class BoxGlobalNameRenderTests | ||
{ | ||
private const string TheValidName = "TheName"; | ||
|
||
[Fact] | ||
public void GlobalNameRender_NoName_NotSet() => | ||
Packer.OnSheet(excelSheet => | ||
{ | ||
var excelRange = excelSheet.Cells[1, 1]; | ||
Make.Value().Get.GlobalNameRender()(excelRange); | ||
excelRange.Worksheet.Workbook.Names.Should().BeEmpty(); | ||
}); | ||
|
||
[Fact] | ||
public void GlobalNameRender_NonEmptyName_Set() => | ||
Packer.OnSheet(excelSheet => | ||
{ | ||
var box = Make.Value().NameGlobally(TheValidName).Get; | ||
var excelRange = excelSheet.Cells[1, 1]; | ||
box.GlobalNameRender()(excelRange); | ||
excelRange.Worksheet.Workbook.Names | ||
.Should() | ||
.HaveCount(1) | ||
.And.OnlyContain(x => x.Name == TheValidName && x.Address == excelRange.Address); | ||
}); | ||
|
||
[Fact] | ||
public void GlobalNameRender_NameIsAlreadyExists_Error() => | ||
Packer.OnSheet(excelSheet => | ||
{ | ||
excelSheet.Workbook.Names.Add(TheValidName, excelSheet.Cells[2, 2]); | ||
var box = Make.Value().NameGlobally(TheValidName).Get; | ||
var excelRange = excelSheet.Cells[1, 1]; | ||
var result = box.GlobalNameRender()(excelRange); | ||
result.IsValid.Should().BeFalse(); | ||
}); | ||
} | ||
} |
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 |
---|---|---|
@@ -0,0 +1,53 @@ | ||
namespace BookFx.Tests.Renders | ||
{ | ||
using BookFx.Epplus; | ||
using BookFx.Renders; | ||
using FluentAssertions; | ||
using FsCheck.Xunit; | ||
using Xunit; | ||
|
||
[Properties(MaxTest = 10)] | ||
public class BoxLocalNameRenderTests | ||
{ | ||
private const string TheValidName = "TheName"; | ||
|
||
[Fact] | ||
public void LocalNameRender_NoName_NotSet() => | ||
Packer.OnSheet(excelSheet => | ||
{ | ||
var excelRange = excelSheet.Cells[1, 1]; | ||
Make.Value().Get.LocalNameRender()(excelRange); | ||
excelRange.Worksheet.Names.Should().BeEmpty(); | ||
}); | ||
|
||
[Fact] | ||
public void LocalNameRender_NonEmptyName_Set() => | ||
Packer.OnSheet(excelSheet => | ||
{ | ||
var box = Make.Value().NameLocally(TheValidName).Get; | ||
var excelRange = excelSheet.Cells[1, 1]; | ||
box.LocalNameRender()(excelRange); | ||
excelRange.Worksheet.Names | ||
.Should() | ||
.HaveCount(1) | ||
.And.OnlyContain(x => x.Name == TheValidName && x.Address == excelRange.Address); | ||
}); | ||
|
||
[Fact] | ||
public void LocalNameRender_NameIsAlreadyExists_Error() => | ||
Packer.OnSheet(excelSheet => | ||
{ | ||
excelSheet.Names.Add(TheValidName, excelSheet.Cells[2, 2]); | ||
var box = Make.Value().NameLocally(TheValidName).Get; | ||
var excelRange = excelSheet.Cells[1, 1]; | ||
var result = box.LocalNameRender()(excelRange); | ||
result.IsValid.Should().BeFalse(); | ||
}); | ||
} | ||
} |
This file was deleted.
Oops, something went wrong.
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
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
Oops, something went wrong.