public IWebsiteConfigurer AddBinding(Action<IBindingConfigurer> action) { return Configure(site => { var configurer = new BindingConfigurer(site.Bindings.CreateDefaultBinding()); action(configurer); }); }
public void OnPort_SetsTheBindingInformationCorrectly() { Binding binding = WebAdministrationFactory.CreateBinding(); var sut = new BindingConfigurer(binding); sut.OnPort(99); Assert.Equal("*:99:", binding.BindingInformation); }
public void OnIpAddress_SetsTheBindingInformationCorrectly() { Binding binding = WebAdministrationFactory.CreateBinding(); var sut = new BindingConfigurer(binding); sut.OnIpAddress("172.168.7.9"); Assert.Equal("172.168.7.9:80:", binding.BindingInformation); }
public void Configure_GivesDirectAccessToTheWebsite() { Binding expected = WebAdministrationFactory.CreateBinding(); var sut = new BindingConfigurer(expected); Binding actual = default(Binding); sut.Configure(x => actual = x); Assert.Equal(expected, actual); }
public void UseCertificateWithThumbprint_SetsTheCertificateInformationCorrectly() { Binding binding = WebAdministrationFactory.CreateBinding(); var finder = Substitute.For<ICertificateFinder>(); var certificate = CertificateFactory.CreateCertificate(); var result = new CertificateFindResult(StoreLocation.LocalMachine, StoreName.My, certificate); finder.Find(X509FindType.FindByThumbprint, certificate.Thumbprint).Returns(result); var sut = new BindingConfigurer(binding) {CertificateFinder = finder}; sut.UseCertificateWithThumbprint(certificate.Thumbprint); Assert.Equal("https", binding.Protocol); Assert.Equal(certificate.GetCertHash(), binding.CertificateHash); Assert.Equal("My", binding.CertificateStoreName); }
public void UseCertificateWithThumbprint_ThrowsWhenNoCertificateExistsWIthTheThumbprint() { Binding binding = WebAdministrationFactory.CreateBinding(); var finder = Substitute.For<ICertificateFinder>(); var result = new CertificateFindResult(); var thumbprint = "notfoundthumprint"; finder.Find(X509FindType.FindByThumbprint, thumbprint).Returns(result); var sut = new BindingConfigurer(binding) { CertificateFinder = finder }; Assert.Throws<InstallationException>(() => sut.UseCertificateWithThumbprint(thumbprint)); }
public void SutIsBindingConfigurer() { var sut = new BindingConfigurer(WebAdministrationFactory.CreateBinding()); Assert.IsAssignableFrom<IBindingConfigurer>(sut); }
public void Constructor_InitializesCertificateFinder() { var sut = new BindingConfigurer(WebAdministrationFactory.CreateBinding()); Assert.IsType<CertificateFinder>(sut.CertificateFinder); }
public void UseProtocol_SetsTheBindingInformationCorrectly() { Binding binding = WebAdministrationFactory.CreateBinding(); var sut = new BindingConfigurer(binding); sut.UseProtocol("https"); Assert.Equal("https", binding.Protocol); }
public void UseHostName_SetsTheBindingInformationCorrectly() { Binding binding = WebAdministrationFactory.CreateBinding(); var sut = new BindingConfigurer(binding); sut.UseHostName("mytestsite.com"); Assert.Equal("*:80:mytestsite.com", binding.BindingInformation); }