public static void GetSessionsAsync_Throws_If_BuildId_Is_Null()
        {
            // Arrange
            BrowserStackAutomateClient target = CreateClient();

            string buildId = null;

            // Act and Assert
            target
            .Awaiting((p) => p.GetSessionsAsync(buildId))
            .ShouldThrow <ArgumentException>()
            .And
            .ParamName.Should().Be("buildId");
        }
        public static void DeleteProjectAsync_Throws_If_ProjectId_Is_Not_Found()
        {
            // Arrange
            BrowserStackAutomateClient target = CreateAuthenticatedClient();

            int projectId = 0;

            // Act and Assert
            target
            .Awaiting((p) => p.DeleteProjectAsync(projectId))
            .ShouldThrow <BrowserStackAutomateException>()
            .And
            .ErrorDetail.Should().NotBeNull();
        }
        public static void GetSessionAsync_Throws_If_SessionId_Is_Not_Found()
        {
            // Arrange
            BrowserStackAutomateClient target = CreateAuthenticatedClient();

            string sessionId = Guid.NewGuid().ToString();

            // Act and Assert
            target
            .Awaiting((p) => p.GetSessionAsync(sessionId))
            .ShouldThrow <BrowserStackAutomateException>()
            .And
            .ErrorDetail.Should().NotBeNull();
        }
Ejemplo n.º 4
0
        public static void DeleteSessionsAsync_Throws_If_SessionIds_Is_Empty()
        {
            // Arrange
            BrowserStackAutomateClient target = CreateClient();

            var sessionIds = Array.Empty <string>();

            // Act and Assert
            target
            .Awaiting((p) => p.DeleteSessionsAsync(sessionIds))
            .Should()
            .Throw <ArgumentException>()
            .And
            .ParamName.Should().Be("sessionIds");
        }
Ejemplo n.º 5
0
        public static void DeleteSessionsAsync_Throws_If_SessionIds_Is_Null()
        {
            // Arrange
            BrowserStackAutomateClient target = CreateClient();

            ICollection <string> sessionIds = null;

            // Act and Assert
            target
            .Awaiting((p) => p.DeleteSessionsAsync(sessionIds))
            .Should()
            .Throw <ArgumentNullException>()
            .And
            .ParamName.Should().Be("sessionIds");
        }
        public static void SetSessionStatusAsync_Throws_If_Status_Is_Null()
        {
            // Arrange
            BrowserStackAutomateClient target = CreateClient();

            string sessionId = "x";
            string status    = null;
            string reason    = null;

            // Act and Assert
            target
            .Awaiting((p) => p.SetSessionStatusAsync(sessionId, status, reason))
            .ShouldThrow <ArgumentException>()
            .And
            .ParamName.Should().Be("status");
        }
Ejemplo n.º 7
0
        public static void SetSessionNameAsync_Throws_If_Name_Is_Null()
        {
            // Arrange
            BrowserStackAutomateClient target = CreateClient();

            string sessionId = "x";
            string name      = null;

            // Act and Assert
            target
            .Awaiting((p) => p.SetSessionNameAsync(sessionId, name))
            .Should()
            .Throw <ArgumentException>()
            .And
            .ParamName.Should().Be("name");
        }
Ejemplo n.º 8
0
        public static void GetSessionAppiumLogsAsync_Throws_If_SessionId_Is_Null()
        {
            // Arrange
            BrowserStackAutomateClient target = CreateClient();

            string buildId   = Guid.NewGuid().ToString();
            string sessionId = null;

            // Act and Assert
            target
            .Awaiting((p) => p.GetSessionLogsAsync(buildId, sessionId))
            .Should()
            .Throw <ArgumentException>()
            .And
            .ParamName.Should().Be("sessionId");
        }
        public static void SetSessionErrorAsync_Throws_If_Client_Is_Null()
        {
            // Arrange
            BrowserStackAutomateClient client = null;

            string sessionId = "MySessionId";
            string reason    = "My reason";

            // Act and Assert
            client
            .Awaiting((p) => p.SetSessionErrorAsync(sessionId, reason))
            .ShouldThrow <ArgumentNullException>()
            .And
            .ParamName
            .Should()
            .Be("client");
        }
        public static async Task Can_Delete_Session()
        {
            // Arrange
            BrowserStackAutomateClient target = CreateAuthenticatedClient();

            string sessionId = "CHANGE_ME";

            // Act
            await target.DeleteSessionAsync(sessionId);

            // Assert
            target
            .Awaiting((p) => p.DeleteSessionAsync(sessionId))
            .ShouldThrow <BrowserStackAutomateException>()
            .And
            .ErrorDetail.Should().NotBeNull();
        }
        public static async Task Can_Delete_Project()
        {
            // Arrange
            BrowserStackAutomateClient target = CreateAuthenticatedClient();

            int projectId = 0;

            // Act
            await target.DeleteProjectAsync(projectId);

            // Assert
            target
            .Awaiting((p) => p.DeleteProjectAsync(projectId))
            .ShouldThrow <BrowserStackAutomateException>()
            .And
            .ErrorDetail.Should().NotBeNull();
        }
        public static void GetBuildsAsync_Throws_If_Limit_Is_Less_Than_One()
        {
            // Arrange
            BrowserStackAutomateClient target = CreateClient();

            int?   limit  = 0;
            string status = null;

            // Act and Assert
            target
            .Awaiting((p) => p.GetBuildsAsync(limit, status))
            .ShouldThrow <ArgumentOutOfRangeException>()
            .Where((p) => p.ParamName == "limit")
            .Where((p) => p.Message.StartsWith("The limit value cannot be less than one."))
            .And
            .ActualValue.Should().Be(0);
        }
Ejemplo n.º 13
0
        public static void GetBuildsAsync_Throws_If_Offset_Is_Less_Than_Zero()
        {
            // Arrange
            BrowserStackAutomateClient target = CreateClient();

            int?   limit  = 1;
            int?   offset = -1;
            string status = null;

            // Act and Assert
            target
            .Awaiting((p) => p.GetBuildsAsync(limit, offset, status))
            .Should()
            .Throw <ArgumentOutOfRangeException>()
            .Where((p) => p.ParamName == "offset")
            .Where((p) => p.Message.StartsWith("The offset value cannot be less than zero.", StringComparison.Ordinal))
            .And
            .ActualValue.Should().Be(-1);
        }