public void TestEqualIsEqualWithServiceModelConversion() { var r1 = CreateRegistration(); var m = r1.ToServiceModel(); var r2 = SupervisorRegistration.FromServiceModel(m); Assert.Equal(r1, r2); Assert.Equal(r1.GetHashCode(), r2.GetHashCode()); Assert.True(r1 == r2); Assert.False(r1 != r2); }
public void TestEqualIsNotEqualWithServiceModelConversion() { var r1 = CreateRegistration(); var m = r1.ToServiceModel(); m.DiscoveryConfig.AddressRangesToScan = ""; var r2 = SupervisorRegistration.FromServiceModel(m); Assert.NotEqual(r1, r2); Assert.NotEqual(r1.GetHashCode(), r2.GetHashCode()); Assert.True(r1 != r2); Assert.False(r1 == r2); }
public void TestEqualIsNotEqualWithServiceModelConversionWhenDisabled() { var fix = new Fixture(); var r1 = CreateRegistration(); var m = r1.ToServiceModel(); var r2 = SupervisorRegistration.FromServiceModel(m, true); Assert.NotEqual(r1, r2); Assert.NotEqual(r1.GetHashCode(), r2.GetHashCode()); Assert.True(r1 != r2); Assert.False(r1 == r2); }
public void TestEqualIsEqualWithDeviceModelWhenDisabled() { var fix = new Fixture(); var r1 = CreateRegistration(); var r2 = SupervisorRegistration.FromServiceModel( r1.ToServiceModel(), true); var m1 = SupervisorRegistration.Patch(r1, r2); var r3 = SupervisorRegistration.FromServiceModel( r2.ToServiceModel(), false); var m2 = SupervisorRegistration.Patch(r2, r3); Assert.True((bool)m1.Tags[nameof(BaseRegistration.IsDisabled)]); Assert.NotNull((DateTime?)m1.Tags[nameof(BaseRegistration.NotSeenSince)]); Assert.Null((bool?)m2.Tags[nameof(BaseRegistration.IsDisabled)]); Assert.Null((DateTime?)m2.Tags[nameof(BaseRegistration.NotSeenSince)]); }