public void Constructor_PropertiesAreSetAsTheyArePassedIntoTheConstructor(string resourceName, string resourcePath)
        {
            // Act
            var assemblyFileResourceInfo = new AssemblyFileResourceInfo(resourceName, resourcePath);

            // Assert
            Assert.AreEqual(resourceName, assemblyFileResourceInfo.ResourceName);
            Assert.AreEqual(resourcePath, assemblyFileResourceInfo.ResourcePath);
        }
        public void Equals_TwoIdenticalConfigurations_ResultIsTrue(string resourceName, string resourcePath)
        {
            // Arrange
            var assemblyFileResourceInfo1 = new AssemblyFileResourceInfo(resourceName, resourcePath);
            var assemblyFileResourceInfo2 = new AssemblyFileResourceInfo(resourceName, resourcePath);

            // Act
            bool result = assemblyFileResourceInfo1.Equals(assemblyFileResourceInfo2);

            // Assert
            Assert.IsTrue(result);
        }
        public void Equals_SuppliedObjectOfAnotherType_ResultIsFalse()
        {
            // Arrange
            var assemblyFileResourceInfo1 = new AssemblyFileResourceInfo("Some Name", "Some\\Path");
            object assemblyFileResourceInfo2 = new object();

            // Act
            bool result = assemblyFileResourceInfo1.Equals(assemblyFileResourceInfo2);

            // Assert
            Assert.IsFalse(result);
        }
        public void Equals_SuppliedObjectIsNull_ResultIsFalse()
        {
            // Arrange
            var assemblyFileResourceInfo1 = new AssemblyFileResourceInfo("Some Name", "Some\\Path");
            AssemblyFileResourceInfo assemblyFileResourceInfo2 = null;

            // Act
            bool result = assemblyFileResourceInfo1.Equals(assemblyFileResourceInfo2);

            // Assert
            Assert.IsFalse(result);
        }
        public void ToString_PathIsSet_ContainsResourcePath()
        {
            // Arrange
            var assemblyFileResourceInfo = new AssemblyFileResourceInfo("Some Name", "Some\\Path");

            // Act
            string result = assemblyFileResourceInfo.ToString();

            // Assert
            Assert.IsTrue(result.Contains(assemblyFileResourceInfo.ResourcePath));
        }
        public void ToString_NameIsNotSet_PathIsSet_DoesNotContainPath(string resourceName)
        {
            // Arrange
            var assemblyFileResourceInfo = new AssemblyFileResourceInfo(resourceName, "Some\\Path");

            // Act
            string result = assemblyFileResourceInfo.ToString();

            // Assert
            Assert.IsFalse(result.Contains(assemblyFileResourceInfo.ResourcePath));
        }
        public void ToString_NameIsNotSet_PathIsSet_ClassNameIsReturned(string resourceName)
        {
            // Arrange
            var assemblyFileResourceInfo = new AssemblyFileResourceInfo(resourceName, "Some\\Path");

            // Act
            string result = assemblyFileResourceInfo.ToString();

            // Assert
            Assert.AreEqual(assemblyFileResourceInfo.GetType().Name, result);
        }
        public void GetHashCode_TwoIdenticalObjects_HashCodesAreEqual(string resourceName, string resourcePath)
        {
            // Arrange
            var assemblyFileResourceInfo1 = new AssemblyFileResourceInfo(resourceName, resourcePath);
            var assemblyFileResourceInfo2 = new AssemblyFileResourceInfo(resourceName, resourcePath);

            // Act
            int hashCodeObject1 = assemblyFileResourceInfo1.GetHashCode();
            int hashCodeObject2 = assemblyFileResourceInfo2.GetHashCode();

            // Assert
            Assert.AreEqual(hashCodeObject1, hashCodeObject2);
        }
        public void GetHashCode_SameHashCodeIsReturnedEveryTimeTheMethodIsCalled_AsLongAsTheObjectDoesNotChange()
        {
            // Arrange
            string resourceName = "Some Name";
            string resourcePath = "Some\\Path";
            var assemblyFileResourceInfo = new AssemblyFileResourceInfo(resourceName, resourcePath);

            int expectedHashcode = assemblyFileResourceInfo.GetHashCode();

            for (var i = 0; i < 100; i++)
            {
                // Act
                assemblyFileResourceInfo.ResourceName = resourceName;
                assemblyFileResourceInfo.ResourcePath = resourcePath;
                int generatedHashCode = assemblyFileResourceInfo.GetHashCode();

                // Assert
                Assert.AreEqual(expectedHashcode, generatedHashCode);
            }
        }
        public void GetHashCode_ForAllUniqueObject_AUniqueHashCodeIsReturned()
        {
            var hashCodes = new Dictionary<int, AssemblyFileResourceInfo>();

            for (var i = 0; i < 10000; i++)
            {
                // Act
                var assemblyFileResourceInfo = new AssemblyFileResourceInfo(Guid.NewGuid().ToString(), Guid.NewGuid().ToString());

                int generatedHashCode = assemblyFileResourceInfo.GetHashCode();

                // Assert
                Assert.IsFalse(hashCodes.ContainsKey(generatedHashCode));
                hashCodes.Add(generatedHashCode, assemblyFileResourceInfo);
            }
        }
        public void Equals_TwoIdenticalConfigurations_WithDifferentWhitespacesAtTheEnd_ResultIsFalse(string resourceName, string resourcePath)
        {
            // Arrange
            var assemblyFileResourceInfo1 = new AssemblyFileResourceInfo(resourceName, resourcePath);
            var assemblyFileResourceInfo2 = new AssemblyFileResourceInfo(resourceName + " ", resourcePath + " ");

            // Act
            bool result = assemblyFileResourceInfo1.Equals(assemblyFileResourceInfo2);

            // Assert
            Assert.IsFalse(result);
        }