-
Notifications
You must be signed in to change notification settings - Fork 0
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
8e65717
commit 1c076b8
Showing
3 changed files
with
42 additions
and
1 deletion.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
// <copyright file="PrivateSetterTests.cs" company="Fubar Development Junker"> | ||
// Copyright (c) 2016 Fubar Development Junker. All rights reserved. | ||
// Licensed under the MIT license. See LICENSE file in the project root for full license information. | ||
// </copyright> | ||
|
||
using BeanIO.Beans; | ||
using BeanIO.Builder; | ||
|
||
using Xunit; | ||
|
||
namespace BeanIO.Issues; | ||
|
||
public class PrivateSetterTests | ||
{ | ||
[Fact] | ||
public void TestPrivateSetter() | ||
{ | ||
var factory = StreamFactory.NewInstance(); | ||
factory.Define( | ||
new StreamBuilder("s") | ||
.Format("fixedlength") | ||
.AddRecord( | ||
new RecordBuilder("r", typeof(Bean)) | ||
.AddField(new FieldBuilder(nameof(Bean.NoOpSetter)) | ||
.Length(1) | ||
.RegEx("[0-9]") | ||
.Setter("SetNoOpSetter")))); | ||
var unmarshaller = factory.CreateUnmarshaller("s"); | ||
var bean = Assert.IsType<Bean>(unmarshaller.Unmarshal("1")); | ||
Assert.Equal(1, bean.NoOpSetter); | ||
} | ||
} |