public async Task GetSettings_NoPullDogSettingsFound_IsInstalledIsFalseAndValuesAreNull()
        {
            //Arrange
            var fakeMediator = Substitute.For <IMediator>();

            fakeMediator
            .Send(Arg.Any <EnsureUserForIdentityCommand>())
            .Returns(new User());

            var fakeMapper = Substitute.For <IMapper>();
            var fakeAesEncryptionHelper = Substitute.For <IAesEncryptionHelper>();

            var controller = new PullDogApiController(
                fakeMediator,
                fakeMapper,
                fakeAesEncryptionHelper);

            controller.FakeAuthentication("some-identity-name");

            //Act
            var result = await controller.GetSettings() as OkObjectResult;

            //Assert
            Assert.IsNotNull(result);

            var response = result.ToObject <SettingsResponse>();

            Assert.IsNull(response.PoolSize);
            Assert.IsNull(response.PlanId);
            Assert.IsNull(response.ApiKey);
            Assert.IsFalse(response.IsInstalled);
        }
        public async Task GetSettings_PullDogSettingsFound_IsInstalledIsTrueAndValuesAreSet()
        {
            //Arrange
            var fakeMediator = Substitute.For <IMediator>();

            fakeMediator
            .Send(Arg.Any <EnsureUserForIdentityCommand>())
            .Returns(new User()
            {
                PullDogSettings = new PullDogSettings()
                {
                    PoolSize        = 1337,
                    PlanId          = "some-plan-id",
                    EncryptedApiKey = new byte[] { 1 }
                }
            });

            var fakeMapper = Substitute.For <IMapper>();

            var fakeAesEncryptionHelper = Substitute.For <IAesEncryptionHelper>();

            fakeAesEncryptionHelper
            .DecryptAsync(Arg.Is <byte[]>(args => args.Single() == 1))
            .Returns("some-api-key");

            var controller = new PullDogApiController(
                fakeMediator,
                fakeMapper,
                fakeAesEncryptionHelper);

            controller.FakeAuthentication("some-identity-name");

            //Act
            var result = await controller.GetSettings() as OkObjectResult;

            //Assert
            Assert.IsNotNull(result);

            var response = result.ToObject <SettingsResponse>();

            Assert.IsTrue(response.IsInstalled);
            Assert.AreEqual(1337, response.PoolSize);
            Assert.AreEqual("some-plan-id", response.PlanId);
            Assert.AreEqual("some-api-key", response.ApiKey);
        }