mirror of
https://github.com/soukoku/ntwain.git
synced 2025-10-26 12:03:06 +08:00
Initial move from old twain-in-dotnet.
This commit is contained in:
54
Tests/NTwain.Tests/Data/TWIdentityTest.cs
Normal file
54
Tests/NTwain.Tests/Data/TWIdentityTest.cs
Normal file
@@ -0,0 +1,54 @@
|
||||
using NTwain.Data;
|
||||
using Microsoft.VisualStudio.TestTools.UnitTesting;
|
||||
using System;
|
||||
using NTwain.Values;
|
||||
|
||||
namespace NTwain.Tests.Data
|
||||
{
|
||||
/// <summary>
|
||||
///This is a test class for TWIdentity and is intended
|
||||
///to contain all TWIdentityTest Unit Tests
|
||||
///</summary>
|
||||
[TestClass]
|
||||
public class TWIdentityTest
|
||||
{
|
||||
// the maxlength expects null terminator so at maxlength it's over the limit
|
||||
|
||||
[TestMethod]
|
||||
[ExpectedException(typeof(ArgumentException), "String length not enforced.")]
|
||||
public void Enforce_Manufacturer_String_Length()
|
||||
{
|
||||
TWIdentity target = new TWIdentity();
|
||||
|
||||
var overLength = TwainConst.String32;
|
||||
|
||||
string badString = new String('a', overLength);
|
||||
|
||||
target.Manufacturer = badString;
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
[ExpectedException(typeof(ArgumentException), "String length not enforced.")]
|
||||
public void Enforce_ProductFamily_String_Length()
|
||||
{
|
||||
TWIdentity target = new TWIdentity();
|
||||
|
||||
var overLength = TwainConst.String32;
|
||||
|
||||
string badString = new String('a', overLength);
|
||||
target.ProductFamily = badString;
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
[ExpectedException(typeof(ArgumentException), "String length not enforced.")]
|
||||
public void Enforce_ProductName_String_Length()
|
||||
{
|
||||
TWIdentity target = new TWIdentity();
|
||||
|
||||
var overLength = TwainConst.String32;
|
||||
|
||||
string badString = new String('a', overLength);
|
||||
target.ProductName = badString;
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user