示例#1
0
        private DefaultIssueTrackerUrlBuilder CreateBuilder()
        {
            DefaultIssueTrackerUrlBuilder defaultIssue = new DefaultIssueTrackerUrlBuilder();

            NetReflector.Read(CreateSourceControlXml(), defaultIssue);
            return(defaultIssue);
        }
        public void CanCatchInvalidLabelOnSuccessConfiguration()
        {
            const string invalidXml = "<sourcecontrol type=\"alienbrain\"><labelOnSuccess>NOT_A_BOOLEAN</labelOnSuccess></sourcecontrol>";

            Assert.That(delegate { NetReflector.Read(invalidXml); },
                        Throws.TypeOf <NetReflectorException>());
        }
示例#3
0
        public void ShouldDeserialiseFromXml()
        {
            string xml =
                @"<sourceControl type=""vss"" autoGetSource=""true"">
    <executable>..\tools\vss\ss.exe</executable>
    <ssdir>..\tools\vss</ssdir>
    <project>$/root</project>
    <username>Joe Admin</username>
    <password>admin</password>
	<applyLabel>true</applyLabel>
	<timeout>5</timeout>
	<workingDirectory>C:\temp</workingDirectory>
	<culture>fr-FR</culture>
	<cleanCopy>false</cleanCopy>
	<alwaysGetLatest>true</alwaysGetLatest>
</sourceControl>";

            NetReflector.Read(xml, vss);
            Assert.AreEqual(@"..\tools\vss\ss.exe", vss.Executable);
            Assert.AreEqual(@"admin", vss.Password.PrivateValue);
            Assert.AreEqual(@"$/root", vss.Project);
            Assert.AreEqual(@"..\tools\vss", vss.SsDir);
            Assert.AreEqual(@"Joe Admin", vss.Username);
            Assert.AreEqual(true, vss.ApplyLabel);
            Assert.AreEqual(new Timeout(5), vss.Timeout);
            Assert.AreEqual(true, vss.AutoGetSource);
            Assert.AreEqual(@"C:\temp", vss.WorkingDirectory);
            Assert.AreEqual("fr-FR", vss.Culture);
            Assert.AreEqual(false, vss.CleanCopy);
            Assert.AreEqual(true, vss.AlwaysGetLatest);
        }
示例#4
0
        public void PopulateFromConfiguration()
        {
            const string xml = @"<msbuild>
	<executable>C:\WINDOWS\Microsoft.NET\Framework\v2.0.50215\MSBuild.exe</executable>
	<workingDirectory>C:\dev\ccnet</workingDirectory>
	<projectFile>CCNet.sln</projectFile>
	<buildArgs>/p:Configuration=Debug /v:diag</buildArgs>
	<targets>Build;Test</targets>
	<timeout>15</timeout>
	<logger>Kobush.Build.Logging.XmlLogger,Kobush.MSBuild.dll</logger>
    <loggerParameters>
        <loggerParameter>buildresult.xml</loggerParameter>
        <loggerParameter>someField=true</loggerParameter>
    </loggerParameters>
    <priority>BelowNormal</priority>
</msbuild>";

            task = (MsBuildTask)NetReflector.Read(xml);
            Assert.AreEqual(@"C:\WINDOWS\Microsoft.NET\Framework\v2.0.50215\MSBuild.exe", task.Executable);
            Assert.AreEqual(@"C:\dev\ccnet", task.WorkingDirectory);
            Assert.AreEqual("CCNet.sln", task.ProjectFile);
            Assert.AreEqual("Build;Test", task.Targets);
            Assert.AreEqual("/p:Configuration=Debug /v:diag", task.BuildArgs);
            Assert.AreEqual(15, task.Timeout);
            Assert.AreEqual("Kobush.Build.Logging.XmlLogger,Kobush.MSBuild.dll", task.Logger);
            Assert.AreEqual(2, task.LoggerParameters.Length);
            Assert.AreEqual("buildresult.xml", task.LoggerParameters[0]);
            Assert.AreEqual("someField=true", task.LoggerParameters[1]);
            Assert.AreEqual(ProcessPriorityClass.BelowNormal, task.Priority);
        }
示例#5
0
        private static Mks CreateMks(string xml, IHistoryParser historyParser, ProcessExecutor executor)
        {
            Mks newMks = new Mks(historyParser, executor);

            NetReflector.Read(xml, newMks);
            return(newMks);
        }
示例#6
0
        public void ShouldFailToLoadInvalidVersionFromConfiguration()
        {
            const string xml = @"<devenv solutionfile=""mySolution.sln"" configuration=""Release"" version=""VSBAD""/>";

            Assert.That(delegate { NetReflector.Read(xml); },
                        Throws.TypeOf <NetReflectorException>());
        }
示例#7
0
        public void PopulateFromFullySpecifiedXml()
        {
            const string xml = @"
<git>
	<executable>git</executable>
	<repository>c:\git\ccnet\mygitrepo</repository>
	<branch>master</branch>
	<timeout>5</timeout>
	<workingDirectory>c:\git\working</workingDirectory>
	<tagOnSuccess>true</tagOnSuccess>
	<commitBuildModifications>true</commitBuildModifications>
	<commitUntrackedFiles>true</commitUntrackedFiles>
	<autoGetSource>true</autoGetSource>
	<tagCommitMessage>CCNet Test Build {0}</tagCommitMessage>
	<tagNameFormat>{0}</tagNameFormat>
	<committerName>Max Mustermann</committerName>
	<committerEMail>[email protected]</committerEMail>
</git>";

            git = (Git)NetReflector.Read(xml);
            Assert.AreEqual("git", git.Executable, "#B1");
            Assert.AreEqual(@"c:\git\ccnet\mygitrepo", git.Repository, "#B2");
            Assert.AreEqual("master", git.Branch, "#B3");
            Assert.AreEqual(new Timeout(5), git.Timeout, "#B4");
            Assert.AreEqual(@"c:\git\working", git.WorkingDirectory, "#B5");
            Assert.AreEqual(true, git.TagOnSuccess, "#B6");
            Assert.AreEqual(true, git.AutoGetSource, "#B7");
            Assert.AreEqual("CCNet Test Build {0}", git.TagCommitMessage, "#B8");
            Assert.AreEqual("{0}", git.TagNameFormat, "#B9");
            Assert.AreEqual("Max Mustermann", git.CommitterName, "#B10");
            Assert.AreEqual("*****@*****.**", git.CommitterEMail, "#B11");
            Assert.AreEqual(true, git.CommitBuildModifications, "#B12");
            Assert.AreEqual(true, git.CommitUntrackedFiles, "#B13");
        }
        public void PopulateFromReflectorWithOnlyRequiredOptions()
        {
            const string xml = @"<httpRequest uri=""http://example.com/""/>";

            HttpRequestSettings requestSettings = (HttpRequestSettings)NetReflector.Read(xml);

            Assert.IsFalse(requestSettings.UseDefaultCredentials);
            Assert.Null(requestSettings.Credentials, "Credentials was not specified in the settings");

            Assert.AreEqual("GET", requestSettings.Method);
            Assert.AreEqual("http://example.com/", requestSettings.Uri.ToString());

            Assert.IsFalse(requestSettings.HasTimeout);
            Assert.IsNull(requestSettings.Timeout);

            Assert.IsFalse(requestSettings.HasReadWriteTimeout);
            Assert.IsNull(requestSettings.ReadWriteTimeout);

            Assert.Null(requestSettings.Headers, "No headers were specified in the settings");

            Assert.IsFalse(requestSettings.HasBody);
            Assert.IsNull(requestSettings.Body);

            Assert.IsFalse(requestSettings.HasSendFile);
            Assert.IsNull(requestSettings.SendFile);
        }
        public void PopulateFromReflector()
        {
            string xml = @"<state><directory>c:\temp</directory></state>";

            state = (FileStateManager)NetReflector.Read(xml);
            Assert.AreEqual(@"c:\temp", state.StateFileDirectory);
        }
        private static void AssertTimeoutIs(Timeout expected, string xml)
        {
            StubSourceControl sc = new StubSourceControl(null, null);

            NetReflector.Read(xml, sc);
            Assert.AreEqual(expected, sc.Timeout);
        }
示例#11
0
 public void LoadFromConfiguration()
 {
     filter = (UserFilter)NetReflector.Read(@"<userFilter><names><name>bob</name><name>perry</name></names></userFilter>");
     Assert.AreEqual(2, filter.UserNames.Length);
     Assert.AreEqual("bob", filter.UserNames[0]);
     Assert.AreEqual("perry", filter.UserNames[1]);
 }
示例#12
0
        public void PopulateFromReflector()
        {
            const string xml = @"
    <rake>
        <executable>C:\ruby\bin\rake.bat</executable>
        <baseDirectory>C:\</baseDirectory>
        <rakefile>Rakefile</rakefile>
		<targetList>
			<target>foo</target>
			<target>bar</target>
		</targetList>
		<buildTimeoutSeconds>123</buildTimeoutSeconds>
		<quiet>true</quiet>
		<silent>true</silent>
		<trace>true</trace>
    </rake>";

            NetReflector.Read(xml, builder);
            Assert.AreEqual(@"C:\", builder.BaseDirectory);
            Assert.AreEqual("Rakefile", builder.Rakefile);
            Assert.AreEqual(@"C:\ruby\bin\rake.bat", builder.Executable);
            Assert.AreEqual(2, builder.Targets.Length);
            Assert.AreEqual("foo", builder.Targets[0]);
            Assert.AreEqual("bar", builder.Targets[1]);
            Assert.AreEqual(123, builder.BuildTimeoutSeconds);
            Assert.AreEqual(true, builder.Quiet);
            Assert.AreEqual(true, builder.Silent);
            Assert.AreEqual(true, builder.Trace);
        }
        public void PopulateFromReflectorWithAllOptions()
        {
            const string xml = @"
<checkHttpStatus>
   <description>ADesc</description>
      <httpRequest uri=""http://example.com/""/>
      
      <successStatusCodes>200,203</successStatusCodes>
      <retries>7</retries>
      <retryDelay units=""seconds"">5</retryDelay>
      <taskTimeout units=""minutes"">5</taskTimeout>
      <includeContent>true</includeContent>
</checkHttpStatus>";

            HttpStatusTask task = (HttpStatusTask)NetReflector.Read(xml);

            Assert.AreEqual("ADesc", task.Description);
            Assert.NotNull(task.RequestSettings, "Request settings are required");

            Assert.AreEqual("200,203", task.SuccessStatusCodes);
            Assert.AreEqual(7, task.Retries);
            Assert.AreEqual(5000, task.RetryDelay.Millis);
            Assert.IsTrue(task.HasTimeout);
            Assert.AreEqual(300000, task.Timeout.Millis);
            Assert.AreEqual(true, task.IncludeContent);
        }
示例#14
0
        public void ReadMembers()
        {
            TestInnerClass inner = new TestInnerClass();

            NetReflector.Read(@"<foo name=""foo"" />", inner);
            Assert.AreEqual("foo", inner.InnerName);
        }
示例#15
0
        public void VerifyCreateQueryProcessInfoWithAttributes()
        {
            string             fromtime    = "01/02/2003 00:00:00";
            string             totime      = "23/02/2006 23:14:05";
            IntegrationRequest request     = new IntegrationRequest(BuildCondition.ForceBuild, "source", null);
            IntegrationSummary lastSummary = new IntegrationSummary(IntegrationStatus.Success, "label", "lastlabel", DateTime.Now);
            IntegrationResult  from        = new IntegrationResult("test", @"c:\workspace", @"c:\artifacts", request, lastSummary);

            from.StartTime = DateTime.ParseExact(fromtime, PlasticSCM.DATEFORMAT, System.Globalization.CultureInfo.InvariantCulture);
            IntegrationResult to = new IntegrationResult("test", @"c:\workspace", @"c:\artifacts", request, lastSummary);

            to.StartTime = DateTime.ParseExact(totime, PlasticSCM.DATEFORMAT, System.Globalization.CultureInfo.InvariantCulture);

            PlasticSCM plasticscm = new PlasticSCM();

            NetReflector.Read(PLASTICSCM_XML, plasticscm);
            string query = string.Format(
                @"c:\plastic\client\cm.exe find revision where branch = 'br:/main' and revno != 'CO' "
                + "and date between '{0}' and '{1}' on repository 'mainrep' ", fromtime, totime);
            string dateformat = string.Format(System.Globalization.CultureInfo.CurrentCulture, "--dateformat=\"{0}\" ", PlasticSCM.DATEFORMAT);
            string format     = string.Format(System.Globalization.CultureInfo.CurrentCulture, "--format=\"{0}\"", PlasticSCM.FORMAT);

            ProcessInfo info = plasticscm.CreateQueryProcessInfo(from, to);

            Assert.AreEqual(query + dateformat + format, info.FileName + " " + info.Arguments);
        }
示例#16
0
        public void ShouldLoadMinimalValuesFromConfiguration()
        {
            const string xml  = @"<codeItRight />";
            var          task = NetReflector.Read(xml) as CodeItRightTask;

            Assert.AreEqual("SubMain.CodeItRight.Cmd", task.Executable);
        }
        public void ShouldPopulateCorrectlyFromXml()
        {
            const string xml =
                @"<sourceControl type=""external"">
    <args>arg1 ""arg2 has blanks"" arg3</args>
    <autoGetSource>true</autoGetSource>
    <executable>banana.bat</executable>
    <labelOnSuccess>true</labelOnSuccess>
    <environment>
        <variable name=""name1"" value=""value1""/>
        <variable><name>name2</name></variable>
        <variable name=""name3""><value>value3</value></variable>
    </environment>
</sourceControl>";

            ExternalSourceControl externalSC = new ExternalSourceControl();

            NetReflector.Read(xml, externalSC);
            Assert.AreEqual(@"arg1 ""arg2 has blanks"" arg3", externalSC.ArgString);
            Assert.AreEqual(true, externalSC.AutoGetSource);
            Assert.AreEqual(3, externalSC.EnvironmentVariables.Length);
            Assert.AreEqual("name1", externalSC.EnvironmentVariables[0].name);
            Assert.AreEqual("value1", externalSC.EnvironmentVariables[0].value);
            Assert.AreEqual("name2", externalSC.EnvironmentVariables[1].name);
            Assert.AreEqual("", externalSC.EnvironmentVariables[1].value);
            Assert.AreEqual("name3", externalSC.EnvironmentVariables[2].name);
            Assert.AreEqual("value3", externalSC.EnvironmentVariables[2].value);
            Assert.AreEqual("banana.bat", externalSC.Executable);
            Assert.AreEqual(true, externalSC.LabelOnSuccess);
        }
示例#18
0
        public void ShouldLoadMinimalValuesFromConfiguration()
        {
            const string xml  = @"<commentTask><message>Test Message</message></commentTask>";
            var          task = NetReflector.Read(xml) as CommentTask;

            Assert.AreEqual("Test Message", task.Message);
        }
示例#19
0
        private P4 CreateP4WithNoArgContructor(string p4root)
        {
            P4 perforce = new P4();

            NetReflector.Read(p4root, perforce);
            return(perforce);
        }
        public void ReadXmlWithEnum()
        {
            string        xml      = EnumTestClass.GetXml();
            EnumTestClass testEnum = (EnumTestClass)NetReflector.Read(xml);

            EnumTestClass.AssertEquals(testEnum);
        }
示例#21
0
        public void PopulateFromFullySpecifiedXml()
        {
            string xml = @"
<svn>
	<executable>c:\svn\svn.exe</executable>
	<trunkUrl>svn://myserver/mypath</trunkUrl>
	<timeout>5</timeout>
	<workingDirectory>c:\dev\src</workingDirectory>
	<username>user</username>
	<password>password</password>
	<tagOnSuccess>true</tagOnSuccess>
	<tagWorkingCopy>true</tagWorkingCopy>
	<tagBaseUrl>svn://myserver/mypath/tags</tagBaseUrl>
	<autoGetSource>true</autoGetSource>
	<checkExternals>true</checkExternals>
</svn>";

            svn = (Svn)NetReflector.Read(xml);
            Assert.AreEqual(@"c:\svn\svn.exe", svn.Executable);
            Assert.AreEqual("svn://myserver/mypath", svn.TrunkUrl);
            Assert.AreEqual(new Timeout(5), svn.Timeout);
            Assert.AreEqual(@"c:\dev\src", svn.WorkingDirectory);
            Assert.AreEqual("user", svn.Username);
            Assert.AreEqual("password", svn.Password.PrivateValue);
            Assert.AreEqual(true, svn.TagOnSuccess);
            Assert.AreEqual(true, svn.TagWorkingCopy);
            Assert.AreEqual(true, svn.AutoGetSource);
            Assert.AreEqual(true, svn.CheckExternals);
            Assert.AreEqual("svn://myserver/mypath/tags", svn.TagBaseUrl);
        }
        public void ReadTestClass()
        {
            DateTime  now  = DateTime.Now;
            TestClass root = (TestClass)NetReflector.Read(TestClass.GetXml(now), table);

            TestClass.AssertEquals(TestClass.Create(now), root);
        }
示例#23
0
 public void PopulateFromMinimalConfiguration()
 {
     task = (MsBuildTask)NetReflector.Read("<msbuild />");
     Assert.AreEqual(defaultExecutable, task.Executable);
     Assert.AreEqual(MsBuildTask.DefaultTimeout, task.Timeout);
     Assert.AreEqual(null, task.Logger);
 }
        public void ReadSubClassWithEncodedXmlInProperty()
        {
            string    xml       = TestClass.GetXml(DateTime.Now, @"<inner classType=""sub""><subzero>-40</subzero><name>&lt;![CDATA[&lt;message/&gt;]]&gt;&lt;!foo&gt;&amp;quot;</name><present>here</present></inner>");
            TestClass testClass = (TestClass)NetReflector.Read(xml, table);

            Assert.AreEqual(@"<![CDATA[<message/>]]><!foo>&quot;", testClass.InnerClass.InnerName);
        }
        public void CanCatchInvalidGetSourceFlagConfiguration()
        {
            const string invalidXml = "<sourcecontrol type=\"alienbrain\"><autoGetSource>NOT_A_BOOLEAN</autoGetSource></sourcecontrol>";

            Assert.That(delegate { NetReflector.Read(invalidXml); },
                        Throws.TypeOf <NetReflectorException>());
        }
示例#26
0
        public void PopulateFromReflector()
        {
            const string xml = @"
    <exec>
        <executable>mybatchfile.bat</executable>
        <baseDirectory>C:\</baseDirectory>
	<buildArgs>myarg1 myarg2</buildArgs>
	<buildTimeoutSeconds>123</buildTimeoutSeconds>
        <environment>
		<variable name=""name1"" value=""value1""/>
		<variable><name>name2</name></variable>
		<variable name=""name3""><value>value3</value></variable>
	</environment>
    <priority>BelowNormal</priority>
	<successExitCodes>0,1,3,5</successExitCodes>
    </exec>";

            task = (ExecutableTask)NetReflector.Read(xml);
            Assert.AreEqual(@"C:\", task.ConfiguredBaseDirectory, "Checking ConfiguredBaseDirectory property.");
            Assert.AreEqual("mybatchfile.bat", task.Executable, "Checking property.");
            Assert.AreEqual(123, task.BuildTimeoutSeconds, "Checking BuildTimeoutSeconds property.");
            Assert.AreEqual("myarg1 myarg2", task.BuildArgs, "Checking BuildArgs property.");
            Assert.AreEqual(3, task.EnvironmentVariables.Length, "Checking environment variable array size.");
            Assert.AreEqual("name1", task.EnvironmentVariables[0].name, "Checking name1 environment variable.");
            Assert.AreEqual("value1", task.EnvironmentVariables[0].value, "Checking name1 environment value.");
            Assert.AreEqual("name2", task.EnvironmentVariables[1].name, "Checking name2 environment variable.");
            Assert.AreEqual("", task.EnvironmentVariables[1].value, "Checking name2 environment value.");
            Assert.AreEqual("name3", task.EnvironmentVariables[2].name, "Checking name3 environment variable.");
            Assert.AreEqual("value3", task.EnvironmentVariables[2].value, "Checking name3 environment value.");
            Assert.AreEqual("0,1,3,5", task.SuccessExitCodes);
            Assert.AreEqual(ProcessPriorityClass.BelowNormal, task.Priority);
            Verify();
        }
        public void PopulateFromReflector()
        {
            var          task = new DumpValueTask();
            const string xml  = @"
    <dumpValue>
        <xmlFileName>C:\some\path\to\file.xml</xmlFileName>
        <dumpValueItems>
            <dumpValueItem name='The Name' value='something' />
            <dumpValueItem name='The Name 2' value='some other thing' />
            <dumpValueItem name='The Name 3' value='stuff' />
            <dumpValueItem name='The Name 4' value='last but not least' />
            <dumpValueItem name='NotInCDATA' value='given data' valueInCDATA='false' />
        </dumpValueItems>
    </dumpValue>";

            NetReflector.Read(xml, task);
            Assert.AreEqual(@"C:\some\path\to\file.xml", task.XmlFileName);
            Assert.AreEqual(5, task.Items.Length);
            Assert.AreEqual("The Name", task.Items[0].Name);
            Assert.AreEqual("something", task.Items[0].Value);
            Assert.IsTrue(task.Items[0].ValueInCDATA);
            Assert.AreEqual("The Name 2", task.Items[1].Name);
            Assert.AreEqual("some other thing", task.Items[1].Value);
            Assert.IsTrue(task.Items[1].ValueInCDATA);
            Assert.AreEqual("The Name 3", task.Items[2].Name);
            Assert.AreEqual("stuff", task.Items[2].Value);
            Assert.IsTrue(task.Items[2].ValueInCDATA);
            Assert.AreEqual("The Name 4", task.Items[3].Name);
            Assert.AreEqual("last but not least", task.Items[3].Value);
            Assert.IsTrue(task.Items[3].ValueInCDATA);
            Assert.AreEqual("NotInCDATA", task.Items[4].Name);
            Assert.AreEqual("given data", task.Items[4].Value);
            Assert.IsFalse(task.Items[4].ValueInCDATA);
        }
        public void ShouldLoadAllValuesFromConfiguration()
        {
            string xml = @"
<powershell>
    <script>testscript.ps1</script>    
	<executable>c:\powershell\powershell.exe</executable>
	<scriptsDirectory>D:\CruiseControl</scriptsDirectory>
	<buildArgs>-noprofile</buildArgs>
	<buildTimeoutSeconds>4</buildTimeoutSeconds>
	<successExitCodes>1</successExitCodes>
	<environment>
        <variable name=""Env1"" value=""value1""/>
        <variable name=""Env2"" value=""value2""/>
   </environment>
</powershell>";

            PowerShellTask task = (PowerShellTask)NetReflector.Read(xml);

            Assert.AreEqual(@"c:\powershell\powershell.exe", task.Executable);
            Assert.AreEqual(@"testscript.ps1", task.Script);
            Assert.AreEqual(@"D:\CruiseControl", task.ConfiguredScriptsDirectory);
            Assert.AreEqual(@"-noprofile", task.BuildArgs);
            Assert.AreEqual(4, task.BuildTimeoutSeconds);
            Assert.AreEqual("1", task.SuccessExitCodes);
            Assert.AreEqual("value1", task.EnvironmentVariables[0].value);
            Assert.AreEqual("Env1", task.EnvironmentVariables[0].name);
            Assert.AreEqual("value2", task.EnvironmentVariables[1].value);
            Assert.AreEqual("Env2", task.EnvironmentVariables[1].name);
        }
示例#29
0
        public void PopulateFromReflector()
        {
            const string xml = @"
    <nant>
        <executable>NAnt.exe</executable>
        <baseDirectory>C:\</baseDirectory>
        <buildFile>mybuild.build</buildFile>
		<targetList>
            <target>foo</target>
        </targetList>
		<logger>SourceForge.NAnt.XmlLogger</logger>
		<listener>CCNetListener, CCNetListener</listener>
		<buildTimeoutSeconds>123</buildTimeoutSeconds>
		<nologo>FALSE</nologo>
    </nant>";

            NetReflector.Read(xml, builder);
            Assert.AreEqual(@"C:\", builder.ConfiguredBaseDirectory);
            Assert.AreEqual("mybuild.build", builder.BuildFile);
            Assert.AreEqual("NAnt.exe", builder.Executable);
            Assert.AreEqual(1, builder.Targets.Length);
            Assert.AreEqual(123, builder.BuildTimeoutSeconds);
            Assert.AreEqual("SourceForge.NAnt.XmlLogger", builder.Logger);
            Assert.AreEqual("CCNetListener, CCNetListener", builder.Listener);
            Assert.AreEqual("foo", builder.Targets[0]);
            Assert.AreEqual(false, builder.NoLogo);
        }
示例#30
0
        public void ShouldUseCustomSerialiserFactory()
        {
            string xml = @"<customSerialiser><foo>3</foo></customSerialiser>";
            TestCustomSerialiser test = (TestCustomSerialiser)NetReflector.Read(xml);

            Assert.AreEqual(2, test.Foo);
        }