コード例 #1
0
        public void GetAndRemoveNonEmptyStringAttribute_WithMissingAttributeAndNotRequired()
        {
            StubExtendedProvider provider = new StubExtendedProvider("Provider", new NameValueCollection());
            NameValueCollection  config   = new NameValueCollection();

            Assert.That(provider.GetAndRemoveNonEmptyStringAttribute(config, "Name", "Provider", false), Is.Null);
        }
コード例 #2
0
        public void GetAndRemoveNonEmptyStringAttribute_WithMissingAttributeAndRequired()
        {
            StubExtendedProvider provider = new StubExtendedProvider("Provider", new NameValueCollection());
            NameValueCollection  config   = new NameValueCollection();

            provider.GetAndRemoveNonEmptyStringAttribute(config, "Name", "Provider", true);
        }
コード例 #3
0
        public void GetAndRemoveNonEmptyStringAttribute_WithEmptyAttributeAndNotRequired()
        {
            StubExtendedProvider provider = new StubExtendedProvider("Provider", new NameValueCollection());
            NameValueCollection  config   = new NameValueCollection();

            config.Add("Name", string.Empty);

            provider.GetAndRemoveNonEmptyStringAttribute(config, "Name", "Provider", false);
        }
コード例 #4
0
        public void Initialize()
        {
            NameValueCollection config = new NameValueCollection();

            config.Add("description", "The Description");

            ExtendedProviderBase provider = new StubExtendedProvider("Provider", config);

            Assert.That(provider.Name, Is.EqualTo("Provider"));
            Assert.That(provider.Description, Is.EqualTo("The Description"));
        }
コード例 #5
0
        public void GetAndRemoveNonEmptyStringAttribute()
        {
            StubExtendedProvider provider = new StubExtendedProvider("Provider", new NameValueCollection());
            NameValueCollection  config   = new NameValueCollection();

            config.Add("Name", "Value");
            config.Add("Other", "OtherValue");

            Assert.That(provider.GetAndRemoveNonEmptyStringAttribute(config, "Name", "Provider", true), Is.EqualTo("Value"));
            Assert.That(config.Get("Other"), Is.EqualTo("OtherValue"));
            Assert.That(config["Name"], Is.Null);
        }
コード例 #6
0
        public void GetAndRemoveNonEmptyStringAttribute_WithEmptyAttributeAndRequired()
        {
            StubExtendedProvider provider = new StubExtendedProvider("Provider", new NameValueCollection());
            NameValueCollection  config   = new NameValueCollection();

            config.Add("Name", string.Empty);

            try
            {
                provider.GetAndRemoveNonEmptyStringAttribute(config, "Name", "Provider", true);
            }
            catch
            {
                Assert.That(config.AllKeys.Length, Is.EqualTo(1));
                throw;
            }
        }