This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public interface IFootballClub | |
{ | |
string FullName { get; } | |
string NickName { get; } | |
int CreationYear { get; } | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public interface IChampionship | |
{ | |
List<IFootballClub> CurrentChampionShipRanking { get; } | |
List<IFootballClub> UserBet { get; set; } | |
int GetGoodBetCount(); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public interface IChampionshipBetViewModel : IDropTarget | |
{ | |
ObservableCollection<IFootballClub> FootballClubs { get; } | |
ICommand ClickSave { get; } | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<UserControl x:Class="MvvMSample.Views.ChampionshipBetView" ... > | |
<UserControl.Resources> | |
<!-- go to github.com/bpatra/MvvMSample for complete implementation--> | |
</UserControl.Resources> | |
<UserControl.DataContext> | |
<Binding Path="ChampionshipBetViewModel" Source="{StaticResource Locator}" /> | |
</UserControl.DataContext> | |
<StackPanel> | |
<ListView ItemsSource="{Binding FootballClubs}" | |
dd:DragDrop.IsDragSource="True" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class ChampionshipBetViewModel : IChampionshipBetViewModel, IDropTarget | |
{ | |
private readonly IChampionship _championship; | |
public ChampionshipBetViewModel(IChampionship championship) | |
{ | |
_championship = championship; | |
FootballClubs = new ObservableCollection<IFootballClub>(championship.UserBet); | |
} | |
public ObservableCollection<IFootballClub> FootballClubs { get; private set; } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[TestClass] | |
public class ChampionshipBetViewModel_DragAndDrop_Tests | |
{ | |
private readonly ChampionshipBetViewModel _championshipBetViewModel; | |
private readonly Mock<IChampionship> _championShip; | |
private readonly IFootballClub _club1; | |
private readonly IFootballClub _club2; | |
private readonly IFootballClub _club3; | |
private readonly IFootballClub _club4; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[TestMethod] | |
public void DragOver_With_A_Block_Source_Then_Effects_Should_Be_Set() | |
{ | |
var dropInfo = new Mock<IDropInfo>(); | |
dropInfo.SetupGet(m => m.Data).Returns(new[] { _club1, _club2 }); | |
dropInfo.SetupGet(m => m.InsertIndex).Returns(3); | |
_championshipBetViewModel.DragOver(dropInfo.Object); | |
dropInfo.VerifySet(x => x.DropTargetAdorner = It.IsAny<Type>(), Times.Once); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class ChampionshipBetViewModel : IChampionshipBetViewModel, IDropTarget | |
{ | |
//constructor, fields and command same as previous sample | |
public ObservableCollection<IFootballClub> FootballClubs { get; private set; } | |
public void DragOver(IDropInfo dropInfo) | |
{ | |
var selectedIndices = this.GetItemsBlock(dropInfo.Data).Select(c => FootballClubs.IndexOf(c)).ToList(); | |
//important: InsertIndex is the index of the item right AFTER the position we are inserting into |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/// <reference path="~/../WebApplication1/app/app.js" /> | |
/// <reference path="~/../WebApplication1/app/sut.js" /> | |
/// <reference path="~/lib/jasmine-2.0.0/jasmine.js" /> | |
/// <reference path="~/lib/jasmine-2.0.0/jasmine-html.js" /> | |
describe("sut Tests and factorial function", function () { | |
it("should return 1 with 0", function () { | |
expect(app.sut.factorial(0)).toBe(1); | |
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$chutzpahPath = (Join-Path -Path $PSScriptRoot -ChildPath "Chutzpah.3.2.1\chutzpah.console.exe").ToString() | |
If(-not (Test-Path($chutzpahPath))) | |
{ | |
Write-Error "Cannot find chutzpath" | |
throw | |
} | |
$testPath = Join-Path -Path $PSScriptRoot -ChildPath "..\WebApplication1.Tests" |
OlderNewer