Add LeafOutputViewModel and test
This commit is contained in:
@@ -0,0 +1,41 @@
|
||||
using System;
|
||||
using LeafWeb.Core.Entities;
|
||||
using LeafWeb.Web.ViewModels.LeafOutput;
|
||||
using NUnit.Framework;
|
||||
|
||||
namespace LeafWeb.Web.Tests.ViewModels.LeafOutput
|
||||
{
|
||||
[TestFixture]
|
||||
public class LeafOutputViewModelTests
|
||||
{
|
||||
private LeafInputFile file = new LeafInputFile
|
||||
{
|
||||
Filename = "MyFilename.ext",
|
||||
Id = 3,
|
||||
CurrentStatus = LeafInputStatusType.Running,
|
||||
LeafInput = new LeafInput
|
||||
{
|
||||
Added = DateTime.Today,
|
||||
Email = "test@email.com",
|
||||
Identifier = "Ident I Fier",
|
||||
Name = "My Name",
|
||||
PhotosynthesisType = new PhotosynthesisType { Id = "1", Name = "1", SortOrder = 1}
|
||||
},
|
||||
LeafOutputFiles = new[] { new LeafOutputFile { Filename = "OutputFilename.txt" } }
|
||||
};
|
||||
|
||||
[Test]
|
||||
public void CanConstructFromLeafInputFile()
|
||||
{
|
||||
var viewModel = new LeafOutputViewModel(file);
|
||||
|
||||
Assert.That(viewModel.CurrentStatus, Is.EqualTo(file.CurrentStatus.ToString()));
|
||||
Assert.That(viewModel.LeafInputFileId, Is.EqualTo(file.Id));
|
||||
Assert.That(viewModel.LeafInputFilename, Is.EqualTo(file.Filename));
|
||||
Assert.That(viewModel.LeafOutputFilenames, Is.Empty);
|
||||
Assert.That(viewModel.LeafInputIdentifier, Is.EqualTo(file.LeafInput.Identifier));
|
||||
Assert.That(viewModel.LeafInputSiteId, Is.EqualTo(file.LeafInput.SiteId));
|
||||
Assert.That(viewModel.LeafInputPhotosynthesisType, Is.EqualTo(file.LeafInput.PhotosynthesisType.Name));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -44,10 +44,21 @@
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||
<Compile Include="ViewModels\LeafOutput\LeafOutputViewModelTests.cs" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="packages.config" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\Core\Core.csproj">
|
||||
<Project>{25BAED75-7E75-4D11-90D9-358472054DF6}</Project>
|
||||
<Name>Core</Name>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\Web\Web.csproj">
|
||||
<Project>{0809033D-DBB9-41AE-8811-9A9CFDFD8966}</Project>
|
||||
<Name>Web</Name>
|
||||
</ProjectReference>
|
||||
</ItemGroup>
|
||||
<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.
|
||||
|
||||
Reference in New Issue
Block a user