public void GetAuthenticationToken_InvalidToken_CallsApiGetToken()
        {
            // Arrange
            var scrobbler = new ScrobblerUnderTest("testApiKey", "testApiSecret");

            scrobbler.AuthenticationTokenUnderTest = new AuthenticationTokenUnderTest("testToken1", DateTime.Now.AddMinutes(-AuthenticationToken.ValidForMinutes * 2));

            // Act
            scrobbler.GetAuthenticationTokenUnderTest();

            // Assert
            scrobbler.AuthApiMock.Verify(api => api.GetToken(It.IsAny <Authentication>()), Times.Once());
        }
        public void GetAuthenticationToken_NullToken_CallsApiGetToken()
        {
            // Arrange
            var scrobbler = new ScrobblerUnderTest("testApiKey", "testApiSecret");

            scrobbler.AuthenticationTokenUnderTest = null;

            // Act
            scrobbler.GetAuthenticationTokenUnderTest();

            // Assert
            scrobbler.AuthApiMock.Verify(api => api.GetToken(It.IsAny <Authentication>()), Times.Once());
        }
        public void GetAuthenticationToken_ValidToken_DoesNotCallApiGetToken()
        {
            // Arrange
            var scrobbler = new ScrobblerUnderTest("testApiKey", "testApiSecret");

            scrobbler.AuthenticationTokenUnderTest = new AuthenticationToken("testToken1");

            // Act
            scrobbler.GetAuthenticationTokenUnderTest();

            // Assert
            scrobbler.AuthApiMock.Verify(api => api.GetToken(It.IsAny <Authentication>()), Times.Never());
        }
        public void GetAuthenticationToken_InvalidToken_CallsApiGetToken()
        {
            // Arrange
            var scrobbler = new ScrobblerUnderTest("testApiKey", "testApiSecret");
            scrobbler.AuthenticationTokenUnderTest = new AuthenticationTokenUnderTest("testToken1", DateTime.Now.AddMinutes(-AuthenticationToken.ValidForMinutes * 2));

            // Act
            scrobbler.GetAuthenticationTokenUnderTest();

            // Assert
            scrobbler.AuthApiMock.Verify(api => api.GetToken(It.IsAny<Authentication>()), Times.Once());

        }
        public void GetAuthenticationToken_NullToken_CallsApiGetToken()
        {
            // Arrange
            var scrobbler = new ScrobblerUnderTest("testApiKey", "testApiSecret");
            scrobbler.AuthenticationTokenUnderTest = null;

            // Act
            scrobbler.GetAuthenticationTokenUnderTest();

            // Assert
            scrobbler.AuthApiMock.Verify(api => api.GetToken(It.IsAny<Authentication>()), Times.Once());

        }
        public void GetAuthenticationToken_ValidToken_DoesNotCallApiGetToken()
        {
            // Arrange
            var scrobbler = new ScrobblerUnderTest("testApiKey", "testApiSecret");
            scrobbler.AuthenticationTokenUnderTest = new AuthenticationToken("testToken1");

            // Act
            scrobbler.GetAuthenticationTokenUnderTest();

            // Assert
            scrobbler.AuthApiMock.Verify(api => api.GetToken(It.IsAny<Authentication>()), Times.Never());

        }