Ejemplo n.º 1
0
        public void GetNorwayOffices_empty_input_should_be_empty()
        {
            var sut = new OfficeReader();

            var result = sut.GetNorwayOffices(string.Empty);

            result.Should().BeEmpty();
        }
Ejemplo n.º 2
0
        public void GetNorwayOffices_line_without_country_should_throw_indexoutofrange()
        {
            const string invalidFirstLine = "\nthis is an invalid line without country";
            var          sut = new OfficeReader();

            Action act = () => sut.GetNorwayOffices(invalidFirstLine);

            act.Should().Throw <IndexOutOfRangeException>();
        }
Ejemplo n.º 3
0
        public void GetNorwayOffices_first_line_should_be_skipped()
        {
            const string invalidFirstLine = "this is an invalid line";
            var          sut = new OfficeReader();

            var result = sut.GetNorwayOffices(invalidFirstLine);

            result.Should().BeEmpty();
        }
Ejemplo n.º 4
0
        public void GetNorwayOffices_without_norway_lines_should_be_empty()
        {
            const string inputWithoutNorway = "\nx, Belgium, , y\nz, Netherlands, , \n";

            var sut = new OfficeReader();

            var result = sut.GetNorwayOffices(inputWithoutNorway);

            result.Should().BeEmpty();
        }
Ejemplo n.º 5
0
        public void GetNorwayOffices_empty_lines_should_be_skipped()
        {
            const string inputWithTwoOfficesAndEmptyLine = "\nx, Norway, , y\n \n z, Norway, , \n";
            const int    expectedCount = 2;

            var sut = new OfficeReader();

            var result = sut.GetNorwayOffices(inputWithTwoOfficesAndEmptyLine);

            result.Should().HaveCount(expectedCount);
        }
Ejemplo n.º 6
0
        public void GetNorwayOffices_Norway_office_should_be_returned()
        {
            const string inputWithNorwayOffice = "\ncity, Norway, phone, address";
            var          expected = new Office {
                City = "city", Phone = "phone", Address = "address"
            };

            var sut = new OfficeReader();

            var result = sut.GetNorwayOffices(inputWithNorwayOffice);

            result.Should().OnlyContain(office => office.Equals(expected));
        }