コード例 #1
0
            public void WillThrowIfConfiguredSiteRootIsNotHttpOrHttps()
            {
                var configuration = new TestableConfiguration();
                configuration.StubConfiguredSiteRoot = "ftp://theSiteRoot/";

                Assert.Throws<InvalidOperationException>(() => configuration.GetSiteRoot(useHttps: false));
            }
コード例 #2
0
            public void WillThrowIfConfiguredSiteRootIsNotHttpOrHttps()
            {
                var configuration = new TestableConfiguration();

                configuration.StubConfiguredSiteRoot = "ftp://theSiteRoot/";

                Assert.Throws <InvalidOperationException>(() => configuration.GetSiteRoot(useHttps: false));
            }
コード例 #3
0
            public void WillCacheTheSiteRootLookup()
            {
                var configuration = new TestableConfiguration();
                configuration.GetSiteRoot(useHttps: false);
                
                configuration.GetSiteRoot(useHttps: true);

                configuration.StubRequest.Verify(stub => stub.IsLocal, Times.Once());
            }
コード例 #4
0
            public void WillUseHttpUponRequestWhenConfiguredSiteRootIsHttps()
            {
                var configuration = new TestableConfiguration();
                configuration.StubConfiguredSiteRoot = "https://theSiteRoot/";

                var siteRoot = configuration.GetSiteRoot(useHttps: false);

                Assert.Equal("http://theSiteRoot/", siteRoot);
            }
コード例 #5
0
            public void WillGetTheConfiguredHttpsSiteRoot()
            {
                var configuration = new TestableConfiguration();
                configuration.StubConfiguredSiteRoot = "http://theSiteRoot/";

                var siteRoot = configuration.GetSiteRoot(useHttps: true);

                Assert.Equal("https://theSiteRoot/", siteRoot);
            }
コード例 #6
0
            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);
            }
コード例 #7
0
            public void WillCacheTheSiteRootLookup()
            {
                var configuration = new TestableConfiguration();

                configuration.GetSiteRoot(useHttps: false);

                configuration.GetSiteRoot(useHttps: true);

                configuration.StubRequest.Verify(stub => stub.IsLocal, Times.Once());
            }
コード例 #8
0
            public void WillUseHttpUponRequestWhenConfiguredSiteRootIsHttps()
            {
                var configuration = new TestableConfiguration();

                configuration.StubConfiguredSiteRoot = "https://theSiteRoot/";

                var siteRoot = configuration.GetSiteRoot(useHttps: false);

                Assert.Equal("http://theSiteRoot/", siteRoot);
            }
コード例 #9
0
            public void WillGetTheConfiguredHttpsSiteRoot()
            {
                var configuration = new TestableConfiguration();

                configuration.StubConfiguredSiteRoot = "http://theSiteRoot/";

                var siteRoot = configuration.GetSiteRoot(useHttps: true);

                Assert.Equal("https://theSiteRoot/", siteRoot);
            }
コード例 #10
0
        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);
        }
コード例 #11
0
        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>();
        }
コード例 #12
0
            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);
            }
コード例 #13
0
        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)
                );
        }