public void Clone_WhenInstanceCloned_ThenInstancesAreEqual()
        {
            // arrange
            FollowMeBuilder builder = FollowMeBuilder.Create()
                                      .WithAdministrativeVersion(AdministrativeRating.Administrator)
                                      .WithCallsign("LZKZ_FOLLOW")
                                      .WithClientRating(2)
                                      .WithConnectionTime(DateTime.Now)
                                      .WithLocation(null)
                                      .WithName("name")
                                      .WithProtocol("protocol")
                                      .WithServer("server")
                                      .WithSoftwareName("IVAC")
                                      .WithSoftwareVersion("3.2.1.3")
                                      .WithVID("1234567");

            FollowMe 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 <FollowMe>());
            Assert.That(ReferenceEquals(instance0, instance1), Is.Not.True);
            Assert.That(result, Is.True);
        }
        public void GetHashCode_WhenTwoSameInstancesAreCreated_ThenInstanceHashCodesAreEqual()
        {
            // arrange
            FollowMeBuilder builder = FollowMeBuilder.Create()
                                      .WithAdministrativeVersion(AdministrativeRating.Administrator)
                                      .WithCallsign("LZKZ_FOLLOW")
                                      .WithClientRating(2)
                                      .WithConnectionTime(DateTime.Now)
                                      .WithLocation(null)
                                      .WithName("name")
                                      .WithProtocol("protocol")
                                      .WithServer("server")
                                      .WithSoftwareName("IVAC")
                                      .WithSoftwareVersion("3.2.1.3")
                                      .WithVID("1234567");

            FollowMe instance0 = builder.Build();
            FollowMe 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.º 3
0
 void Start()
 {
     followScript         = GetComponent <FollowMe>();
     followScript.enabled = false;
     zoneScript           = GetComponent <ZoneCamera>();
 }