Add run time to queue
This commit is contained in:
@@ -1,80 +0,0 @@
|
||||
using System;
|
||||
using LeafWeb.Core.Entities;
|
||||
using LeafWeb.WebCms.Models;
|
||||
using NUnit.Framework;
|
||||
|
||||
namespace LeafWeb.WebCms.Tests.Models
|
||||
{
|
||||
[TestFixture]
|
||||
public class ResultStatusViewModelTests
|
||||
{
|
||||
private LeafInput GetLeafInput()
|
||||
{
|
||||
return new LeafInput
|
||||
{
|
||||
CurrentStatus = LeafInputStatusType.Complete,
|
||||
OutputFiles = new[] {new LeafOutputFile {Filename = "OutputFilename.txt"}},
|
||||
Added = DateTime.Today,
|
||||
Email = "test@email.com",
|
||||
Identifier = "Ident I Fier",
|
||||
Name = "My Name",
|
||||
PhotosynthesisType = new PhotosynthesisType {Id = "1", Name = "1", SortOrder = 1},
|
||||
InputFiles = new[]
|
||||
{
|
||||
new LeafInputFile
|
||||
{
|
||||
Filename = "MyFilename.ext",
|
||||
Id = 3
|
||||
}
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void CanConstructFromLeafInputFile()
|
||||
{
|
||||
var leafInput = GetLeafInput();
|
||||
var viewModel = new QueueItemViewModel(leafInput);
|
||||
|
||||
Assert.That(viewModel.CurrentStatus, Is.EqualTo(leafInput.CurrentStatus.ToString()));
|
||||
Assert.That(viewModel.LeafInputId, Is.EqualTo(leafInput.Id));
|
||||
//Assert.That(viewModel.LeafOutputFilenames, Has.Length.EqualTo(1));
|
||||
Assert.That(viewModel.LeafInputIdentifier, Is.EqualTo(leafInput.Identifier));
|
||||
Assert.That(viewModel.LeafInputSiteId, Is.EqualTo(leafInput.SiteId));
|
||||
Assert.That(viewModel.LeafInputPhotosynthesisType, Is.EqualTo(leafInput.PhotosynthesisType.Name));
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void CanConstructFromLeafInputFile_Running()
|
||||
{
|
||||
var leafInput = GetLeafInput();
|
||||
leafInput.CurrentStatus = LeafInputStatusType.Running;
|
||||
leafInput.OutputFiles = new LeafOutputFile[0];
|
||||
var viewModel = new QueueItemViewModel(leafInput);
|
||||
|
||||
Assert.That(viewModel.CurrentStatus, Is.EqualTo(LeafInputStatusType.Running.ToString()));
|
||||
//Assert.That(viewModel.LeafOutputFilenames, Has.Length.EqualTo(0));
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void CanConstructFromLeafInputFile_Error()
|
||||
{
|
||||
var leafInput = GetLeafInput();
|
||||
leafInput.CurrentStatus = LeafInputStatusType.Exception;
|
||||
leafInput.StatusHistory = new []
|
||||
{
|
||||
new LeafInputStatus
|
||||
{
|
||||
DateTime = DateTime.Today,
|
||||
LeafInput = leafInput,
|
||||
Description = "My Error",
|
||||
Status = LeafInputStatusType.Exception
|
||||
}
|
||||
};
|
||||
var viewModel = new QueueItemViewModel(leafInput);
|
||||
|
||||
Assert.That(viewModel.CurrentStatus, Is.EqualTo(LeafInputStatusType.Exception.ToString()));
|
||||
//Assert.That(viewModel.ErrorMessages[0], Is.EqualTo(leafInput.StatusHistory.First().Description));
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user