public LoginViewModel() { cache = DependencyService.Get <SubscriptionsCache>(); string emptyValidationMessage = Translations.Validations_NullOrEmptyMessage; var emptyRule = new IsNotNullOrEmptyRule { ValidationMessage = emptyValidationMessage, }; password = new ValidatableObject <string>(); password.Validations.Add(emptyRule); clientId = new ValidatableObject <string>(); clientId.Validations.Add(emptyRule); tenantId = new ValidatableObject <string>(); tenantId.Validations.Add(emptyRule); #if DEBUG /* * Avoid having to enter credentials every time app is deployed * during development */ ClientId.Value = AppSettings.ClientId; TenantId.Value = AppSettings.TenantId; ClientId.IsValid = TenantId.IsValid = Password.IsValid = true; #else ClientId.IsValid = TenantId.IsValid = Password.IsValid = false; #endif }
public IConfigurable[] Find <T>(QueryFilter filter, ObjectId rootId, bool deepSearch, SortBy sortBy) where T : IConfigurable, new() { SubscriptionsCache cacheForRead = this.GetCacheForRead(); return(new IConfigurable[] { cacheForRead }); }
public void Add_WithSubscriber_ReturnsSubscriptionWithSameTopicType() { // Arrange var cache = new SubscriptionsCache(); // Act var subscription = cache.Add <Topic>(subscriber); // Assert Assert.That(subscription.TopicType, Is.EqualTo(typeof(Topic))); }
public void Add_WithSubscriber_ReturnsSubscription() { // Arrange var cache = new SubscriptionsCache(); // Act var subscription = cache.Add <Topic>(subscriber); // Assert Assert.That(subscription, Is.Not.Null); }
public void Add_WithNullSubscriber_ThrowsArgumentNullException() { // Arrange var cache = new SubscriptionsCache(); // Act TestDelegate add = () => cache.Add <Topic>(null); // Assert Assert.That(add, Throws.ArgumentNullException); }
public void Remove_WithNoSubscriptionAdded_DoesNothing() { // Arrange var cache = new SubscriptionsCache(); // Act TestDelegate remove = () => cache.Remove <Topic>(subscriber); // Assert Assert.That(remove, Throws.Nothing); }
public void Add_WhenSubscriptionDisposeCalled_CallsSubscriberUnsubscribe() { // Arrange var cache = new SubscriptionsCache(); // Act cache.Add <Topic>(subscriber).Dispose(); // Assert mockSubscriber.Verify(m => m.Unsubscribe <Topic>(), Times.Once); }
private SubscriptionsCache GetCacheForRead() { SubscriptionsCache subscriptionsCache = new SubscriptionsCache(); subscriptionsCache.SetIdentity(this.userPrincipal.ObjectId); if (this.cacheAction == SubscriptionCacheAction.None || this.cacheAction == SubscriptionCacheAction.Validate) { this.TestUserCache(subscriptionsCache); } return(subscriptionsCache); }
public void Add_CalledTwiceWithDifferentSubscribers_ReturnsDifferentSubscriptionInstance() { // Arrange var cache = new SubscriptionsCache(); // Act var sub1 = cache.Add <Topic>(subscriber); var sub2 = cache.Add <Topic>(subscriber2); // Assert Assert.That(sub1, Is.Not.SameAs(sub2)); }
public void Remove_WithSubscriptionAdded_CallsSubscriberUnsubscribe() { // Arrange var cache = new SubscriptionsCache(); cache.Add <Topic>(subscriber); // Act cache.Remove <Topic>(subscriber); // Assert mockSubscriber.Verify(m => m.Unsubscribe <Topic>(), Times.Once); }
public void Remove_WithTwoSubscriptionsAdded_CallsCorrectUnsubscribe_2() { // Arrange var cache = new SubscriptionsCache(); cache.Add <Topic>(subscriber); cache.Add <Topic>(subscriber2); // Act cache.Remove <Topic>(subscriber2); // Assert mockSubscriber2.Verify(m => m.Unsubscribe <Topic>(), Times.Once); }
public void Remove_WhenCalledForSameSubscriberTwice_UnsubscribesOnce() { // Arrange var cache = new SubscriptionsCache(); cache.Add <Topic>(subscriber); // Act cache.Remove <Topic>(subscriber); cache.Remove <Topic>(subscriber); // Assert mockSubscriber.Verify(m => m.Unsubscribe <Topic>(), Times.Once); }
public Builder(string name) { this.name = name; TopicRouter = new TopicRouter(); MonitorCache = new MonitorCache(); RequestRouter = new RequestRouter(); PackageFactory = new PackageFactory(); TopicDispatcher = new TopicDispatcher(); RequestDispatcher = new RequestDispatcher(); SubscriptionsCache = new SubscriptionsCache(); SerializerCache = new SerializerCache(); SenderCache = new SenderCache(RequestRouter, MonitorCache); ReceiverCache = new ReceiverCache(MonitorCache); PublisherCache = new PublisherCache(MonitorCache); SubscriberCache = new SubscriberCache(TopicRouter, MonitorCache, SubscriptionsCache); }
public ResourceGroupViewModel() { useExistingResourceGroup = true; newResourceGroupName = new ValidatableObject <string>(); newResourceGroupName.Validations.Add( new IsNotNullOrEmptyRule() { ValidationMessage = Translations.Validations_ResourceGroup_RequiredName, }); newResourceGroupName.Validations.Add( new EvalValidationRule <string>( CheckResourceGroupName, Translations.Validations_ResourceGroup_InvalidName)); newResourceGroupName.Validations.Add( new EvalValidationRule <string>( CheckResourceGroupUnique, Translations.Validations_ResourceGroup_DuplicatedName)); subscriptionCache = DependencyService.Get <SubscriptionsCache>(); }
private void TestUserCache(SubscriptionsCache subscriptionsCache) { string serverFqdn = this.userPrincipal.MailboxInfo.Location.ServerFqdn; string primarySmtpAddress = this.userPrincipal.MailboxInfo.PrimarySmtpAddress.ToString(); string failureReason; uint num; List <SubscriptionCacheObject> subscriptionCacheObjects; ObjectState objectState; if (!SubscriptionCacheClient.TryTestUserCache(serverFqdn, primarySmtpAddress, this.cacheAction, out failureReason, out num, out subscriptionCacheObjects, out objectState)) { subscriptionsCache.FailureReason = failureReason; return; } uint num2 = num; if (num2 != 0U) { switch (num2) { case 268435456U: subscriptionsCache.FailureReason = Strings.CacheRpcServerFailed(serverFqdn, failureReason); break; case 268435457U: subscriptionsCache.FailureReason = Strings.CacheRpcServerStopped(serverFqdn); break; case 268435458U: subscriptionsCache.FailureReason = Strings.CacheRpcInvalidServerVersionIssue(serverFqdn); break; default: throw new InvalidObjectOperationException(Strings.InvalidCacheActionResult(num)); } } subscriptionsCache.SubscriptionCacheObjects = subscriptionCacheObjects; subscriptionsCache.propertyBag.SetField(SimpleProviderObjectSchema.ObjectState, objectState); subscriptionsCache.propertyBag.ResetChangeTracking(SimpleProviderObjectSchema.ObjectState); }
public SubscriptionViewModel() { cache = DependencyService.Get <SubscriptionsCache>(); }
public CacheIdParameter(SubscriptionsCache cache) { this.Initialize(cache.Identity); }
public void Delete(IConfigurable instance) { SubscriptionsCache subscriptionsCache = (SubscriptionsCache)instance; this.TestUserCache(subscriptionsCache); }