Example #1
0
        public void SignalRUsageTest()
        {
            var handler = new RecordedDelegatingHandler {
                StatusCodeToReturn = HttpStatusCode.OK
            };

            using (var context = MockContext.Start(this.GetType()))
            {
                var resourceClient = SignalRTestUtilities.GetResourceManagementClient(context, handler);
                var signalrClient  = SignalRTestUtilities.GetSignalRManagementClient(context, handler);

                var location = SignalRTestUtilities.GetDefaultSignalRLocation(resourceClient);

                var usages = signalrClient.Usages.List(location);
                Assert.NotEmpty(usages);

                var usage = usages.First();
                Assert.NotNull(usage);
                Assert.NotEmpty(usage.Id);
                Assert.NotNull(usage.CurrentValue);
                Assert.NotNull(usage.Limit);
                Assert.NotNull(usage.Name);
                Assert.NotEmpty(usage.Name.Value);
                Assert.NotEmpty(usage.Name.LocalizedValue);
                Assert.NotEmpty(usage.Unit);
            }
        }
Example #2
0
        public void SignalRCheckNameTest()
        {
            var handler = new RecordedDelegatingHandler {
                StatusCodeToReturn = HttpStatusCode.OK
            };

            using (var context = MockContext.Start(this.GetType()))
            {
                var resourceClient = SignalRTestUtilities.GetResourceManagementClient(context, handler);
                var signalrClient  = SignalRTestUtilities.GetSignalRManagementClient(context, handler);

                // Create resource group
                var location      = SignalRTestUtilities.GetDefaultSignalRLocation(resourceClient);
                var resourceGroup = SignalRTestUtilities.CreateResourceGroup(resourceClient, location);

                // Check valid name
                var signalrName      = TestUtilities.GenerateName("signalr-service-test-0820");
                var checkNameRequest = signalrClient.SignalR.CheckNameAvailability(
                    location,
                    new NameAvailabilityParameters
                {
                    Type = SignalRTestUtilities.SignalRResourceType,
                    Name = signalrName
                });

                Assert.True(checkNameRequest.NameAvailable);
                Assert.Null(checkNameRequest.Reason);
                Assert.Null(checkNameRequest.Message);

                signalrName      = SignalRTestUtilities.CreateSignalR(signalrClient, resourceGroup.Name, location).Name;
                checkNameRequest = signalrClient.SignalR.CheckNameAvailability(
                    location,
                    new NameAvailabilityParameters
                {
                    Type = SignalRTestUtilities.SignalRResourceType,
                    Name = signalrName,
                });
                Assert.False(checkNameRequest.NameAvailable);
                Assert.Equal("AlreadyExists", checkNameRequest.Reason);
                Assert.Equal("The name is already taken. Please try a different name.", checkNameRequest.Message);
            }
        }
Example #3
0
        public void SignalRFreeTierToStandardTest()
        {
            var handler = new RecordedDelegatingHandler {
                StatusCodeToReturn = HttpStatusCode.OK
            };

            using (var context = MockContext.Start(this.GetType()))
            {
                var resourceClient = SignalRTestUtilities.GetResourceManagementClient(context, handler);
                var signalrClient  = SignalRTestUtilities.GetSignalRManagementClient(context, handler);

                var location      = SignalRTestUtilities.GetDefaultSignalRLocation(resourceClient);
                var resourceGroup = SignalRTestUtilities.CreateResourceGroup(resourceClient, location);

                var signalrName = TestUtilities.GenerateName("signalr-service-test-0820");

                var signalr = SignalRTestUtilities.CreateSignalR(signalrClient, resourceGroup.Name, location, isStandard: false);
                SignalRScenarioVerification(signalrClient, resourceGroup, signalr, false);
            }
        }
Example #4
0
        public void SignalRStandardTierToFreeTest()
        {
            var handler = new RecordedDelegatingHandler {
                StatusCodeToReturn = HttpStatusCode.OK
            };

            using (var context = MockContext.Start(typeof(SignalRTests).FullName))
            {
                var resourceClient = SignalRTestUtilities.GetResourceManagementClient(context, handler);
                var signalrClient  = SignalRTestUtilities.GetSignalRManagementClient(context, handler);

                var location      = SignalRTestUtilities.GetDefaultSignalRLocation(resourceClient);
                var resourceGroup = SignalRTestUtilities.CreateResourceGroup(resourceClient, location);

                var signalrName = TestUtilities.GenerateName("signalr-service-test");

                var capacity = 2;
                var signalr  = SignalRTestUtilities.CreateSignalR(signalrClient, resourceGroup.Name, location, isStandard: true, capacity: capacity);
                SignalRScenarioVerification(signalrClient, resourceGroup, signalr, true, capacity);
            }
        }