public void CreateAnAcknowledgement_NoName_OverriddenByFile()
        {
            var ack = new AcknowledgementAttribute("testKey")
            {
                Copyright = "myCopyright", Location = "./nunit.framework.dll"
            };

            Assert.That(ack.Name, Is.EqualTo("NUnit"));
        }
        public void CreateAnAcknowledgement_NoCopyright_OverriddenByFile()
        {
            var ack = new AcknowledgementAttribute("testKey")
            {
                Name = "testName", Location = "./NDesk.DBus.dll"
            };

            Assert.That(ack.Copyright, Is.EqualTo("Copyright (C) Alp Toker"));
        }
        public void CreateAnAcknowledgement_HtmlOverridesDefault()
        {
            var ack = new AcknowledgementAttribute("testKey")
            {
                Name = "testName", Html = "<myOwnStuff>Bob</myOwnStuff>"
            };

            Assert.AreEqual("<myOwnStuff>Bob</myOwnStuff>", ack.Html, "default html should be overridden");
        }
        public void CreateAnAcknowledgement_HtmlIsNotNull()
        {
            var ack = new AcknowledgementAttribute("testKey")
            {
                Name = "testName"
            };

            Assert.AreEqual("<li>testName</li>", ack.Html, "default html is different than expected");
        }
        public void CollectAcknowledgementsAndRemoveDuplicates_HandlesDuplicateKeys()
        {
            var ack1 = new AcknowledgementAttribute("myKey1")
            {
                Name = "my Name"
            };
            var ack2 = new AcknowledgementAttribute("myKey1")
            {
                Name = "my Other Name"
            };
            var ackList = new List <AcknowledgementAttribute> {
                ack1, ack2
            };

            AcknowledgementsProvider.CollectAcknowledgementsAndRemoveDuplicates(_ackDict, ackList);
            Assert.AreEqual(1, _ackDict.Count, "Should have stripped out a duplicate key.");
            Assert.AreEqual("my Name", _ackDict["myKey1"].Name);
        }
        public void SortByNameAndConcatenateHtml_SortsCorrectly()
        {
            var ack1 = new AcknowledgementAttribute("myKey1")
            {
                Name = "my Name"
            };
            var ack2 = new AcknowledgementAttribute("bobKey")
            {
                Name = "Bob's project", LicenseUrl = "MIT License", Copyright = "2017 Bob Programmer"
            };

            _ackDict.Add(ack1.Key, ack1);
            _ackDict.Add(ack2.Key, ack2);
            var html = AcknowledgementsProvider.SortByNameAndConcatenateHtml(_ackDict);

            Assert.That(html, Is.StringStarting("<li>Bob\'s project"));
            Assert.That(html, Is.StringContaining("my Name"));
        }