private ApplicationWrapper CreateApp_1StatelessService_2Partition_2ReplicasEach( string appTypeName, string serviceTypeName, out ServiceWrapper service, out List <ReplicaWrapper> replicas, out List <PartitionWrapper> partitions) { service = CreateService(appTypeName, serviceTypeName, 2, 2, out replicas, out partitions); Mock_ServicesResponse(new Uri($"fabric:/{appTypeName}"), service); return(SFTestHelpers.FakeApp(appTypeName, appTypeName)); }
// Mocking helpers private ApplicationWrapper CreateApp_1Service_SingletonPartition_1Replica( string appTypeName, string serviceTypeName, out ServiceWrapper service, out ReplicaWrapper replica, out PartitionWrapper partition, ServiceKind serviceKind = ServiceKind.Stateless) { service = CreateService(appTypeName, serviceTypeName, 1, 1, out var replicas, out var partitions, serviceKind); replica = replicas[0]; partition = partitions[0]; Mock_ServicesResponse(new Uri($"fabric:/{appTypeName}"), service); return(SFTestHelpers.FakeApp(appTypeName, appTypeName)); }
public async void GetApplicationListAsync_ServiceFabricFails_ResultIsCached() { var caller = Create <CachedServiceFabricCaller>(); var originalApps = new List <ApplicationWrapper> { SFTestHelpers.FakeApp("MyApp") }; Mock <IQueryClientWrapper>() .SetupSequence(m => m.GetApplicationListAsync( It.IsAny <TimeSpan>(), It.IsAny <CancellationToken>())) .ReturnsAsync(originalApps) .ThrowsAsync(new Exception("the cake is a lie")) .ThrowsAsync(new Exception("the cake is still a lie")); await CallThreeTimesAndAssertAsync(() => caller.GetApplicationListAsync(CancellationToken.None)); }
private ApplicationWrapper CreateApp_2StatelessService_SingletonPartition_1Replica( string appTypeName, string serviceTypeName1, string serviceTypeName2, out ServiceWrapper service1, out ServiceWrapper service2, out ReplicaWrapper service1replica, out ReplicaWrapper service2replica, out PartitionWrapper service1partition, out PartitionWrapper service2partition) { service1 = CreateService(appTypeName, serviceTypeName1, 1, 1, out var replicas1, out var partitions1); service2 = CreateService(appTypeName, serviceTypeName2, 1, 1, out var replicas2, out var partitions2); service1replica = replicas1[0]; service2replica = replicas2[0]; service1partition = partitions1[0]; service2partition = partitions2[0]; Mock_ServicesResponse(new Uri($"fabric:/{appTypeName}"), service1, service2); return(SFTestHelpers.FakeApp(appTypeName, appTypeName)); }