﻿namespace Academy.Test.Model.StudentTest
{
    using Microsoft.VisualStudio.TestTools.UnitTesting;
    using Models;
    using Models.Enums;
    using Models.Utils.Contracts;
    using Moq;

    [TestClass]
    public class ToString_Should
    {
        [TestMethod]
        public void ToString_IterateOverTheCollection()
        {
            // Arrange
            var student = new Student("Valid username", Track.Dev);
            var couseMock = new Mock<ICourseResult>();

            couseMock.Setup(x => x.ToString());

            student
                .CourseResults
                .Add(couseMock.Object);

            // Act
            student.ToString();

            // Assert
            couseMock.Verify(x => x.ToString(), Times.Once);
        }

        [TestMethod]
        public void ToString_InitializeWithEmptyCourses_ShouldReturnStringWithInformation()
        {
            // Arrange
            var student = new Student("Valid username", Track.Dev);

            // Act
            var result = student.ToString();

            // Assert
            StringAssert.Contains(result, "no course");
        }
    }
}
