public void WillThrowIfConfiguredSiteRootIsNotHttpOrHttps() { var configuration = new TestableConfiguration(); configuration.StubConfiguredSiteRoot = "ftp://theSiteRoot/"; Assert.Throws<InvalidOperationException>(() => configuration.GetSiteRoot(useHttps: false)); }
public void WillThrowIfConfiguredSiteRootIsNotHttpOrHttps() { var configuration = new TestableConfiguration(); configuration.StubConfiguredSiteRoot = "ftp://theSiteRoot/"; Assert.Throws <InvalidOperationException>(() => configuration.GetSiteRoot(useHttps: false)); }
public void WillCacheTheSiteRootLookup() { var configuration = new TestableConfiguration(); configuration.GetSiteRoot(useHttps: false); configuration.GetSiteRoot(useHttps: true); configuration.StubRequest.Verify(stub => stub.IsLocal, Times.Once()); }
public void WillUseHttpUponRequestWhenConfiguredSiteRootIsHttps() { var configuration = new TestableConfiguration(); configuration.StubConfiguredSiteRoot = "https://theSiteRoot/"; var siteRoot = configuration.GetSiteRoot(useHttps: false); Assert.Equal("http://theSiteRoot/", siteRoot); }
public void WillGetTheConfiguredHttpsSiteRoot() { var configuration = new TestableConfiguration(); configuration.StubConfiguredSiteRoot = "http://theSiteRoot/"; var siteRoot = configuration.GetSiteRoot(useHttps: true); Assert.Equal("https://theSiteRoot/", siteRoot); }
public void WillUseTheActualRootWhenTheRequestIsLocal() { var configuration = new TestableConfiguration(); configuration.StubRequest.Setup(stub => stub.IsLocal).Returns(true); configuration.StubRequest.Setup(stub => stub.Url).Returns(new Uri("http://theLocalSiteRoot/aPath")); var siteRoot = configuration.GetSiteRoot(useHttps: true); Assert.Equal("https://thelocalsiteroot/", siteRoot); }
public void NetworkLayerCount(int hiddenLayerCount, int neuronPerLayer) { //arrange IConfiguration testConfig = new TestableConfiguration(hiddenLayerCount, neuronPerLayer, false); //Act Network <int> sut = new Network <int>(testConfig, _input, _output); //assert sut.Layers.Length.Should().Be(hiddenLayerCount + 2); }
public void FalsyNetworkCreation(int hiddenLayerCount, int neuronPerLayer) { //arrange IConfiguration testConfig = new TestableConfiguration(hiddenLayerCount, neuronPerLayer, false); //Act Action sut = () => new Network <int>(testConfig, _input, _output); //assert sut.Should().Throw <ArgumentException>(); }
public void NetworkTotalNeuronCount(int hiddenLayerCount, int neuronPerLayer) { //arrange IConfiguration testConfig = new TestableConfiguration(hiddenLayerCount, neuronPerLayer, false); //Act Network <int> sut = new Network <int>(testConfig, _input, _output); //assert sut.NeuronCount.Should().Be( (hiddenLayerCount * neuronPerLayer) + (_input.Width * _input.Height) + (_output.OutputCount) ); }