public void assess_installation_licenses__empty_list__returns__zero_licenses()
        {
            var assessor = new LicenseAssessor();

            var installations = new Installation[0];

            var licenseCount = assessor.AssessInstallationLicenses(installations);

            Assert.That(licenseCount, Is.Zero);
        }
        public void assess_installation_licenses__two_desktops__returns__two_licenses()
        {
            const int expectedLicenses = 2;

            var assessor = new LicenseAssessor();

            var installations = new[] { new Installation(0, 0, 0, ComputerType.Desktop), new Installation(1, 0, 0, ComputerType.Desktop) };

            var licenseCount = assessor.AssessInstallationLicenses(installations);

            Assert.That(licenseCount, Is.EqualTo(expectedLicenses));
        }
        public void assess_installation_licenses__one_laptop__returns__one_license()
        {
            const int expectedLicenses = 1;

            var assessor = new LicenseAssessor();

            var installations = new[] { new Installation(0, 0, 0, ComputerType.Laptop) };

            var licenseCount = assessor.AssessInstallationLicenses(installations);

            Assert.That(licenseCount, Is.EqualTo(expectedLicenses));
        }
        public void assess_intallation_licenses__enumerates__input_enumeration()
        {
            var assessor = new LicenseAssessor();

            var installations = A.Fake <IEnumerable <Installation> >();

            assessor.AssessInstallationLicenses(installations);

            // This doesn't quite PROVE it was enumerated, but it's good evidence.
            // i.e. We know there are no explicit calls to GetEnumerator.
            A.CallTo(() => installations.GetEnumerator()).MustHaveHappened();
        }
        public void assess_installation_licenses__eleven_desktops__two_laptops__returns__eleven_licenses()
        {
            const int laptopCount      = 2;
            const int desktopCount     = 11;
            const int expectedLicenses = 11;

            var assessor = new LicenseAssessor();

            var laptops  = PopulateArray(laptopCount, ComputerType.Laptop);
            var desktops = PopulateArray(desktopCount, ComputerType.Desktop);

            var installations = laptops.Concat(desktops);

            var licenseCount = assessor.AssessInstallationLicenses(installations);

            Assert.That(licenseCount, Is.EqualTo(expectedLicenses));
        }
        public void assess_installation_licenses__null_list__throws_null_reference_exception()
        {
            var assessor = new LicenseAssessor();

            Assert.Throws <NullReferenceException>(() => assessor.AssessInstallationLicenses(null));
        }
        public void can_create()
        {
            var assessor = new LicenseAssessor();

            Assert.That(assessor, Is.Not.Null);
        }