﻿using System;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using Moq.AutoMock;
using Should;

namespace Meow.Diagnostic.Tests
{
    [TestClass]
    public class ResultTests
    {
        private AutoMocker mocker;

        [TestInitialize]
        public void Setup()
        {
            mocker = new AutoMocker();
        }

        [TestMethod]
        public void Duration_is_calculated_correctly()
        {
            var result = mocker.CreateInstance<PassResult>();
            result.Start = new DateTime(2012, 1, 1, 12, 0, 0);
            result.Stop = new DateTime(2012, 1, 1, 12, 0, 1);
            result.Duration.ShouldEqual(new TimeSpan(0, 0, 1));
        }

        [TestMethod]
        public void A_new_pass_result_returns_the_status_of_pass()
        {
            var result = mocker.CreateInstance<PassResult>();
            result.Status.ShouldEqual(Status.Pass);
        }

        [TestMethod]
        public void A_new_warn_result_returns_the_status_of_warn()
        {
            var result = mocker.CreateInstance<WarnResult>();
            result.Status.ShouldEqual(Status.Warn);
        }

        [TestMethod]
        public void A_new_fail_result_returns_the_status_of_fail()
        {
            var result = mocker.CreateInstance<FailResult>();
            result.Status.ShouldEqual(Status.Fail);
        }

        [TestMethod]
        public void A_new_inconclusive_result_returns_the_status_of_inconclusive()
        {
            var result = mocker.CreateInstance<InconclusiveResult>();
            result.Status.ShouldEqual(Status.Inconclusive);
        }
    }
}