Skip to content

Commit

Permalink
add test
Browse files Browse the repository at this point in the history
  • Loading branch information
vladimir-nikonov committed Sep 26, 2024
1 parent 03fcfe6 commit 00c70ca
Show file tree
Hide file tree
Showing 2 changed files with 45 additions and 0 deletions.
33 changes: 33 additions & 0 deletions clio.tests/Command/K8SCommandTests.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
using Autofac;
using Clio.Common.K8;
using FluentAssertions;
using k8s;
using k8s.Exceptions;
using NSubstitute;
using NUnit.Framework;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Clio.Tests.Command
{
[TestFixture]
internal class K8SCommandTests: BaseClioModuleTests
{
override protected void AdditionalRegistrations(ContainerBuilder containerBuilder) {
base.AdditionalRegistrations(containerBuilder);
containerBuilder.Register<Kubernetes>(provider => {
throw new KubernetesException("Kubernetes cannot be recognized.");
}).As<IKubernetes>();
}

[Test]
public void CreateK8SCommand_shouldthrowexception_ifKubernetesCannotBeRecognized() {
Action act = () => Container.Resolve<k8Commands>();
act.Should().Throw<Exception>().WithInnerException<KubernetesException>()
.Which.Message.Should().BeEquivalentTo("Kubernetes cannot be recognized.");
}
}
}
12 changes: 12 additions & 0 deletions clio/K8CommandsTests.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Clio
{
internal class K8CommandsTests
{
}
}

0 comments on commit 00c70ca

Please sign in to comment.