Skip to content

Commit

Permalink
Initial
Browse files Browse the repository at this point in the history
  • Loading branch information
aldefalco committed Aug 13, 2014
0 parents commit e73c21e
Show file tree
Hide file tree
Showing 33 changed files with 1,844 additions and 0 deletions.
27 changes: 27 additions & 0 deletions UnitTestFlickrView/App.config
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<appSettings>
<add key="UserName" />
<add key="ClientSettingsProvider.ServiceUri" value="" />
</appSettings>
<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<assemblyIdentity name="Microsoft.Practices.ServiceLocation" publicKeyToken="31bf3856ad364e35" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-1.3.0.0" newVersion="1.3.0.0" />
</dependentAssembly>
</assemblyBinding>
</runtime>
<system.web>
<membership defaultProvider="ClientAuthenticationMembershipProvider">
<providers>
<add name="ClientAuthenticationMembershipProvider" type="System.Web.ClientServices.Providers.ClientFormsAuthenticationMembershipProvider, System.Web.Extensions, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" serviceUri="" />
</providers>
</membership>
<roleManager defaultProvider="ClientRoleProvider" enabled="true">
<providers>
<add name="ClientRoleProvider" type="System.Web.ClientServices.Providers.ClientRoleProvider, System.Web.Extensions, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" serviceUri="" cacheTimeout="86400" />
</providers>
</roleManager>
</system.web>
</configuration>
Binary file added UnitTestFlickrView/FlickrNet.chm
Binary file not shown.
50 changes: 50 additions & 0 deletions UnitTestFlickrView/MainViewModelTest.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
using System;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using WPFFlickrView.ViewModel;

namespace UnitTestFlickrView
{
[TestClass]
public class MainViewModelTest
{
[TestMethod]
public void TestSearchForT1()
{
var s = new TestImageService();
var viewModel = new MainViewModel(s);

viewModel.TagsFilter = "T1";
viewModel.Search.Execute(null);

Assert.AreEqual("A", viewModel.Images[0].Title);
Assert.AreEqual("C", viewModel.Images[1].Title);
}

[TestMethod]
public void TestSearchForT2()
{
var s = new TestImageService();
var viewModel = new MainViewModel(s);

viewModel.TagsFilter = "T2";
viewModel.Search.Execute(null);

Assert.AreEqual("B", viewModel.Images[0].Title);
Assert.AreEqual("C", viewModel.Images[1].Title);
}

[TestMethod]
public void TestCurrentAndComments()
{
var s = new TestImageService();
var viewModel = new MainViewModel(s);

var current = new ImageViewModel();
current.Id = "101";
viewModel.ChangeCurrent.Execute(current);

Assert.AreEqual(current, viewModel.Current);
Assert.AreEqual("101", viewModel.Current.Comments[0].Id);
}
}
}
36 changes: 36 additions & 0 deletions UnitTestFlickrView/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;

// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("UnitTestFlickrView")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("UnitTestFlickrView")]
[assembly: AssemblyCopyright("Copyright © 2014")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]

// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]

// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("3196f553-09ff-4047-92a5-6423ce72b771")]

// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]
32 changes: 32 additions & 0 deletions UnitTestFlickrView/TestImageService.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using WPFFlickrView.Model;

namespace UnitTestFlickrView
{
class TestImageService : IImageService
{
public void Search(ImageSearchQuery query, Action<IEnumerable<Image>, Exception> result)
{
var images = new List<Image>();
images.Add(new Image() { Title = "A", Thumbnail = "https://aaa.com/thumbnail", Description = "A description", Url = "https://aaa.ru/full" , Tags="T1" });
images.Add(new Image() { Title = "B", Thumbnail = "https://bbb.com/thumbnail", Description = "B description", Url = "https://bbb.ru/full", Tags = "T2" });
images.Add(new Image() { Title = "C", Thumbnail = "https://ccc.com/thumbnail", Description = "C description", Url = "https://ccc.ru/full", Tags = "T1 T2" });
images.Add(new Image() { Title = "D", Thumbnail = "https://ddd.com/thumbnail", Description = "D description", Url = "https://ddd.ru/full", Tags = "T3" });

var filtered = from i in images where i.Tags.Contains(query.Tags[0]) select i;

result(filtered, null);
}

public void Comments(string id, Action<IEnumerable<Comment>, Exception> result)
{
var comments = new List<Comment>();
comments.Add(new Comment() { Id = id, Body = "1 Body", UserName = "1 user", Url = "https://aaa.ru/1", UserId=id });
result(comments, null);
}
}
}
112 changes: 112 additions & 0 deletions UnitTestFlickrView/UnitTestFlickrView.csproj
Original file line number Diff line number Diff line change
@@ -0,0 +1,112 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProjectGuid>{7B554E88-DBFD-4670-8010-FF313A9C40BE}</ProjectGuid>
<OutputType>Library</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>UnitTestFlickrView</RootNamespace>
<AssemblyName>UnitTestFlickrView</AssemblyName>
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<ProjectTypeGuids>{3AC096D0-A1C2-E12C-1390-A8335801FDAB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
<VisualStudioVersion Condition="'$(VisualStudioVersion)' == ''">10.0</VisualStudioVersion>
<VSToolsPath Condition="'$(VSToolsPath)' == ''">$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)</VSToolsPath>
<ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\$(VisualStudioVersion)\UITestExtensionPackages</ReferencePath>
<IsCodedUITest>False</IsCodedUITest>
<TestProjectType>UnitTest</TestProjectType>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<ItemGroup>
<Reference Include="FlickrNet">
<HintPath>..\packages\FlickrNet.3.14.0\lib\net20\FlickrNet.dll</HintPath>
</Reference>
<Reference Include="GalaSoft.MvvmLight">
<HintPath>..\packages\MvvmLightLibs.4.4.32.1\lib\net45\GalaSoft.MvvmLight.dll</HintPath>
</Reference>
<Reference Include="GalaSoft.MvvmLight.Extras">
<HintPath>..\packages\MvvmLightLibs.4.4.32.1\lib\net45\GalaSoft.MvvmLight.Extras.dll</HintPath>
</Reference>
<Reference Include="Microsoft.Practices.ServiceLocation">
<HintPath>..\packages\CommonServiceLocator.1.3\lib\portable-net4+sl5+netcore45+wpa81+wp8\Microsoft.Practices.ServiceLocation.dll</HintPath>
</Reference>
<Reference Include="System" />
<Reference Include="System.Configuration" />
<Reference Include="System.Web.Extensions" />
<Reference Include="System.Windows.Interactivity, Version=4.5.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
<HintPath>..\packages\MvvmLightLibs.4.4.32.1\lib\net45\System.Windows.Interactivity.dll</HintPath>
</Reference>
</ItemGroup>
<Choose>
<When Condition="('$(VisualStudioVersion)' == '10.0' or '$(VisualStudioVersion)' == '') and '$(TargetFrameworkVersion)' == 'v3.5'">
<ItemGroup>
<Reference Include="Microsoft.VisualStudio.QualityTools.UnitTestFramework, Version=10.1.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL" />
</ItemGroup>
</When>
<Otherwise>
<ItemGroup>
<Reference Include="Microsoft.VisualStudio.QualityTools.UnitTestFramework" />
</ItemGroup>
</Otherwise>
</Choose>
<ItemGroup>
<Compile Include="MainViewModelTest.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="TestImageService.cs" />
</ItemGroup>
<ItemGroup>
<None Include="App.config" />
<None Include="FlickrNet.chm" />
<None Include="packages.config" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\WPFFlickrView\WPFFlickrView.csproj">
<Project>{1f3d5e16-bace-4abf-8630-c46a1b9c2a46}</Project>
<Name>WPFFlickrView</Name>
</ProjectReference>
</ItemGroup>
<Choose>
<When Condition="'$(VisualStudioVersion)' == '10.0' And '$(IsCodedUITest)' == 'True'">
<ItemGroup>
<Reference Include="Microsoft.VisualStudio.QualityTools.CodedUITestFramework, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<Private>False</Private>
</Reference>
<Reference Include="Microsoft.VisualStudio.TestTools.UITest.Common, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<Private>False</Private>
</Reference>
<Reference Include="Microsoft.VisualStudio.TestTools.UITest.Extension, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<Private>False</Private>
</Reference>
<Reference Include="Microsoft.VisualStudio.TestTools.UITesting, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<Private>False</Private>
</Reference>
</ItemGroup>
</When>
</Choose>
<Import Project="$(VSToolsPath)\TeamTest\Microsoft.TestTools.targets" Condition="Exists('$(VSToolsPath)\TeamTest\Microsoft.TestTools.targets')" />
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets.
<Target Name="BeforeBuild">
</Target>
<Target Name="AfterBuild">
</Target>
-->
</Project>
6 changes: 6 additions & 0 deletions UnitTestFlickrView/packages.config
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="CommonServiceLocator" version="1.3" targetFramework="net45" />
<package id="FlickrNet" version="3.14.0" targetFramework="net45" />
<package id="MvvmLightLibs" version="4.4.32.1" targetFramework="net45" />
</packages>
26 changes: 26 additions & 0 deletions WPFFlickrView.sln
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 2012
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "WPFFlickrView", "WPFFlickrView\WPFFlickrView.csproj", "{1F3D5E16-BACE-4ABF-8630-C46A1B9C2A46}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "UnitTestFlickrView", "UnitTestFlickrView\UnitTestFlickrView.csproj", "{7B554E88-DBFD-4670-8010-FF313A9C40BE}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{1F3D5E16-BACE-4ABF-8630-C46A1B9C2A46}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{1F3D5E16-BACE-4ABF-8630-C46A1B9C2A46}.Debug|Any CPU.Build.0 = Debug|Any CPU
{1F3D5E16-BACE-4ABF-8630-C46A1B9C2A46}.Release|Any CPU.ActiveCfg = Release|Any CPU
{1F3D5E16-BACE-4ABF-8630-C46A1B9C2A46}.Release|Any CPU.Build.0 = Release|Any CPU
{7B554E88-DBFD-4670-8010-FF313A9C40BE}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{7B554E88-DBFD-4670-8010-FF313A9C40BE}.Debug|Any CPU.Build.0 = Debug|Any CPU
{7B554E88-DBFD-4670-8010-FF313A9C40BE}.Release|Any CPU.ActiveCfg = Release|Any CPU
{7B554E88-DBFD-4670-8010-FF313A9C40BE}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
EndGlobal
16 changes: 16 additions & 0 deletions WPFFlickrView/App.xaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
<Application x:Class="WPFFlickrView.App"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:vm="clr-namespace:WPFFlickrView.ViewModel"
StartupUri="MainWindow.xaml"
mc:Ignorable="d">

<Application.Resources>
<!--Global View Model Locator-->
<vm:ViewModelLocator x:Key="Locator"
d:IsDataSource="True" />
</Application.Resources>

</Application>
16 changes: 16 additions & 0 deletions WPFFlickrView/App.xaml.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
using System.Windows;
using GalaSoft.MvvmLight.Threading;

namespace WPFFlickrView
{
/// <summary>
/// Interaction logic for App.xaml
/// </summary>
public partial class App : Application
{
static App()
{
DispatcherHelper.Initialize();
}
}
}
24 changes: 24 additions & 0 deletions WPFFlickrView/Converters/NullToCollapsed.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Data;

namespace WPFFlickrView.Converters
{
internal class NullToCollapsed : IValueConverter
{
public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
{
return value == null ? Visibility.Collapsed : Visibility.Visible;
}

public object ConvertBack(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
{
throw new NotImplementedException();
}
}

}
26 changes: 26 additions & 0 deletions WPFFlickrView/Design/DesignService.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
using FlickrNet;
using System;
using System.Collections.Generic;
using WPFFlickrView.Model;

namespace WPFFlickrView.Design
{
public class DesignService : IImageService
{
public void Search(ImageSearchQuery option, Action<IEnumerable<Image>, Exception> callback)
{
var images = new List<Image>();
images.Add(new Image() { Title = "Google", Thumbnail = "https://www.google.ru/images/srpr/logo11w.png", Description = "Google description", Url = "https://www.google.ru/images/srpr/logo11w.png" });
images.Add(new Image() { Title = "Microsoft", Thumbnail = "https://c.s-microsoft.com/ru-ru/CMSImages/mslogo.png?version=856673f8-e6be-0476-6669-d5bf2300391d" });
images.Add(new Image() { Title = "Google+", Thumbnail = "https://www.google.ru/images/srpr/logo11w.png" });
images.Add(new Image() { Title = "Microsoft", Thumbnail = "https://c.s-microsoft.com/ru-ru/CMSImages/mslogo.png?version=856673f8-e6be-0476-6669-d5bf2300391d" });
callback(images, null);
}

public void Comments(string id, Action<IEnumerable<Comment>, Exception> result)
{
throw new NotImplementedException();
}

}
}
Binary file added WPFFlickrView/FlickrNet.chm
Binary file not shown.
Loading

0 comments on commit e73c21e

Please sign in to comment.