public void GetLocalizedString_ThrowsIfGetPropertyIsNotAvalible()
        {
            // Arrage
            Type resourceType = typeof(MockResourceType);

            // Act & Assert
            ExceptionAssert.Throws <InvalidOperationException>(() => CommandLineUtility.GetLocalizedString(resourceType, "NoGet"),
                                                               "The resource type 'NuGet.Test.NuGetCommandLine.CommandLineUtilityTests+MockResourceType' does not have an accessible get for the 'NoGet' property.");
        }
        public void GetLocalizedString_ThrowsIfPropertyIsNotOfStringType()
        {
            // Arrage
            Type resourceType = typeof(MockResourceType);

            // Act & Assert
            ExceptionAssert.Throws <InvalidOperationException>(() => CommandLineUtility.GetLocalizedString(resourceType, "NotValid"),
                                                               "The property 'NotValid' on resource type 'NuGet.Test.NuGetCommandLine.CommandLineUtilityTests+MockResourceType' is not a string type.");
        }
        public void GetLocalizedString_ThrowsIfNoPropteryByResourceName()
        {
            // Arrage
            Type resourceType = typeof(MockResourceType);

            // Act & Assert
            ExceptionAssert.Throws <InvalidOperationException>(() => CommandLineUtility.GetLocalizedString(resourceType, "DoesntExist"),
                                                               "The resource type 'NuGet.Test.NuGetCommandLine.CommandLineUtilityTests+MockResourceType' does not have an accessible static property named 'DoesntExist'.");
        }
        public void GetLocalizedString_ReturnsResourceWithValidName()
        {
            // Arrange
            Type resourceType = typeof(MockResourceType);
            // Act
            var actual = CommandLineUtility.GetLocalizedString(resourceType, "Message");

            // Assert
            Assert.AreEqual("This is a Message.", actual);
        }
 public void GetLocalizedString_ThrowsArgumentExceptionForEmptyName()
 {
     // Act & Assert
     ExceptionAssert.ThrowsArgNullOrEmpty(() => CommandLineUtility.GetLocalizedString(typeof(string), ""), "resourceName");
 }
 public void GetLocalizedString_ThrowsArgumentExceptionForNullType()
 {
     // Act & Assert
     ExceptionAssert.ThrowsArgNull(() => CommandLineUtility.GetLocalizedString(null, "foo"), "resourceType");
 }