コード例 #1
0
        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);
        }
コード例 #2
0
        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);
        }
コード例 #3
0
        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);
        }
コード例 #4
0
        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)]);
        }