public void RemoveArchivialProviderCommand_ThrowsIfProviderIsNotFound()
        {
            var mockedDb = new Mock <IClientDatabase>();

            string databaseSentProviderName = null;

            mockedDb.Setup(x => x.GetProvidersAsync(ProviderTypes.Any)).ReturnsAsync(
                new ProviderCollection()
            {
                new Provider()
                {
                    Name = "Azure"
                }
            }
                );

            mockedDb.Setup(x => x.RemoveProviderAsync(It.IsAny <string>()))
            .Returns(Task.CompletedTask)
            .Callback <string>(x => databaseSentProviderName = x);

            var mockedCoreSettings = new Mock <ICoreSettings>();

            var depedencies = new CmdletDependencies()
            {
                ClientDatabase = mockedDb.Object,
                CoreSettings   = mockedCoreSettings.Object
            };

            var command = new RemoveArchivialProviderCommand(depedencies)
            {
                ProviderName = "AWS"
            };

            var result = command.Invoke().GetEnumerator().MoveNext();
        }
        public void RemoveArchivialProviderCommand_CanRemoveSource_FromSourceObject()
        {
            var mockedDb = new Mock <IClientDatabase>();

            string databaseSentProviderName = null;

            mockedDb.Setup(x => x.GetProvidersAsync(ProviderTypes.Any)).ReturnsAsync(
                new ProviderCollection()
            {
                new Provider()
                {
                    Name = "Azure"
                }
            }
                );

            mockedDb.Setup(x => x.RemoveProviderAsync(It.IsAny <string>()))
            .Returns(Task.CompletedTask)
            .Callback <string>(x => databaseSentProviderName = x);

            var mockedCoreSettings = new Mock <ICoreSettings>();

            var depedencies = new CmdletDependencies()
            {
                ClientDatabase = mockedDb.Object,
                CoreSettings   = mockedCoreSettings.Object
            };

            var command = new RemoveArchivialProviderCommand(depedencies)
            {
                Provider = new Provider()
                {
                    Name = "Azure"
                }
            };

            var result = command.Invoke().GetEnumerator().MoveNext();

            mockedDb.Verify(x => x.RemoveProviderAsync(It.IsAny <string>()), Times.Once);
            mockedDb.Verify(x => x.RemoveApplicationOptionAsync(It.IsAny <string>()), Times.Exactly(2));

            Assert.IsNotNull(databaseSentProviderName);
            Assert.AreEqual("Azure", databaseSentProviderName);
        }