Exemple #1
0
        public void RevertRowNotInitialized()
        {
            // Setup:
            // ... Create a session without initializing
            Mock <IEditMetadataFactory> emf = new Mock <IEditMetadataFactory>();
            EditSession s = new EditSession(emf.Object);

            // If: I ask to revert a row without initializing
            // Then: I should get an exception
            Assert.Throws <InvalidOperationException>(() => s.RevertRow(0));
        }
Exemple #2
0
        public async Task RevertRowSuccess()
        {
            // Setup:
            // ... Create a session with a proper query and metadata
            EditSession s = await GetBasicSession();

            // ... Add a mock edit to the edit cache to cause the .TryAdd to fail
            var mockEdit = new Mock <RowEditBase>().Object;

            s.EditCache[0] = mockEdit;

            // If: I revert the row that has a pending update
            s.RevertRow(0);

            // Then:
            // ... The edit cache should not contain a pending edit for the row
            Assert.DoesNotContain(0, s.EditCache.Keys);
        }