﻿using Moq;
using Microsoft.VisualStudio.TestTools.UnitTesting;

namespace MOQCustomer
{
    [TestClass]
    public class TrsanactionManagerTest
    {
        [TestMethod]
        public void ValidateCustomertest()
        {
            Customer customer = new Customer();

            customer.CustomerID = "333333";

            //Set up the mocks and pass them as objects
            var IValidateCustomerMock = new Mock<IValidateCustomer>();

            //This line means, if given the customer's ID, pretend to return true
            IValidateCustomerMock.Setup(m=>m.Validate(customer.CustomerID)).Returns(true);
            var ivalidatessn = new Mock<IValidateSSN>();
            ivalidatessn.Setup((m => m.Validate(customer.SSN))).Returns(true);

            TransactionManager target = new TransactionManager(ivalidatessn.Object,IValidateCustomerMock.Object);

            bool res = target.ValidateCustomer(customer);

            Assert.AreEqual(true, res);
        
        }
    }
}
