<?xml version="1.0"?>
<project name="Spring.Services.WindowsService.Tests" default="build">
<!--
    Required properties:
      * current.bin.dir           - (path) root level to build to
      * current.build.debug       - (true|false) debug build?
      * current.build.defines.csc - framework-specific build defines for C# compiler
-->

    <target name="copy-test-support-files">

      <!-- test files -->
    	<copy todir="${current.bin.dir}">
    	    <fileset basedir="${project::get-base-directory()}">
    	        <include name="Data/**/*.xml" />
    	        <include name="Data/**/*.test" />
    	    </fileset>
    	</copy>

      <!-- agiledocs -->
    	<copy todir="${current.bin.dir}">
    	    <fileset basedir="${project::get-base-directory()}/../../../doc/reference/src/templated">
    	        <include name="*.dll" />
    	    </fileset>
    	</copy>

      <!-- process definition files from src -->
    	<!-- rough <copy> does not work ? ... -->
    	<foreach item="File" property="filename">
    	    <in>
    		    <items>
    				<include name="${project::get-base-directory()}/../../../src/Spring/Spring.Services/WindowsService/Process/**/*.xml"/>
    		    </items>
    		</in>
    		<do>
    			<copy todir="${current.bin.dir}/Data/Xml" verbose="true" file="${filename}"/>
    		</do>
    	</foreach>
    </target>

    <target name="build" depends="copy-test-support-files">
        <csc target="library" define="${current.build.defines.csc}"
			warnaserror="true"
			debug="${current.build.debug}"
			output="${current.bin.dir}/${project::get-name()}.dll" >
            <nowarn>
                <warning number="${nowarn.numbers}" />
            </nowarn>
            <sources failonempty="true">
                <include name="WindowsService/Common/**/*.cs" />
                <include name="WindowsService/TestUtils.cs" />
                <include name="../CommonAssemblyInfo.cs" />
            </sources>
            <resources prefix="Spring.Services" dynamicprefix="true" failonempty="true">
                <include name="tests.config" />
            </resources>
            <references basedir="${current.bin.dir}">
                <include name="*.dll"/>
                <exclude name="${project::get-name()}.dll"/>
            </references>
        </csc>
    </target>

    <target name="test" depends="build">
         <nunit2outproc>
            <formatter type="Plain" />
            <formatter type="Xml" usefile="true" extension=".xml"
	               outputdir="${current.bin.dir}/results" />
            <test
		assemblyname="${current.bin.dir}/${project::get-name()}.dll"
		appconfig="${current.bin.dir}/${project::get-name()}.dll.config"/>
         </nunit2outproc>
    </target>


</project>
