Visual Studio 2010, x64 machine, using the built-in web server to host a WCF service with a set of unit tests using the built-in test framework.
I have an XML file that
I've been wrestling with deploymentattribute for a while now, and have finally just given up. Instead I'm just manually copying my files over to a test directory and then deleting them once finished:
Testfile locations:
Private _locationOfTestFilesToBeCopied As String = "C:\...\TestFilesToBeCopied"
Private _locationOfTestFiles As String = "C:\...\TestFiles"
Initialize method:
Public Sub Setup()
DeleteCopiedTestFiles()
CopyTestFilesToTestDirectory()
End Sub
Copy and delete methods:
Private Sub CopyTestFilesToTestDirectory()
Dim sourceDirectory As New DirectoryInfo(_locationOfTestFilesToBeCopied)
For Each fileInfo As FileInfo In sourceDirectory.GetFiles
fileInfo.CopyTo(_locationOfTestFiles & "\" & fileInfo.Name, True)
Next
sourceDirectory = Nothing
End Sub
Private Sub DeleteCopiedTestFiles()
Dim sourceDirectory As New DirectoryInfo(_locationOfTestFiles)
For Each fileInfo As FileInfo In sourceDirectory.GetFiles
fileInfo.Delete()
Next
sourceDirectory = Nothing
End Sub
I have found this works well