コード例 #1
0
        public void PersistenceSettingsData_Clone_Success()
        {
            var data1 = new PersistenceSettingsData
            {
                PersistenceScheduler = "Hangfire",
                Enable = true,
                PersistenceDataSource = new NamedGuidWithEncryptedPayload
                {
                    Name    = "Data Source",
                    Value   = Guid.Empty,
                    Payload = "foo1"
                },
                EncryptDataSource        = true,
                DashboardHostname        = "DashboardHostname",
                DashboardName            = "Dashboardname",
                DashboardPort            = "5001",
                PrepareSchemaIfNecessary = true,
                ServerName = "servername"
            };

            var data2 = data1.Clone();

            Assert.AreNotEqual(data1.GetHashCode(), data2.GetHashCode());
            Assert.IsFalse(ReferenceEquals(data1, data2));
            Assert.IsFalse(ReferenceEquals(data1.PersistenceDataSource, data2.PersistenceDataSource));

            Assert.IsTrue(data1.Equals(data2));
            data1.PersistenceDataSource.Payload = "foo2";
            Assert.IsFalse(data1.Equals(data2));
        }
コード例 #2
0
        public void PersistenceSettingsData_Clone_Failure()
        {
            var data1 = new PersistenceSettingsData
            {
                PersistenceScheduler = "Hangfire",
                Enable = true,
                PersistenceDataSource    = null,
                EncryptDataSource        = true,
                DashboardHostname        = "DashboardHostname",
                DashboardName            = "Dashboardname",
                DashboardPort            = "5001",
                PrepareSchemaIfNecessary = true,
                ServerName = "servername"
            };

            data1.Clone();
        }