Beispiel #1
0
        public async Task Updates_all_properties_of_the_local_item()
        {
            await AddTablesAsync();

            var localItems = new List <TestItem>
            {
                new TestItem {
                    Id = "123", Name = "LocalName1"
                },
                new TestItem {
                    Id = "456", Name = "LocalName2"
                },
            };

            DataStore.FindByIdAsync <TestItem>(localItems[0].Id).Returns(localItems[0]);
            DataStore.FindByIdAsync <TestItem>(localItems[1].Id).Returns(localItems[1]);

            await NubeClient.PullTableAsync <TestItem>();

            await DataStore.DidNotReceive().InsertAsync(Arg.Any <TestItem>());

            await DataStore.Received().UpdateAsync(Arg.Is <TestItem>(i => i.Id == localItems[0].Id && i.Name == HttpMessageHandler.Results[0].Name));

            await DataStore.Received().UpdateAsync(Arg.Is <TestItem>(i => i.Id == localItems[1].Id && i.Name == HttpMessageHandler.Results[1].Name));

            await ChangeTracker.DidNotReceive().TrackAddAsync(Arg.Any <TestItem>());

            await ChangeTracker.DidNotReceive().TrackModifyAsync(Arg.Any <TestItem>(), Arg.Any <TestItem>());
        }
Beispiel #2
0
        public async Task Does_not_track_the_delete_when_change_tracker_is_disabled()
        {
            await AddTablesAsync();

            DataStore.DeleteAsync(Arg.Any <TestItem>()).Returns(true);

            await NubeClient.DeleteAsync(Item, true);

            await ChangeTracker.DidNotReceive().TrackDeleteAsync(Arg.Any <TestItem>());
        }
Beispiel #3
0
        public async Task Does_not_track_update_when_change_tracker_is_disabled()
        {
            await AddTablesAsync();

            _AddItemToStore();
            DataStore.UpdateAsync(Arg.Any <TestItem>()).Returns(true);

            await NubeClient.SaveAsync(Item, true);

            await ChangeTracker.DidNotReceive().TrackModifyAsync(Arg.Any <TestItem>(), Arg.Any <TestItem>());
        }