Skip to content
This repository has been archived by the owner on Dec 14, 2022. It is now read-only.

Commit

Permalink
Fixed #26. started with #13
Browse files Browse the repository at this point in the history
  • Loading branch information
dreanor committed Sep 5, 2015
1 parent 2c0fb82 commit f4b248f
Show file tree
Hide file tree
Showing 11 changed files with 62 additions and 41 deletions.
42 changes: 42 additions & 0 deletions src/Tests/ShellViewModel/ShellViewModelBase.UnitTest.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
using NUnit.Framework;
using Rhino.Mocks;
using StreamCompanion.Contract;
using StreamCompanion.Contract.ShellBase.Shell;
using StreamCompanion.Contract.ShellBase.Uic.Step;
using StreamCompanion.ShellViewModel;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace StreamCompanion.Tests.ShellViewModel
{
[TestFixture]
public class ShellViewModelBaseUnitTest
{
private IController controller;
private IStepUIC stepUICMock;
private MainShellViewModel shellViewModelSUT;

[SetUp]
public void SetUp()
{
controller = MockRepository.GenerateMock<IController>();
stepUICMock = MockRepository.GenerateMock<IStepUIC>();
shellViewModelSUT = new MainShellViewModel(controller, stepUICMock);
}

[Test]
public void CanReturnTheCorrectSteps()
{
Assert.AreEqual(stepUICMock, shellViewModelSUT.Steps[0]);
}

[Test]
public void CanReturnTheCorrectSelectedItem()
{
Assert.AreEqual(stepUICMock, shellViewModelSUT.SelectedItem);
}
}
}
1 change: 1 addition & 0 deletions src/Tests/Tests.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,7 @@
<Compile Include="JsonConverter\DeserializedRoot.UnitTest.cs" />
<Compile Include="JsonConverter\SerializedRoot.UnitTest.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="ShellViewModel\ShellViewModelBase.UnitTest.cs" />
<Compile Include="StreamTemplate\StreamItem.UnitTest.cs" />
<Compile Include="StreamTemplate\Model.UnitTest.cs" />
<Compile Include="StreamTemplate\ViewModel.UnitTest.cs" />
Expand Down
3 changes: 1 addition & 2 deletions src/contract/contract.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -65,9 +65,8 @@
<Compile Include="IController.cs" />
<Compile Include="ISerieStepUIC.cs" />
<Compile Include="IStreamManager.cs" />
<Compile Include="Json\Deserialize\IDeserializedRoot.cs" />
<Compile Include="Json\IConverter.cs" />
<Compile Include="Json\Serialize\ISerializedRoot.cs" />
<Compile Include="Json\IConverterRoot.cs" />
<Compile Include="ISerie.cs" />
<Compile Include="IProgress.cs" />
<Compile Include="IView.cs" />
Expand Down
10 changes: 4 additions & 6 deletions src/contract/json/IConverter.cs
Original file line number Diff line number Diff line change
@@ -1,24 +1,22 @@
using StreamCompanion.Contract.Json.Deserialize;
using StreamCompanion.Contract.Json.Serialize;
using StreamCompanion.Contract.StreamTemplate;
using StreamCompanion.Contract.StreamTemplate;
using System;
using System.Collections.Generic;

namespace StreamCompanion.Contract.Json
{
public interface IConverter
{
ISerializedRoot Convert(
IConverterRoot Convert(
Guid id,
IEnumerable<ISerie> currentlyWatching,
IEnumerable<ISerie> completed,
IEnumerable<ISerie> onHold,
IEnumerable<ISerie> dropped,
IEnumerable<ISerie> planToWatch);

void Export(ISerializedRoot serializedRoot, string inputFileFullname);
void Export(IConverterRoot serializedRoot, string inputFileFullname);

IDeserializedRoot Import(string inputFileFullname);
IConverterRoot Import(string inputFileFullname);

void ExportStreams(IModel model, string inputFileFullname);
IModel ImportStreams(string inputFileFullname);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
using System;
using System.Collections.Generic;

namespace StreamCompanion.Contract.Json.Serialize
namespace StreamCompanion.Contract.Json
{
public interface ISerializedRoot
public interface IConverterRoot
{
Guid Id { get; }

Expand Down
20 changes: 0 additions & 20 deletions src/contract/json/deserialize/IDeserializedRoot.cs

This file was deleted.

3 changes: 1 addition & 2 deletions src/controller/MainController.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
using StreamCompanion.Contract;
using StreamCompanion.Contract.Json;
using StreamCompanion.Contract.Json.Deserialize;
using StreamCompanion.Contract.ShellBase.Model;
using StreamCompanion.Contract.StreamTemplate;
using StreamCompanion.JsonConverter;
Expand Down Expand Up @@ -110,7 +109,7 @@ private void LoadData()
new Task(() => this.LoadData(root)).Start();
}

private void LoadData(IDeserializedRoot root)
private void LoadData(IConverterRoot root)
{
foreach (var serie in root.CurrentlyWatching)
{
Expand Down
8 changes: 3 additions & 5 deletions src/jsonconverter/Converter.cs
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
using StreamCompanion.Contract;
using StreamCompanion.Contract.Json;
using StreamCompanion.Contract.Json.Deserialize;
using StreamCompanion.Contract.Json.Serialize;
using StreamCompanion.Contract.StreamTemplate;
using StreamCompanion.StreamTemplate;
using helper.filehelper;
Expand All @@ -16,7 +14,7 @@ namespace StreamCompanion.JsonConverter
{
public class Converter : IConverter
{
public ISerializedRoot Convert(
public IConverterRoot Convert(
Guid id,
IEnumerable<ISerie> currentlyWatching,
IEnumerable<ISerie> completed,
Expand All @@ -27,7 +25,7 @@ public ISerializedRoot Convert(
return new SerializedRoot(id, currentlyWatching, completed, onHold, dropped, planToWatch);
}

public void Export(ISerializedRoot serializedRoot, string inputFileFullname)
public void Export(IConverterRoot serializedRoot, string inputFileFullname)
{
using (var fileStream = File.Open(inputFileFullname, FileMode.Create))
using (var streamWriter = new StreamWriter(fileStream, Encoding.GetEncoding("Windows-1252")))
Expand All @@ -42,7 +40,7 @@ public void Export(ISerializedRoot serializedRoot, string inputFileFullname)
}
}

public IDeserializedRoot Import(string inputFileFullname)
public IConverterRoot Import(string inputFileFullname)
{
var readLines = new FileHelper().ReadAllLines(inputFileFullname);
string value = readLines.Aggregate(string.Empty, (current, line) => current + line);
Expand Down
4 changes: 2 additions & 2 deletions src/jsonconverter/DeserializedRoot.cs
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
using StreamCompanion.Contract;
using StreamCompanion.Contract.Json.Deserialize;
using StreamCompanion.Contract.Json;
using StreamCompanion.ItemViewModel;
using System;
using System.Collections.Generic;

namespace StreamCompanion.JsonConverter
{
public class DeserializedRoot : IDeserializedRoot
public class DeserializedRoot : IConverterRoot
{
public DeserializedRoot(
Guid id,
Expand Down
4 changes: 2 additions & 2 deletions src/jsonconverter/SerializedRoot.cs
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
using StreamCompanion.Contract;
using StreamCompanion.Contract.Json.Serialize;
using StreamCompanion.Contract.Json;
using System;
using System.Collections.Generic;

namespace StreamCompanion.JsonConverter
{
public class SerializedRoot : ISerializedRoot
public class SerializedRoot : IConverterRoot
{
public SerializedRoot(Guid id, IEnumerable<ISerie> currentlyWatching, IEnumerable<ISerie> completed, IEnumerable<ISerie> onHold, IEnumerable<ISerie> dropped, IEnumerable<ISerie> planToWatch)
{
Expand Down
4 changes: 4 additions & 0 deletions src/viewmodel/ShellViewModelBase.cs
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,10 @@ public abstract class ShellViewModelBase : ViewModelBase<IShellViewModel>, IShel
private readonly IController controller;
private StreamTemplateView tempStreamTemplateView;

public ShellViewModelBase()
{
}

protected ShellViewModelBase(IController controller, params IStepUIC[] stepUics)
{
this.IsEnabled = true;
Expand Down

0 comments on commit f4b248f

Please sign in to comment.