public async Task TestAddOrUpdateForMsgNotifyAsync() { var dict = await stateManager.GetOrAddAsync <IReliableDictionary2 <string, MsgNotifyBizSystem> >(Service.DictionaryName_MsgNotifyBizSystem); var target = new BizSystemAppService(statefulServiceContext, stateManager); var result = await target.AddOrUpdateForMsgNotifyAsync(new MsgNotifyBizSystem { Id = "test", Name = "测试", }); Assert.IsTrue(result); }
public async Task TestAddOrUpdateForTodoCenterAsync() { var dictBizSystem = await stateManager.GetOrAddAsync <IReliableDictionary2 <string, TodoCenterBizSystem> >(Service.DictionaryName_TodoCenterBizSystem); var target = new BizSystemAppService(statefulServiceContext, stateManager); var result = await target.AddOrUpdateForTodoCenterAsync(new TodoCenterBizSystem { Id = "test", Name = "测试", PendingListUrl = "about:", PendingListAmountUrl = "about:", DoneListUrl = "about:", OpenDetailUris = new Dictionary <ClientPlatform, string> { [ClientPlatform.Android] = "about:" } }); Assert.IsTrue(result); }
public async Task Test_GetAllForMsgNotifyAsync_RemoveForMsgNotifyAsync() { var dict = await stateManager.GetOrAddAsync <IReliableDictionary2 <string, MsgNotifyBizSystem> >(Service.DictionaryName_MsgNotifyBizSystem); using (var tx = stateManager.CreateTransaction()) { await dict.AddAsync(tx, "aaa", new MsgNotifyBizSystem { Id = "aaa", Name = "aaa" }); await dict.AddAsync(tx, "bbb", new MsgNotifyBizSystem { Id = "bbb", Name = "bbb" }); await tx.CommitAsync(); } var target = new BizSystemAppService(statefulServiceContext, stateManager); var result = await target.GetAllForMsgNotifyAsync(); result.Should().NotBeNull(); result.Count.Should().Be(2); var removeResult = await target.RemoveForMsgNotifyAsync("bbb"); removeResult.Should().BeTrue(); result = await target.GetAllForMsgNotifyAsync(); result.Should().NotBeNull(); result.Count.Should().Be(1); var singleResult = await target.GetByIdForNotifyMsgAsync("aaa"); singleResult.Should().NotBeNull(); singleResult.Name.Should().Be("aaa"); }