示例#1
0
        public void All_local_etags_lower_than_remote_should_return_Update_at_conflict_status()
        {
            var dbIds = new List <Guid> {
                Guid.NewGuid(), Guid.NewGuid(), Guid.NewGuid()
            };

            var local = new[]
            {
                new ChangeVectorEntry {
                    DbId = dbIds[0], Etag = 1
                },
                new ChangeVectorEntry {
                    DbId = dbIds[1], Etag = 2
                },
                new ChangeVectorEntry {
                    DbId = dbIds[2], Etag = 3
                },
            };

            var remote = new[]
            {
                new ChangeVectorEntry {
                    DbId = dbIds[0], Etag = 10
                },
                new ChangeVectorEntry {
                    DbId = dbIds[1], Etag = 20
                },
                new ChangeVectorEntry {
                    DbId = dbIds[2], Etag = 30
                },
            };

            Assert.Equal(IncomingReplicationHandler.ConflictStatus.Update, IncomingReplicationHandler.GetConflictStatus(remote, local));
        }
示例#2
0
        public void Some_remote_etags_lower_than_local_and_some_higher_should_return_Conflict_at_conflict_status_with_different_order()
        {
            var dbIds = new List <Guid> {
                Guid.NewGuid(), Guid.NewGuid(), Guid.NewGuid()
            };

            var local = new[]
            {
                new ChangeVectorEntry {
                    DbId = dbIds[1], Etag = 75
                },
                new ChangeVectorEntry {
                    DbId = dbIds[0], Etag = 10
                },
                new ChangeVectorEntry {
                    DbId = dbIds[2], Etag = 3
                },
            };

            var remote = new[]
            {
                new ChangeVectorEntry {
                    DbId = dbIds[1], Etag = 95
                },
                new ChangeVectorEntry {
                    DbId = dbIds[2], Etag = 2
                },
                new ChangeVectorEntry {
                    DbId = dbIds[0], Etag = 10
                },
            };

            Assert.Equal(IncomingReplicationHandler.ConflictStatus.Conflict, IncomingReplicationHandler.GetConflictStatus(remote, local));
        }
示例#3
0
        public void Remote_change_vector_with_different_dbId_set_than_local_should_return_Conflict_at_conflict_status()
        {
            var dbIds = new List <Guid> {
                Guid.NewGuid(), Guid.NewGuid()
            };
            var local = new[]
            {
                new ChangeVectorEntry {
                    DbId = dbIds[0], Etag = 10
                },
            };

            var remote = new[]
            {
                new ChangeVectorEntry {
                    DbId = dbIds[1], Etag = 10
                }
            };

            Assert.Equal(IncomingReplicationHandler.ConflictStatus.Conflict, IncomingReplicationHandler.GetConflictStatus(remote, local));
        }
示例#4
0
        public void Remote_change_vector_smaller_than_local_and_some_remote_etags_higher_than_local_should_return_Conflict_at_conflict_status()
        {
            var dbIds = new List <Guid> {
                Guid.NewGuid(), Guid.NewGuid(), Guid.NewGuid(), Guid.NewGuid()
            };

            var local = new[]
            {
                new ChangeVectorEntry {
                    DbId = dbIds[0], Etag = 10
                },
                new ChangeVectorEntry {
                    DbId = dbIds[1], Etag = 20
                },
                new ChangeVectorEntry {
                    DbId = dbIds[2], Etag = 3000
                },
                new ChangeVectorEntry {
                    DbId = dbIds[3], Etag = 40
                }
            };

            var remote = new[]
            {
                new ChangeVectorEntry {
                    DbId = dbIds[0], Etag = 100
                },
                new ChangeVectorEntry {
                    DbId = dbIds[1], Etag = 200
                },
                new ChangeVectorEntry {
                    DbId = dbIds[2], Etag = 300
                }
            };

            Assert.Equal(IncomingReplicationHandler.ConflictStatus.Conflict, IncomingReplicationHandler.GetConflictStatus(remote, local));
        }