public void DeleteSubscriptionType_ShouldCleanCache_WhenNoError()
        {
            // Arrange
            var subscriptionType = new SubscriptionTypeBuilder().Build();

            mockDataService.Setup(ds => ds.DeleteSubscriptionType(subscriptionType.SubscriptionTypeId));
            mockCacheProvider.Setup(cp => cp.Remove(SubscriptionTypesCacheKey)).Verifiable();
            
            //Act
            subscriptionTypeController.DeleteSubscriptionType(subscriptionType);

            //Assert
            mockCacheProvider.Verify(cp => cp.Remove(SubscriptionTypesCacheKey), Times.Once());
        }
        public void DeleteSubscriptionType_ShouldCallDataService_WhenNoError()
        {
            // Arrange 
            var subscriptionType = new SubscriptionTypeBuilder().Build();

            mockDataService
                .Setup(ds => ds.DeleteSubscriptionType(subscriptionType.SubscriptionTypeId))
                .Verifiable();
            
            //Act
            subscriptionTypeController.DeleteSubscriptionType(subscriptionType);

            //Assert
            mockDataService.Verify(ds => ds.DeleteSubscriptionType(subscriptionType.SubscriptionTypeId), Times.Once());
        }
        public void AddSubscriptionType_ShouldCleanCache_WhenNoError()
        {
            // Arrange
            mockDataService.Setup(ds => ds.AddSubscriptionType(It.IsAny<string>(), It.IsAny<string>(), It.IsAny<int>()));
            mockCacheProvider.Setup(cp => cp.Remove(SubscriptionTypesCacheKey)).Verifiable();

            var subscriptionType = new SubscriptionTypeBuilder().Build();

            //Act
            subscriptionTypeController.AddSubscriptionType(subscriptionType);

            //Assert
            mockCacheProvider.Verify(cp => cp.Remove(SubscriptionTypesCacheKey), Times.Once());
        }
        public void DeleteSubscriptionType_ShouldThrowArgumentOutOfRangeException_WhenSubscriptionTypeIdIsNegative()
        {
            // Arrange
            var subscriptionType = new SubscriptionTypeBuilder()
                .WithSubscriptionTypeId(-1)
                .Build();

            // Act, Assert
            Assert.Throws<ArgumentOutOfRangeException>(() => subscriptionTypeController.DeleteSubscriptionType(subscriptionType));
        }
        public void AddSubscriptionType_ShouldFilledUpTheSubscriptionTypeIdPropertyOfTheInputSubscriptionTypeEntity_WhenNoError()
        {
            // Arrange
            const int expectedSubscriptionTypeId = 12;
            var subscriptionType = new SubscriptionTypeBuilder().Build();

            mockDataService
                .Setup(ds => ds.AddSubscriptionType(
                    subscriptionType.SubscriptionName, 
                    subscriptionType.FriendlyName, 
                    subscriptionType.DesktopModuleId))
                .Returns(expectedSubscriptionTypeId);

            //Act
            subscriptionTypeController.AddSubscriptionType(subscriptionType);

            //Assert
            Assert.AreEqual(expectedSubscriptionTypeId, subscriptionType.SubscriptionTypeId);
        }