Commits

Christian Specht committed 092b6f8 Draft

replace all stubs in launcher tests

  • Participants
  • Parent commits d160a51

Comments (0)

Files changed (5)

File src/MissileSharp.Tests/Launcher/MainWindowViewModelTests.cs

     public class MainWindowViewModelTests
     {
         private Mock<IShutdownService> shutdownservice;
-        private ICommandCenterService commandcenterservice;
+        private Mock<ICommandCenterService> commandcenterservice;
         private Mock<ICommandCenter> commandcenter;
         
         [SetUp]
         public void Setup()
         {
-            this.commandcenterservice = new StubCommandCenterService();
+            this.commandcenterservice = new Mock<ICommandCenterService>();            
 
             this.shutdownservice = new Mock<IShutdownService>();
 
         {
             if (commandCenterService == null)
             {
-                commandCenterService = this.commandcenterservice;
-                ((StubCommandCenterService)this.commandcenterservice).CommandCenter = this.commandcenter.Object;
+                this.commandcenterservice.Setup(stub => stub.GetCommandCenter()).Returns(this.commandcenter.Object);
+                commandCenterService = this.commandcenterservice.Object;
             }
 
             if (configService == null)
             {
-                configService = new StubConfigService();
+                configService = new Mock<IConfigService>().Object;
             }
 
             if (messageService == null)
             {
-                messageService = new StubMessageService();
+                messageService = new Mock<IMessageService>().Object;
             }
 
             if (shutdownService == null)

File src/MissileSharp.Tests/Launcher/StubCommandCenterService.cs

-using MissileSharp.Launcher.Services;
-
-namespace MissileSharp.Tests.Launcher
-{
-    public class StubCommandCenterService : ICommandCenterService
-    {
-        /// <summary>
-        /// set the command center that is returned
-        /// </summary>
-        public ICommandCenter CommandCenter { private get; set; }
-
-        public ICommandCenter GetCommandCenter()
-        {
-            return this.CommandCenter;
-        }
-    }
-}

File src/MissileSharp.Tests/Launcher/StubConfigService.cs

-using MissileSharp.Launcher.Services;
-
-namespace MissileSharp.Tests.Launcher
-{
-    /// <summary>
-    /// stub config service for testing
-    /// (the config data that is returned can be set before)
-    /// </summary>
-    public class StubConfigService : IConfigService
-    {
-        private string[] config;
-
-        /// <summary>
-        /// save the data that will be returned by GetConfig
-        /// </summary>
-        /// <param name="config">string[] with config data</param>
-        public void SetConfig(string[] config)
-        {
-            this.config = config;
-        }
-
-        public string[] GetConfig()
-        {
-            return this.config;
-        }
-    }
-}

File src/MissileSharp.Tests/Launcher/StubMessageService.cs

-using MissileSharp.Launcher.Services;
-
-namespace MissileSharp.Tests.Launcher
-{
-    public class StubMessageService : IMessageService
-    {
-        public void ShowMessage(string messageText)
-        {
-        }
-    }
-}

File src/MissileSharp.Tests/MissileSharp.Tests.csproj

     <Compile Include="..\MissileSharp\AssemblyVersion.cs">
       <Link>AssemblyVersion.cs</Link>
     </Compile>
-    <Compile Include="Launcher\StubCommandCenterService.cs" />
-    <Compile Include="Launcher\StubConfigService.cs" />
-    <Compile Include="Launcher\StubMessageService.cs" />
     <Compile Include="Library\CommandCenterTests.cs" />
     <Compile Include="Library\ConfigReaderTests.cs" />
     <Compile Include="Library\CommandSetListTests.cs">