public void T5_stations_are_created_by_cities_and_have_a_unique_name() { ICity s = CityFactory.CreateCity("Paris"); IStation p1 = s.AddStation("Opera", 0, 0); p1.City.Should().BeSameAs(s); p1.Name.Should().BeEquivalentTo("Opera"); p1.X.Should().Be(0); p1.Y.Should().Be(0); Action a = () => s.AddStation("Opera", 0, 0); a.ShouldThrow <ArgumentException>(); Action a1 = () => s.AddStation("Opera", 10, 0); a1.ShouldThrow <ArgumentException>(); Action a2 = () => s.AddStation("Opera", 0, 10); a2.ShouldThrow <ArgumentException>(); IStation p2 = s.AddStation("Chatelet", 1, 1); p2.City.Should().BeSameAs(s); p2.Name.Should().BeEquivalentTo("Chatelet"); p2.X.Should().Be(1); p2.Y.Should().Be(1); Action a4 = () => s.AddStation("Chatelet", 0, 0); a4.ShouldThrow <ArgumentException>(); Action a5 = () => s.AddStation("Chatelet", 10, 0); a5.ShouldThrow <ArgumentException>(); Action a6 = () => s.AddStation("Chatelet", 0, 10); a6.ShouldThrow <ArgumentException>(); Action a7 = () => s.AddStation("Same Place Station", 0, 0); a7.ShouldThrow <ArgumentException>(); p1.GetType().GetProperty("Name").GetSetMethod().Should().BeNull("Lane.Name must NOT be writeable."); p1.GetType().GetProperty("X").GetSetMethod().Should().BeNull("Lane.X must NOT be writeable."); p1.GetType().GetProperty("Y").GetSetMethod().Should().BeNull("Lane.Y must NOT be writeable."); p1.GetType().GetConstructors(BindingFlags.Instance | BindingFlags.Public).Should().BeEmpty("Train must not expose any public constructors."); }