Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update develop #218

Open
wants to merge 5 commits into
base: develop
Choose a base branch
from
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
53 changes: 37 additions & 16 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,26 +1,29 @@
QWIQ
QWIQ
=======

[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://github.com/MicrosoftEdge/Microsoft.Qwiq/blob/master/LICENSE) [![AppVeyor](https://img.shields.io/appveyor/ci/MicrosoftEdge/Microsoft-Qwiq.svg)]() [![qwiq MyGet Build Status](https://www.myget.org/BuildSource/Badge/qwiq?identifier=6c2b6200-0621-4b3f-ba6b-b28d2b785765)](https://www.myget.org/)
[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://github.com/LeCantaloop/Qwiq/blob/master/LICENSE) [![Build status: DEVELOP](https://ci.appveyor.com/api/projects/status/jfi0nejktfny3dkf/branch/develop?svg=true)](https://ci.appveyor.com/project/LeCantaloop/microsoft-qwiq/branch/develop)

[![MyGet](https://img.shields.io/myget/qwiq/v/Microsoft.Qwiq.Core.svg)]() [![MyGet](https://img.shields.io/myget/qwiq/vpre/Microsoft.Qwiq.Core.svg)]()
[![MyGet](https://img.shields.io/myget/qwiq/v/Qwiq.Core.svg)](https://myget.org/feed/qwiq/package/nuget/Qwiq.Core) [![MyGet](https://img.shields.io/myget/qwiq/vpre/Qwiq.Core.svg)](https://myget.org/feed/qwiq/package/nuget/Qwiq.Core)

QWIQ is a **Q**uick **W**ork **I**tem **Q**uery library for Team Foundation Server / Visual Studio Online. If you do a lot of reading or writing of work items, this package is for you!

## What can it be used for?
Querying Team Foundation Server, of course! Instead of directly using the TFS Client OM, you could use QWIQ! It it made of packages designed to make working with Tfs/Vso a pleasure. Qwiq.Core is the no-frills base package, exposinng the raw types needed to read and write work items. Qwiq.Identity adds methods to simplify converting between your preferred method of identity (display names, user names) and TFS's identity classes. Qwiq.Linq provides a Linq query provider to be able to write Linq to query tfs. Qwiq.Mapper enables converting from IWorkItem, the raw Qwiq.Core type, to your own classes to enable strongly typed access to your WorkItems. Qwiq.Relatives extends Qwiq.Linq to enable slightly more complicated queries allowing for basic queries of related workitems. Qwiq.Mocks provides default implementations for commonly mocked classes within Qwiq, and should allow for getting up and unit testing quickly. Why use this over the Client OM? Glad you asked!

### 1. Easier to consume
Let's be honest, the TFS libraries are a pain to use. There are a lot of them, several are dynamically loaded, and a few are native. While we can't avoid it, you can! Just install the Qwiq.Core package and everything will be in your \bin folder when you need it.
Let's be honest, the TFS libraries are a pain to use. There are a lot of them, several are dynamically loaded, and a few are native. While we can't avoid it, you can! Just install the [`Qwiq.Core`](https://www.nuget.org/packages/Qwiq.Core/) package and everything will be in your \bin folder when you need it.

### 2. Easier to test
Qwiq makes testing your apps a breeze. Everything has an interface. Everything uses factories (or factory methods) instead of constructors. Just mock what you need for your tests and go. No more messy, temperamental fakes, or adapters cluttering your code.
Qwiq makes testing your apps a breeze. Everything has an interface. Everything uses factories (or factory methods) instead of constructors. Install our [`Qwiq.Mocks`](https://www.nuget.org/packages/Qwiq.Mocks/) package for easy to use mocks, or mock what you need from out interfaces for your tests and go. No more messy, temperamental fakes, or adapters cluttering your code.

### 3. Easier to understand
How often do you update a work item? How often do you create a new security group? We stripped out the rarely used stuff to make interfaces cleaner and the relationships between types simpler. Missing something you can't live without? Send us a pull request!

## How to install it
[Add our MyGet feed to your NuGet clients](https://docs.nuget.org/ndocs/tools/package-manager-ui#package-sources):
We have two ways you can install our packages: through NuGet.org which contains our stable packages only, and MyGet.org, which contains vNext and stable packages.


If you want our vNext packages, [add our MyGet feed to your NuGet clients](https://docs.nuget.org/ndocs/tools/package-manager-ui#package-sources):

- v3 (VS 2015+ / NuGet 3.x): `https://www.myget.org/F/qwiq/api/v3/index.json`
- v2 (VS 2013 / NuGet 2.x): `https://www.myget.org/F/qwiq/api/v2`
Expand All @@ -29,25 +32,41 @@ Once the feed is configured, install via the nuget UI or via the nuget package m

### Install Core
From the NuGet package manager console
NuGet
```
PM> Install-Package Qwiq.Core
```
Or via the UI [Qwiq.Core](https://www.nuget.org/packages/Qwiq.Core/)

MyGet
```
PM> Install-Package Microsoft.Qwiq.Core
PM> Install-Package Qwiq.Core -Source https://www.myget.org/F/qwiq/api/v3/index.json
```
Or via the UI [Microsoft.Qwiq.Core](https://www.myget.org/feed/qwiq/package/nuget/Microsoft.Qwiq.Core),
Or via the UI [Qwiq.Core](https://www.myget.org/feed/qwiq/package/nuget/Qwiq.Core),


### Install Client
We now have two clients: one for SOAP, and one for REST
NuGet
```
PM> Install-Package Qwiq.Client.Soap
```
Or via the UI [Qwiq.Client.Soap](https://www.nuget.org/packages/Qwiq.Client.Soap/),


From the NuGet package manager console
MyGet
```
PM> Install-Package Microsoft.Qwiq.Client.Soap
PM> Install-Package Qwiq.Client.Soap -Source https://www.myget.org/F/qwiq/api/v3/index.json
```
Or via the UI [Microsoft.Qwiq.Client.Soap](https://www.myget.org/feed/qwiq/package/nuget/Microsoft.Qwiq.Client.Soap),
Or via the UI [Qwiq.Client.Soap](https://www.myget.org/feed/qwiq/package/nuget/Qwiq.Client.Soap),

### Basic Usage
For .NET

```csharp
using Microsoft.Qwiq;
using Microsoft.Qwiq.Credentials;
using Qwiq;
using Qwiq.Credentials;

using Microsoft.VisualStudio.Services.Client;
...
Expand All @@ -73,14 +92,16 @@ var items = store.Query(@"
WHERE [System.WorkItemType] = 'Bug' AND State = 'Active'");
```

For PowerShell

```powershell
[Reflection.Assembly]::LoadFrom("E:\Path\To\Microsoft.Qwiq.Core.dll")
[Reflection.Assembly]::LoadFrom("E:\Path\To\Qwiq.Core.dll")
# Can use SOAP or REST clients here
[Reflection.Assembly]::LoadFrom("E:\Path\To\Microsoft.Qwiq.Client.Soap.dll")
[Reflection.Assembly]::LoadFrom("E:\Path\To\Qwiq.Client.Soap.dll")

$uri = [Uri]"[Tfs Tenant Uri]"
$options = New-Object Microsoft.Qwiq.Credentials.AuthenticationOptions $uri,Windows
$store = [Microsoft.Qwiq.Client.Soap.WorkItemStoreFactory]::Default.Create($options)
$options = New-Object Qwiq.Credentials.AuthenticationOptions $uri,Windows
$store = [Qwiq.Client.Soap.WorkItemStoreFactory]::Default.Create($options)

$items = $store.Query(@"
SELECT [System.Id]
Expand Down
35 changes: 31 additions & 4 deletions appveyor.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,17 +5,17 @@ platform: Any CPU
init:
- ps: IF ($env:APPVEYOR_REPO_BRANCH -eq "develop") {$env:APPVEYOR_CACHE_SKIP_SAVE = "true"}
install:
- choco install gitversion.portable -pre -y
cache:
- packages -> **\packages.config
- cmd: choco install gitversion.portable -version 4.0.0-beta0012 -pre -y
cache: packages -> **\packages.config
nuget:
account_feed: true
project_feed: true
disable_publish_on_pr: true
before_build:
- ps: >-
.\init.ps1;
& .\.tools\nuget.exe restore -NonInteractive -DisableParallelProcessing;
C:\ProgramData\chocolatey\bin\gfv.exe /l console /output buildserver;
gitversion /l console /output buildserver;
build:
publish_nuget: true
publish_nuget_symbols: true
Expand Down Expand Up @@ -43,6 +43,33 @@ deploy:
api_key:
secure: 8wGYx8W+ojYQJsAJpRLez+KwwFa+OW7cvsn5RoR08WQpi5klhTq/9b/9YaEu/5Bx
symbol_server: https://www.myget.org/F/qwiq/symbols/api/v2/package
on:
branch: dev(elop)?(ment)?$
GitVersion_PreReleaseLabel: ''
- provider: NuGet
server: https://www.myget.org/F/qwiq/api/v2/package
api_key:
secure: 8wGYx8W+ojYQJsAJpRLez+KwwFa+OW7cvsn5RoR08WQpi5klhTq/9b/9YaEu/5Bx
symbol_server: https://www.myget.org/F/qwiq/symbols/api/v2/package
on:
branch: master
GitVersion_PreReleaseLabel: ''
- provider: NuGet
server: https://www.myget.org/F/qwiq/api/v2/package
api_key:
secure: 8wGYx8W+ojYQJsAJpRLez+KwwFa+OW7cvsn5RoR08WQpi5klhTq/9b/9YaEu/5Bx
symbol_server: https://www.myget.org/F/qwiq/symbols/api/v2/package
on:
branch: releases?[/-]
GitVersion_PreReleaseLabel: ''
- provider: NuGet
server: https://www.myget.org/F/qwiq/api/v2/package
api_key:
secure: 8wGYx8W+ojYQJsAJpRLez+KwwFa+OW7cvsn5RoR08WQpi5klhTq/9b/9YaEu/5Bx
symbol_server: https://www.myget.org/F/qwiq/symbols/api/v2/package
on:
branch: support[/-]
GitVersion_PreReleaseLabel: ''
notifications:
- provider: GitHubPullRequest
on_build_success: false
Expand Down
6 changes: 6 additions & 0 deletions src/Qwiq.Core.Soap/WorkItem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -213,6 +213,12 @@ public override IHyperlink CreateHyperlink(string location)
return ExceptionHandlingDynamicProxyFactory.Create<IHyperlink>(new Hyperlink(new Tfs.Hyperlink(location)));
}

public override IRelatedLink CreateRelatedLink(int relatedWorkItemId, IWorkItemLinkTypeEnd linkTypeEnd = null)
{
var rawLinkTypeEnd = LinkTypeEndMapper.Map(_item.Store, linkTypeEnd);
return ExceptionHandlingDynamicProxyFactory.Create<IRelatedLink>(new RelatedLink(new Tfs.RelatedLink(rawLinkTypeEnd, relatedWorkItemId)));
}

/// <summary>
/// Validates the fields of this work item.
/// </summary>
Expand Down