﻿using Stubby.App.Testing.Asserts;
using System;
using System.Collections.Generic;
using System.Text;
using Stubby.App.ProjectStructure.Stubs;
using Stubby.App.Testing.Tracing;

namespace Stubby.App.Testing.Assertions.Asserts
{
    internal class CreateAssert : BaseAssert
    {
        internal override (string Message, bool Success) Assert(Mock mock, FlightRecorder recorder)
        {
            ICreateAssertable obj = mock as ICreateAssertable;
            if (null == obj)
            {
                return ($"This Mock type doesn't support CreateAssert.", false);
            }

            foreach (var create in recorder.GetCreatedObjects(mock.Id))
            {
                if (create.Equals(obj.CreatableObject))
                {
                    return (String.Empty, true);
                }
            }
            return ($"Expected create, actual nothing.", false);
        }
    }
}
