Exemplo n.º 1
0
        protected override Airport CreateItem(string data)
        {
            if (string.IsNullOrWhiteSpace(data))
            {
                return(null);
            }

            string[] dataItems = Split(data);

            return(AirportBuilder.Create()
                   .WithICAO(dataItems[(int)AirportIndex.ICAO])
                   .WithATIS(dataItems[(int)AirportIndex.ATIS])
                   .Build());
        }
Exemplo n.º 2
0
        public void Equals_WhenTwoSameInstancesAreCreated_ThenInstancesAreEqual()
        {
            // arrange
            AirportBuilder builder = AirportBuilder.Create()
                                     .WithATIS("A")
                                     .WithICAO("LZKZ");

            Airport instance0 = builder.Build();
            Airport instance1 = builder.Build();

            // act
            bool result = Equals(instance0, instance1);

            // assert
            Assert.That(instance0, Is.Not.Null);
            Assert.That(instance1, Is.Not.Null);
            Assert.That(ReferenceEquals(instance0, instance1), Is.Not.True);
            Assert.That(result, Is.True);
        }
Exemplo n.º 3
0
        public void GetHashCode_WhenTwoSameInstancesAreCreated_ThenInstanceHashCodesAreEqual()
        {
            // arrange
            AirportBuilder builder = AirportBuilder.Create()
                                     .WithATIS("A")
                                     .WithICAO("LZKZ");

            Airport instance0 = builder.Build();
            Airport instance1 = builder.Build();

            // act
            int result0 = instance0.GetHashCode();
            int result1 = instance1.GetHashCode();

            // assert
            Assert.That(instance0, Is.Not.Null);
            Assert.That(instance1, Is.Not.Null);
            Assert.That(ReferenceEquals(instance0, instance1), Is.Not.True);
            Assert.That(Equals(result0, result1), Is.True);
        }
Exemplo n.º 4
0
        public void Clone_WhenInstanceCloned_ThenInstancesAreEqual()
        {
            // arrange
            AirportBuilder builder = AirportBuilder.Create()
                                     .WithATIS("A")
                                     .WithICAO("LZKZ");

            Airport instance0 = builder.Build();

            object instance1 = instance0.Clone();

            // act
            bool result = Equals(instance0, instance1);

            // assert
            Assert.That(instance0, Is.Not.Null);
            Assert.That(instance1, Is.Not.Null);
            Assert.That(instance1, Is.InstanceOf <Airport>());
            Assert.That(ReferenceEquals(instance0, instance1), Is.Not.True);
            Assert.That(result, Is.True);
        }
Exemplo n.º 5
0
        public void Equals_WhenInstanceIsDeseraializeAndSerializedBack_ThenInstancesAreEqual()
        {
            // arrange
            AirportBuilder builder = AirportBuilder.Create()
                                     .WithATIS("A")
                                     .WithICAO("LZKZ");

            Airport instance0 = builder.Build();

            string serializedText = instance0.Serialize();

            Airport instance1 = serializedText.Deserialize <Airport>();

            // act
            bool result = Equals(instance0, instance1);

            // assert
            Assert.That(instance0, Is.Not.Null);
            Assert.That(instance1, Is.Not.Null);
            Assert.That(ReferenceEquals(instance0, instance1), Is.Not.True);
            Assert.That(result, Is.True);
        }