public void ShouldThrowArgumentNullExceptionWhenArgumentIsNull() { var addressFieldParser = Substitute.For <IAddressFieldParser>(); var parser = new AltbauWohnungenRowParser(addressFieldParser); Assert.That(() => parser.Parse(null), Throws.ArgumentNullException); }
public void ShouldReturnNullWhenAddressFiledParserReturnsNull() { var rows = An.TableRows(); var addressFieldParser = Substitute.For <IAddressFieldParser>(); addressFieldParser.Parse(Arg.Any <string>()).Returns((AddressFieldParserResult)null); var parser = new AltbauWohnungenRowParser(addressFieldParser); // act var result = parser.Parse(rows); Assert.That(result, Is.Null); }
public void ShouldParseHtmlTableRow() { var rows = An.TableRows(); var addressFieldParser = Substitute.For <IAddressFieldParser>(); addressFieldParser.Parse(Arg.Any <string>()).Returns(An.AddressFieldParserResult()); var parser = new AltbauWohnungenRowParser(addressFieldParser); // act var result = parser.Parse(rows); // assert Assert.That(result, Is.Not.Null, "result was null"); Assert.Multiple(() => { Assert.That(result.City, Is.EqualTo("Wien"), nameof(result.City)); Assert.That(result.Eigenmittel, Is.EqualTo(6506m), nameof(result.Eigenmittel)); Assert.That(result.Href, Is.EqualTo(@"nc/home/suche/altbau-wohnungen/?tx_sozaltbau_pi1%5Bad%5D=1&tx_sozaltbau_pi1%5Bmobjnr%5D=7020&tx_sozaltbau_pi1%5Bmlfd%5D=71&cHash=a39630a7a68a5c8145d3ae888be047d4"), nameof(result.Href)); Assert.That(result.MonatlicheKosten, Is.EqualTo(1349m), nameof(result.MonatlicheKosten)); Assert.That(result.NumberOfRooms, Is.EqualTo(4), nameof(result.NumberOfRooms)); Assert.That(result.PostalCode, Is.EqualTo(1010), nameof(result.PostalCode)); Assert.That(result.Street, Is.EqualTo("Gürtel Straße 3-2a/16"), nameof(result.Street)); }); }