Commits

Christian Specht committed f0eef73 Draft

more CommandCenterService tests

Comments (0)

Files changed (1)

src/MissileSharp.Tests/Launcher/CommandCenterServiceTests.cs

-using MissileSharp.Launcher.Services;
+using System;
+using MissileSharp.Launcher.Services;
 using Moq;
 using NUnit.Framework;
 
             this.commandcenterservice = new CommandCenterService(this.appconfigservice.Object);
         }
 
+        public ICommandCenterService SetupCommandCenterService()
+        {
+            return new CommandCenterService(this.appconfigservice.Object);
+        }
+
         [Test]
         public void GetCommandCenter_ValidLauncher_ReturnsCommandCenter()
         {
-            var commandCenter = this.commandcenterservice.GetCommandCenter();
+            var commandCenter = SetupCommandCenterService().GetCommandCenter();
             Assert.True(commandCenter is CommandCenter);
         }
+
+        [Test]
+        public void GetCommandCenter_InvalidLauncher_Throws()
+        {
+            this.appconfigservice.Setup(stub => stub.LauncherName).Returns("MissileSharp.Tests.InvalidLauncher");
+            Assert.Catch<Exception>(() => SetupCommandCenterService().GetCommandCenter());
+        }
+
+        [Test]
+        public void GetCommandCenter_EmptyLauncher_Throws()
+        {
+            this.appconfigservice.Setup(stub => stub.LauncherName).Returns((string)null);
+            this.appconfigservice.Setup(stub => stub.LauncherAssembly).Returns((string)null);
+
+            Assert.Catch<Exception>(() => SetupCommandCenterService().GetCommandCenter());
+        }
     }
 }