You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 

65 lines
2.0 KiB

using Microsoft.VisualStudio.TestTools.UnitTesting;
using Sevomin.WebFrontend.Controllers;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Web.Mvc;
using Rhino.Mocks;
using Sevomin.Models.Helpers;
using System.Web;
using System.Security.Principal;
namespace Sevomin.Tests.Controllers.Job
{
[TestClass]
public class NewJob
{
HttpContextBase fakeContext = MockRepository.GenerateStub<HttpContextBase>();
public JobController GetCUT()
{
FakeJobRepository.Init();
fakeContext = MockRepository.GenerateStub<HttpContextBase>();
fakeContext.User = MockRepository.GenerateStub<IPrincipal>();
fakeContext.User.Stub(x => x.Identity).Return(new FakeIdentity());
JobController cut = new JobController(FakeJobRepository.Instance(),
MockRepository.GenerateMock<SevominUserManager>(FakeDbContext.Instance()), fakeContext);
return cut;
}
[TestMethod]
public void MyTestMethod()
{
}
[TestMethod]
public async Task Returns_View_NewJob_JobController()
{
// Arrange
JobController cut = GetCUT();
// Act
var result = (await cut.NewJob()) as ViewResult;
// Assert
Assert.IsNotNull(result);
Assert.AreEqual(string.Empty, result.ViewName);
}
[TestMethod]
public async Task Returns_EmptyJobModel_NewJob_JobController()
{
// Arrange
JobController cut = GetCUT();
// Act
var result = (await cut.NewJob()) as ViewResult;
// Assert
Assert.IsNotNull(result);
Assert.IsNotNull(result.Model);
Assert.IsInstanceOfType(result.Model, typeof(Models.Job));
Assert.AreNotEqual((result.Model as Models.Job).JobParameters.Count, 0);
}
}
}