예제 #1
0
        public void QueryHealthOffice_ThrowsException_ReturnsNull()
        {
            var rkiTool = new RkiTool(s => { throw new Exception(); });

            var healthOffice = rkiTool.QueryHealthOffice("111111");

            healthOffice.Should().BeNull();
        }
예제 #2
0
        public void QueryHealthOffice_InvalidPostalCode_ReturnsNull()
        {
            var rkiTool = new RkiTool(s => RkiToolQueryNoResult);

            var healthOffice = rkiTool.QueryHealthOffice("111111");

            healthOffice.Should().BeNull();
        }
예제 #3
0
        public void QueryHealthOffice_AddressWithUmlaut_UnescapesHtml()
        {
            var rkiTool = new RkiTool(s => RkiToolQueryResultWithUmlaut);

            var healthOffice = rkiTool.QueryHealthOffice("96317");

            healthOffice.Should().NotBeNull();
            healthOffice.Address.Should()
            .Be("Landratsamt Kronach\nSachgebiet 36 - Gesundheitsamt\nGüterstrasse 18\n96317 Kronach");
        }
예제 #4
0
        public void QueryHealthOffice_MultipleResults_ReturnsFirst()
        {
            var expectedHealthOffice = new HealthOffice
            {
                Address    = "Landratsamt Forchheim\nGesundheitsamt\nAm Streckerplatz 3\n91301 Forchheim",
                Phone      = "09191 86-3504",
                Fax        = "09191 86-3508",
                Email      = "*****@*****.**",
                PostalCode = "91301"
            };
            var rkiTool = new RkiTool(s => RkiToolQueryMultipleResults);

            var healthOffice = rkiTool.QueryHealthOffice("91301");

            healthOffice.Should().BeEquivalentTo(expectedHealthOffice);
        }
예제 #5
0
        public void QueryHealthOffice_InvalidPhoneAndFax_RemovesExcessSpaces()
        {
            var expectedHealthOffice = new HealthOffice
            {
                Address    = "Landratsamt Forchheim\nGesundheitsamt\nAm Streckerplatz 3\n91301 Forchheim",
                Phone      = "09191 86-3504",
                Fax        = "09191 86-3508",
                Email      = "*****@*****.**",
                PostalCode = "91301"
            };
            var rkiTool = new RkiTool(s => RkiToolQueryResultWithInvalidPhoneAndFax);

            var healthOffice = rkiTool.QueryHealthOffice("91301");

            healthOffice.Should().BeEquivalentTo(expectedHealthOffice);
        }