Skip to content

Commit 43c5da1

Browse files
committed
Requested changes
1 parent 38dd690 commit 43c5da1

5 files changed

Lines changed: 147 additions & 95 deletions

File tree

Parse.Tests/LiveQuerySubscriptionTests.cs

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,12 @@ public void TestEnter()
120120
}
121121
};
122122

123-
MutableObjectState state = originalState;
123+
MutableObjectState state = new() {
124+
ObjectId = originalState.ObjectId,
125+
ClassName = originalState.ClassName,
126+
CreatedAt = originalState.CreatedAt,
127+
ServerData = new Dictionary<string, object>(originalState.ServerData)
128+
};
124129
state["key"] = "after";
125130

126131
ParseLiveQuerySubscription<ParseObject> subscription = new(Client.Services, "Corgi", 1);

Parse.Tests/ObjectServiceExtensionsTests.cs

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -264,4 +264,25 @@ public void GetFieldForPropertyName_ReturnsExpectedMapping()
264264
mockHub.Setup(h => h.ClassController).Returns(mockController.Object);
265265
Assert.AreEqual("field", mockHub.Object.GetFieldForPropertyName("cls", "prop"));
266266
}
267+
268+
[TestMethod]
269+
public async Task ConnectLiveQueryServerAsync_NullController_Throws()
270+
{
271+
Mock<IServiceHub> mockHub = new Mock<IServiceHub>();
272+
mockHub.Setup(h => h.LiveQueryController).Returns((IParseLiveQueryController)null);
273+
await Assert.ThrowsExceptionAsync<InvalidOperationException>(
274+
() => mockHub.Object.ConnectLiveQueryServerAsync((s, e) => { }));
275+
}
276+
277+
[TestMethod]
278+
public async Task DisconnectLiveQueryServerAsync_CloseThrows_Propagates()
279+
{
280+
Mock<IServiceHub> mockHub = new Mock<IServiceHub>();
281+
Mock<IParseLiveQueryController> mockLq = new Mock<IParseLiveQueryController>();
282+
mockLq.Setup(l => l.CloseAsync(It.IsAny<CancellationToken>()))
283+
.ThrowsAsync(new Exception("close failed"));
284+
mockHub.Setup(h => h.LiveQueryController).Returns(mockLq.Object);
285+
286+
await Assert.ThrowsExceptionAsync<Exception>(() => mockHub.Object.DisconnectLiveQueryServerAsync());
287+
}
267288
}

0 commit comments

Comments
 (0)