Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions scripts/StockTicker.build
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@
<property name="sources" value="${base_dir}\source" readonly="true" />
<property name="publish" value="${base_dir}\publish" readonly="true" />
<property name="tools_dir" value="${base_dir}\tools" />
<property name="xUnitConsole" value="${sources}\packages\xunit.runners\tools\xunit.console.clr4.x86.exe" />
<property name="mspec" value="${sources}\packages\Machine.Specifications\tools\mspec-clr4.exe" />
<property name="xUnitConsole" value="${sources}\packages\xunit.runners.1.9.1\tools\xunit.console.clr4.x86.exe" />
<property name="mspec" value="${sources}\packages\Machine.Specifications.0.5.12\tools\mspec-clr4.exe" />
<property name="git" value="${tools_dir}\git\git.exe" />
<property name="nuget.console" value="${tools_dir}\NuGet\nuget.exe" />

Expand Down
6 changes: 6 additions & 0 deletions source/.nuget/NuGet.Config
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<solution>
<add key="disableSourceControlIntegration" value="true" />
</solution>
</configuration>
Binary file added source/.nuget/NuGet.exe
Binary file not shown.
151 changes: 151 additions & 0 deletions source/.nuget/NuGet.targets
Original file line number Diff line number Diff line change
@@ -0,0 +1,151 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">$(MSBuildProjectDirectory)\..\</SolutionDir>

<!-- Enable the restore command to run before builds -->
<RestorePackages Condition=" '$(RestorePackages)' == '' ">false</RestorePackages>

<!-- Property that enables building a package from a project -->
<BuildPackage Condition=" '$(BuildPackage)' == '' ">false</BuildPackage>

<!-- Determines if package restore consent is required to restore packages -->
<RequireRestoreConsent Condition=" '$(RequireRestoreConsent)' != 'false' ">true</RequireRestoreConsent>

<!-- Download NuGet.exe if it does not already exist -->
<DownloadNuGetExe Condition=" '$(DownloadNuGetExe)' == '' ">false</DownloadNuGetExe>
</PropertyGroup>

<ItemGroup Condition=" '$(PackageSources)' == '' ">
<!-- Package sources used to restore packages. By default, registered sources under %APPDATA%\NuGet\NuGet.Config will be used -->
<!-- The official NuGet package source (https://nuget.org/api/v2/) will be excluded if package sources are specified and it does not appear in the list -->
<!--
<PackageSource Include="https://nuget.org/api/v2/" />
<PackageSource Include="https://my-nuget-source/nuget/" />
-->
</ItemGroup>

<PropertyGroup Condition=" '$(OS)' == 'Windows_NT'">
<!-- Windows specific commands -->
<NuGetToolsPath>$([System.IO.Path]::Combine($(SolutionDir), ".nuget"))</NuGetToolsPath>
<PackagesConfig>$([System.IO.Path]::Combine($(ProjectDir), "packages.config"))</PackagesConfig>
</PropertyGroup>

<PropertyGroup Condition=" '$(OS)' != 'Windows_NT'">
<!-- We need to launch nuget.exe with the mono command if we're not on windows -->
<NuGetToolsPath>$(SolutionDir).nuget</NuGetToolsPath>
<PackagesConfig>packages.config</PackagesConfig>
</PropertyGroup>

<PropertyGroup>
<!-- NuGet command -->
<NuGetExePath Condition=" '$(NuGetExePath)' == '' ">$(NuGetToolsPath)\nuget.exe</NuGetExePath>
<PackageSources Condition=" $(PackageSources) == '' ">@(PackageSource)</PackageSources>

<NuGetCommand Condition=" '$(OS)' == 'Windows_NT'">"$(NuGetExePath)"</NuGetCommand>
<NuGetCommand Condition=" '$(OS)' != 'Windows_NT' ">mono --runtime=v4.0.30319 $(NuGetExePath)</NuGetCommand>

<PackageOutputDir Condition="$(PackageOutputDir) == ''">$(TargetDir.Trim('\\'))</PackageOutputDir>

<RequireConsentSwitch Condition=" $(RequireRestoreConsent) == 'true' ">-RequireConsent</RequireConsentSwitch>
<!-- Commands -->
<RestoreCommand>$(NuGetCommand) install "$(PackagesConfig)" -source "$(PackageSources)" $(RequireConsentSwitch) -solutionDir "$(SolutionDir) "</RestoreCommand>
<BuildCommand>$(NuGetCommand) pack "$(ProjectPath)" -p Configuration=$(Configuration) -o "$(PackageOutputDir)" -symbols</BuildCommand>

<!-- We need to ensure packages are restored prior to assembly resolve -->
<BuildDependsOn Condition="$(RestorePackages) == 'true'">
RestorePackages;
$(BuildDependsOn);
</BuildDependsOn>

<!-- Make the build depend on restore packages -->
<BuildDependsOn Condition="$(BuildPackage) == 'true'">
$(BuildDependsOn);
BuildPackage;
</BuildDependsOn>
</PropertyGroup>

<Target Name="CheckPrerequisites">
<!-- Raise an error if we're unable to locate nuget.exe -->
<Error Condition="'$(DownloadNuGetExe)' != 'true' AND !Exists('$(NuGetExePath)')" Text="Unable to locate '$(NuGetExePath)'" />
<SetEnvironmentVariable EnvKey="VisualStudioVersion" EnvValue="$(VisualStudioVersion)" Condition=" '$(VisualStudioVersion)' != '' AND '$(OS)' == 'Windows_NT' " />
<!--
Take advantage of MsBuild's build dependency tracking to make sure that we only ever download nuget.exe once.
This effectively acts as a lock that makes sure that the download operation will only happen once and all
parallel builds will have to wait for it to complete.
-->
<MsBuild Targets="_DownloadNuGet" Projects="$(MSBuildThisFileFullPath)" Properties="Configuration=NOT_IMPORTANT" />
</Target>

<Target Name="_DownloadNuGet">
<DownloadNuGet OutputFilename="$(NuGetExePath)" Condition=" '$(DownloadNuGetExe)' == 'true' AND !Exists('$(NuGetExePath)')" />
</Target>

<Target Name="RestorePackages" DependsOnTargets="CheckPrerequisites">
<Exec Command="$(RestoreCommand)"
Condition="'$(OS)' != 'Windows_NT' And Exists('$(PackagesConfig)')" />

<Exec Command="$(RestoreCommand)"
LogStandardErrorAsError="true"
Condition="'$(OS)' == 'Windows_NT' And Exists('$(PackagesConfig)')" />
</Target>

<Target Name="BuildPackage" DependsOnTargets="CheckPrerequisites">
<Exec Command="$(BuildCommand)"
Condition=" '$(OS)' != 'Windows_NT' " />

<Exec Command="$(BuildCommand)"
LogStandardErrorAsError="true"
Condition=" '$(OS)' == 'Windows_NT' " />
</Target>

<UsingTask TaskName="DownloadNuGet" TaskFactory="CodeTaskFactory" AssemblyFile="$(MSBuildToolsPath)\Microsoft.Build.Tasks.v4.0.dll">
<ParameterGroup>
<OutputFilename ParameterType="System.String" Required="true" />
</ParameterGroup>
<Task>
<Reference Include="System.Core" />
<Using Namespace="System" />
<Using Namespace="System.IO" />
<Using Namespace="System.Net" />
<Using Namespace="Microsoft.Build.Framework" />
<Using Namespace="Microsoft.Build.Utilities" />
<Code Type="Fragment" Language="cs">
<![CDATA[
try {
OutputFilename = Path.GetFullPath(OutputFilename);

Log.LogMessage("Downloading latest version of NuGet.exe...");
WebClient webClient = new WebClient();
webClient.DownloadFile("https://nuget.org/nuget.exe", OutputFilename);

return true;
}
catch (Exception ex) {
Log.LogErrorFromException(ex);
return false;
}
]]>
</Code>
</Task>
</UsingTask>

<UsingTask TaskName="SetEnvironmentVariable" TaskFactory="CodeTaskFactory" AssemblyFile="$(MSBuildToolsPath)\Microsoft.Build.Tasks.v4.0.dll">
<ParameterGroup>
<EnvKey ParameterType="System.String" Required="true" />
<EnvValue ParameterType="System.String" Required="true" />
</ParameterGroup>
<Task>
<Using Namespace="System" />
<Code Type="Fragment" Language="cs">
<![CDATA[
try {
Environment.SetEnvironmentVariable(EnvKey, EnvValue, System.EnvironmentVariableTarget.Process);
}
catch {
}
]]>
</Code>
</Task>
</UsingTask>
</Project>
4 changes: 4 additions & 0 deletions source/.nuget/packages.config
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="xunit.runners" version="1.9.1" />
</packages>
5 changes: 0 additions & 5 deletions source/StockTicker.Specification/SpecificationBootstrapper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -35,11 +35,6 @@ public IKernel StandardKernel
}
}

public void Start()
{
this.OnStartup(this, null);
}

public void Stop()
{
this.OnExit(this, null);
Expand Down
26 changes: 15 additions & 11 deletions source/StockTicker.Specification/StockTicker.Specification.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -3,38 +3,41 @@
<PropertyGroup>
<StockTickerProjectName>StockTicker</StockTickerProjectName>
<StockTickerProjectType>Specification</StockTickerProjectType>
<SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\</SolutionDir>
<RestorePackages>true</RestorePackages>
</PropertyGroup>
<PropertyGroup>
<ProjectGuid>{FA85776B-D3B5-439D-A349-5CD1108CE8CB}</ProjectGuid>
<OutputType>Library</OutputType>
</PropertyGroup>
<ItemGroup>
<Reference Include="Caliburn.Micro">
<HintPath>..\packages\Caliburn.Micro\lib\net40\Caliburn.Micro.dll</HintPath>
</Reference>
<Reference Include="Machine.Specifications, Version=0.5.6.0, Culture=neutral, processorArchitecture=MSIL">
<Reference Include="Caliburn.Micro, Version=1.5.1.0, Culture=neutral, PublicKeyToken=8e5891231f2ed21f, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\packages\Machine.Specifications\lib\net40\Machine.Specifications.dll</HintPath>
<HintPath>..\packages\Caliburn.Micro.1.5.1\lib\net40\Caliburn.Micro.dll</HintPath>
</Reference>
<Reference Include="Machine.Specifications">
<HintPath>..\packages\Machine.Specifications.0.5.12\lib\net40\Machine.Specifications.dll</HintPath>
</Reference>
<Reference Include="Machine.Specifications.Clr4">
<HintPath>..\packages\Machine.Specifications\lib\net40\Machine.Specifications.Clr4.dll</HintPath>
<HintPath>..\packages\Machine.Specifications.0.5.12\lib\net40\Machine.Specifications.Clr4.dll</HintPath>
</Reference>
<Reference Include="Ninject, Version=3.0.0.0, Culture=neutral, PublicKeyToken=c7192dc5380945e7, processorArchitecture=MSIL">
<HintPath>..\packages\Ninject\lib\net40\Ninject.dll</HintPath>
<Reference Include="Ninject">
<HintPath>..\packages\Ninject.3.0.1.10\lib\net40\Ninject.dll</HintPath>
</Reference>
<Reference Include="PresentationCore" />
<Reference Include="PresentationFramework" />
<Reference Include="System" />
<Reference Include="System.Core" />
<Reference Include="System.Windows.Interactivity, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\packages\Caliburn.Micro.1.5.1\lib\net40\System.Windows.Interactivity.dll</HintPath>
</Reference>
<Reference Include="System.Xaml" />
<Reference Include="System.Xml.Linq" />
<Reference Include="System.Data.DataSetExtensions" />
<Reference Include="Microsoft.CSharp" />
<Reference Include="System.Data" />
<Reference Include="System.Xml" />
<Reference Include="Thinktecture.UIAnnotations">
<HintPath>..\packages\thinktectureUIAnnotationsWPF\lib\Thinktecture.UIAnnotations.dll</HintPath>
</Reference>
<Reference Include="WindowsBase" />
</ItemGroup>
<ItemGroup>
Expand All @@ -57,4 +60,5 @@
</ProjectReference>
</ItemGroup>
<Import Project="$(SolutionDir)\StockTicker.msbuild" />
<Import Project="$(SolutionDir)\.nuget\nuget.targets" />
</Project>
6 changes: 3 additions & 3 deletions source/StockTicker.Specification/packages.config
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="Caliburn.Micro" version="1.3.1" />
<package id="Machine.Specifications" version="0.5.6.0" />
<package id="Ninject" version="3.0.0.15" />
<package id="Caliburn.Micro" version="1.5.1" targetFramework="net40" />
<package id="Machine.Specifications" version="0.5.12" targetFramework="net40" />
<package id="Ninject" version="3.0.1.10" targetFramework="net40" />
<package id="thinktectureUIAnnotationsWPF" version="0.10" />
</packages>
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ namespace StockTicker.Actions
using System;

using FluentAssertions;
using FluentAssertions.EventMonitoring;
using Xunit;

public class BusyIndicationViewModelTest
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@ namespace StockTicker.Actions
using System.Linq;
using Caliburn.Micro;
using FluentAssertions;
using FluentAssertions.EventMonitoring;
using Moq;
using StockTicker.TestHelpers;
using Xunit;
Expand Down
1 change: 0 additions & 1 deletion source/StockTicker.Test/Actions/ResultDecoraterBaseTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ namespace StockTicker.Actions
using System;
using Caliburn.Micro;
using FluentAssertions;
using FluentAssertions.EventMonitoring;
using Moq;

using StockTicker.TestHelpers;
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
//-------------------------------------------------------------------------------
// <copyright file="UseActionsActivationStrategyTest.cs" company="bbv Software Services AG">
// Copyright (c) 2012
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
// </copyright>
//-------------------------------------------------------------------------------

namespace StockTicker.Actions
{
using System;

using FluentAssertions;

using Moq;

using Ninject;
using Ninject.Activation.Strategies;

using Xunit;

public class UseActionsActivationStrategyTest
{
private readonly StandardKernel kernel;

public UseActionsActivationStrategyTest()
{
this.kernel = new StandardKernel();
this.kernel.Bind<TestObjectWithUseActions>().ToSelf();
this.kernel.Bind<IActionBuilder>().ToMethod(ctx => Mock.Of<IActionBuilder>());

this.kernel.Components.Add<IActivationStrategy, UseActionsActivationStrategy>();
}

private interface ITestObjectWithUseAction : IUseActions
{
}

[Fact]
public void WhenActivatedObjectUsesActions_ShouldAttachActionBuilder()
{
var useActions = this.kernel.Get<TestObjectWithUseActions>();

useActions.Actions.Should().NotBeNull();
useActions.Actions().Should().NotBeNull();
}

private class TestObjectWithUseActions : ITestObjectWithUseAction
{
public Func<IActionBuilder> Actions { internal get; set; }
}
}
}
Loading