-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmvfiles.tests.ps1
47 lines (33 loc) · 1.75 KB
/
mvfiles.tests.ps1
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
$here = (Split-Path -Parent $MyInvocation.MyCommand.Path)
. $here\mvfiles.ps1
Describe 'mvfiles' {
# $testPath = "TestDrive:\"
#Set-Content $testPath -value "my test text."
Setup -Dir "source"
Setup -Dir "dest1"
Setup -Dir "dest2"
It 'Given an empty folder, it returns a warning' {
$output = mvfiles "TestDrive:\source"
# We count how many lines of output we got. And validate it by using
# the Should -Be assertion.
$output.Count | Should -Be 1
}
It 'Given a folder with files: (apple.txt,pear.txt,1234.txt) , it returns the expected behavior for the function'{
Setup -File "source/apple.txt"
Setup -File "source/pear.txt"
Setup -File "source/1234.txt"
$output = mvfiles "TestDrive:\source" "TestDrive:\dest1" "TestDrive:\dest2"
(Test-Path -Path "TestDrive:\dest1\apple.txt") | Should Be $true
(Test-Path -Path "TestDrive:\dest2\pear.txt") | Should Be $true
(Test-Path -Path "TestDrive:\dest2\1234.txt") | Should Be $false
}
It 'Given a folder with files: (apple.txt,bobcaat.txt), run the function twice to see that it returns the expected behavior for the function'{
#Setup -File "source/apple.txt"
Setup -File "source/bobcat.txt"
$output1 = mvfiles "TestDrive:\source" "TestDrive:\dest1" "TestDrive:\dest2"
(Test-Path -Path "TestDrive:\dest1\apple.txt") | Should Be $true
(Test-Path -Path "TestDrive:\dest1\bobcat.txt") | Should Be $true
$output2 = mvfiles "TestDrive:\source" "TestDrive:\dest1" "TestDrive:\dest2"
$output.Count | Should -Be 1
}
}