コード例 #1
0
        public void DoNotUploadAttribute_Upload()
        {
            var obj = new DbSyncWithDoNotUpload()
            {
                Text = "zxczxczxc",
                Tags = "zxc",
            };

            var res = _realmiusSyncService.SerializeObject(obj);

            res.Should().NotContain("Tags");
        }
コード例 #2
0
        public void DoNotUploadAttribute_Download()
        {
            var realm = GetRealm();

            var key = Guid.NewGuid().ToString();
            var obj = new DbSyncWithDoNotUpload()
            {
                Text = "zxczxczxc",
                Id   = key
            };

            realm.Write(() =>
            {
                realm.AddSkipUpload(obj);
            });

            realm.Refresh();

            _apiClientMock.Raise(x => x.NewDataDownloaded += null, _apiClientMock.Object, new DownloadDataResponse()
            {
                LastChange = new Dictionary <string, DateTimeOffset>()
                {
                    { "all", DateTimeOffset.Now }
                },
                ChangedObjects =
                {
                    new DownloadResponseItem()
                    {
                        Type             = nameof(DbSyncWithDoNotUpload),
                        MobilePrimaryKey = key,
                        SerializedObject = "{\"Id\":\"" + key + "\", \"Tags\":\"qwe\", \"Text\":\"zxczxczxc\",\"MobilePrimaryKey\":\"" + key + "\"}",
                    }
                }
            });
            Thread.Sleep(20);
            realm.Refresh();
            var obj2 = realm.Find <DbSyncWithDoNotUpload>(key);

            obj2.Should().NotBeNull();
            obj2.Tags.ShouldBeEquivalentTo("qwe");
        }