public async Task TestDriverConfigValuesPassedToDriverSucceeds()
        {
            // Arrange
            var testConfigProvider    = new TestConfigProvider();
            var testDriverConfigName  = "testDriverConfigName";
            var testDriverConfigValue = "testDriverConfigValue";

            var testConfig = new TextDisplayConfig()
            {
                DriverType     = "MockDisplayDriver.MockDisplayDriver",
                DriverAssembly = "MockDisplayDriver",
                Height         = 0,
                Width          = 0
            };

            testConfig.DriverConfigurationValues.Add(testDriverConfigName, testDriverConfigValue);
            (testConfigProvider.Configs as List <TextDisplayConfig>).Add(testConfig);

            List <ITextDisplay> returnedDisplays;

            // Act
            returnedDisplays = await TextDisplayManager.GetDisplaysForProvider(testConfigProvider) as List <ITextDisplay>;

            // Assert
            Assert.AreEqual(1, returnedDisplays.Count, "1 display should be returned");
            var mockDriver = returnedDisplays[0] as MockDisplayDriver.MockDisplayDriver;

            Assert.IsNotNull(mockDriver);
            Assert.AreEqual(mockDriver.Config.DriverConfigurationValues[testDriverConfigName], testDriverConfigValue);
        }
        public async Task TestWriteMessageToDriverSucceeds()
        {
            // Arrange
            var testConfigProvider = new TestConfigProvider();
            var testConfig         = new TextDisplayConfig()
            {
                DriverType     = "MockDisplayDriver.MockDisplayDriver",
                DriverAssembly = "MockDisplayDriver",
                Height         = 0,
                Width          = 0
            };

            (testConfigProvider.Configs as List <TextDisplayConfig>).Add(testConfig);

            var testMessage = "testMessage";

            List <ITextDisplay> returnedDisplays;

            // Act
            returnedDisplays = await TextDisplayManager.GetDisplaysForProvider(testConfigProvider) as List <ITextDisplay>;

            await returnedDisplays[0].WriteMessageAsync(testMessage, 0);

            // Assert
            Assert.AreEqual(1, returnedDisplays.Count, "1 display should be returned");
            var mockDriver = returnedDisplays[0] as MockDisplayDriver.MockDisplayDriver;

            Assert.IsNotNull(mockDriver, "Manager did not return mock driver");
            Assert.AreEqual(testMessage, mockDriver.LastMessage);
        }
        public async Task TestNoConfigsReturnsEmptyListSucceeds()
        {
            // Arrange
            var testConfigProvider = new TestConfigProvider();
            List <ITextDisplay> returnedDisplays;

            // Act
            returnedDisplays = await TextDisplayManager.GetDisplaysForProvider(testConfigProvider) as List <ITextDisplay>;

            // Assert
            Assert.AreEqual(0, returnedDisplays.Count, "No displays should be returned");
        }
        public async Task TestNonExistentBuiltInDriverTypeFails()
        {
            // Arrange
            var testConfigProvider = new TestConfigProvider();
            var testConfig         = new TextDisplayConfig()
            {
                DriverType = "NonExistentDriver",
                Height     = 0,
                Width      = 0
            };

            (testConfigProvider.Configs as List <TextDisplayConfig>).Add(testConfig);
            List <ITextDisplay> returnedDisplays;

            // Act
            returnedDisplays = await TextDisplayManager.GetDisplaysForProvider(testConfigProvider) as List <ITextDisplay>;

            // Assert
            Assert.AreEqual(0, returnedDisplays.Count, "No displays should be returned");
        }
        public async Task TestOneConfigReturnsOneDisplaySucceeds()
        {
            // Arrange
            var testConfigProvider = new TestConfigProvider();
            var testConfig         = new TextDisplayConfig()
            {
                DriverType     = "MockDisplayDriver.MockDisplayDriver",
                DriverAssembly = "MockDisplayDriver",
                Height         = 0,
                Width          = 0
            };

            (testConfigProvider.Configs as List <TextDisplayConfig>).Add(testConfig);
            List <ITextDisplay> returnedDisplays;

            // Act
            returnedDisplays = await TextDisplayManager.GetDisplaysForProvider(testConfigProvider) as List <ITextDisplay>;

            // Assert
            Assert.AreEqual(1, returnedDisplays.Count, "1 display should be returned");
        }