﻿using System;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using Microsoft.Practices.Unity;
using DressingSimulation.SharedUnitTestSetup;
using DressingSimulation.Domain.Logic.Actions.Interfaces;
using DressingSimulation.Logic.Actions;

namespace DressingSimulation.UnitTests.Actions
{
    [TestClass]
    public class ActionFactory_UnitTests
    {
        [TestMethod]
        public void GetAction_Found_UnitTest()
        {
            var container = MockUnityContainer.GetContainer();
            var factoryBeingTested = container.Resolve<IActionFactory>();

            var expected = new PutOnShorts_Action(container);

            var actual = factoryBeingTested.GetAction(Domain.Enums.WeatherTypes.HOT, Domain.Enums.DressingActions.PutOnPants);

            Assert.IsNotNull(actual, "ActionFactory should have found action");
            Assert.IsInstanceOfType(actual, typeof(PutOnShorts_Action), "Found Action is wrong type");
        }

        [TestMethod]
        public void GetAction_NotFound_UnitTest()
        {
            var container = MockUnityContainer.GetContainer();
            var factoryBeingTested = container.Resolve<IActionFactory>();

            var expected = new PutOnSocks_Action(container);

            var actual = factoryBeingTested.GetAction(Domain.Enums.WeatherTypes.HOT, Domain.Enums.DressingActions.PutOnSocks);

            Assert.IsNull(actual, "ActionFactory should not have found action");
        }
    }
}
