using qdr.fnd.core.pqueue.Enums;
using qdr.fnd.core.pqueue.test.Mocks;

namespace qdr.fnd.core.pqueue.test
{
    public class PsQueueItemTest
    {
        private LoggerMock _logger;
        private string _id = "id";
        private string _owner = "owner";
        private string _ownerRef = "ownerRef";
        private string _providerClass = "providerClass";
        private int _initialAttempts = 10;
        private DateTime _created = DateTime.Now;
        private PsStatusEnum _status = PsStatusEnum.New;

        [SetUp]
        public void Setup()
        {
            _logger = new LoggerMock();
        }

        [Test(TestOf=typeof(PsQueueItem))]
        public void ConstructorOk()
        {
            var item = new PsQueueItem(_id, _owner,_ownerRef,_providerClass,_created);
            Assert.That(item.Id, Is.EqualTo(_id));
            Assert.That(item.Owner, Is.EqualTo(_owner));
            Assert.That(item.OwnerRef, Is.EqualTo(_ownerRef));
            Assert.That(item.ProcessProviderClass, Is.EqualTo(_providerClass));
            Assert.That(item.Created, Is.EqualTo(_created));
            Assert.That(item.Status, Is.EqualTo(_status));
            Assert.That(item.Arguments, Is.Not.Null);
            Assert.That(item.StatusJournal, Is.Not.Null);
            Assert.That(item.Log, Is.Not.Null);
            Assert.That(item.IsStatusTransient, Is.False);

            item = new PsQueueItem(_id);
            Assert.That(item.Id, Is.EqualTo(_id));
            Assert.That(item.Arguments, Is.Not.Null);
            Assert.That(item.StatusJournal, Is.Not.Null);
            Assert.That(item.Log, Is.Not.Null);
            Assert.That(item.IsStatusTransient, Is.False);
            Assert.That(item.Status, Is.EqualTo(_status));
        }
    }
}
