Piscal Client improvements
This commit is contained in:
@@ -50,6 +50,7 @@
|
||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||
<Compile Include="Parsers\LeafInputCsvParserTests.cs" />
|
||||
<Compile Include="Remote\PiscalSshClientTests.cs" />
|
||||
<Compile Include="Utility\StringExtensionsTests.cs" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Content Include="Parsers\LeafInputData\LeafInput-valid.csv">
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
using System.Configuration;
|
||||
using LeafWeb.Core.Entities;
|
||||
using LeafWeb.Core.Remote;
|
||||
using LeafWeb.Core.Utility;
|
||||
using NUnit.Framework;
|
||||
|
||||
@@ -11,7 +12,7 @@ namespace LeafWeb.Core.Tests.Remote
|
||||
[Test]
|
||||
public void Client()
|
||||
{
|
||||
var leafInputFile = new LeafInputFile {Filename = "blah", Id = 1, Contents = "test".GetBytes()};
|
||||
var leafInputFile = new PiscalLeafInputFile{Filename = "blah", Id = 1, Contents = "test".GetBytes(), DirectoryName = "TestDirectory"};
|
||||
var piscalConnectionString = ConfigurationManager.ConnectionStrings["PiscalServer"];
|
||||
var client = new PiscalSshClient(piscalConnectionString.ConnectionString);
|
||||
client.SubmitLeafInputFile(leafInputFile);
|
||||
|
||||
@@ -0,0 +1,42 @@
|
||||
using System;
|
||||
using LeafWeb.Core.Utility;
|
||||
using NUnit.Framework;
|
||||
|
||||
namespace LeafWeb.Core.Tests.Utility
|
||||
{
|
||||
[TestFixture]
|
||||
public class StringExtensionsTests
|
||||
{
|
||||
[Test]
|
||||
public void FilterAlphaNumeric_AllGood()
|
||||
{
|
||||
var str = "thisIsFine123_";
|
||||
var result = str.FilterAlphaNumeric();
|
||||
Assert.That(result, Is.EqualTo(str));
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void FilterAlphaNumeric_NotAllowed()
|
||||
{
|
||||
var str = "notAllowed%";
|
||||
var result = str.FilterAlphaNumeric();
|
||||
Assert.That(result, Is.EqualTo("notAllowed"));
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void FilterAlphaNumeric_Space()
|
||||
{
|
||||
var str = "s p a c e s";
|
||||
var result = str.FilterAlphaNumeric();
|
||||
Assert.That(result, Is.EqualTo("spaces"));
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void FilterAlphaNumeric_NewLine()
|
||||
{
|
||||
var str = "new" + Environment.NewLine + "line";
|
||||
var result = str.FilterAlphaNumeric();
|
||||
Assert.That(result, Is.EqualTo("newline"));
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user