Exemple #1
0
        public void Model_FinishSetup_RaisesEvent_CorrectCallOrder__RandomValues()
        {
            string actualBoxUrl   = null;
            string actualPassword = null;
            string actualUsername = null;
            var    dependencies   = new ModelDependencies {
                Config = new ConfigMock()
            };
            var target = new Model(dependencies);

            target.SetupFinished += (s, e) =>
            {
                actualBoxUrl   = dependencies.Config.BoxUrlAsString;
                actualPassword = dependencies.Config.Password;
                actualUsername = dependencies.Config.Username;
            };

            target.FinishSetup(XeRandom.CreateString(),
                               XeRandom.CreateString(),
                               XeRandom.CreateString());

            Assert.IsNotNull(actualBoxUrl);
            Assert.IsNotNull(actualPassword);
            Assert.IsNotNull(actualUsername);
        }
Exemple #2
0
        private static Model CreateTargetWithMockedDependencies(ILoginRecognizer loginRecognizerMock)
        {
            var dependencies = new ModelDependencies
            {
                Config          = new ConfigMock(),
                LoginRecognizer = loginRecognizerMock
            };
            var target = new Model(dependencies);

            return(target);
        }
Exemple #3
0
        public void Model_FinishSetup_RaisesEvent()
        {
            var wasCalled    = false;
            var dependencies = new ModelDependencies {
                Config = new ConfigMock()
            };
            var target = new Model(dependencies);

            target.SetupFinished += (s, e) => wasCalled = true;

            target.FinishSetup("irrelevant", "irrelevant", "irrelevant");

            Assert.IsTrue(wasCalled);
        }
Exemple #4
0
        public void Model_FinishSetup_ParameterPassthrough__RandomValues()
        {
            var     expectedBoxUrl   = XeRandom.CreateString();
            var     expectedUsername = XeRandom.CreateString();
            var     expectedPassword = XeRandom.CreateString();
            IConfig configMock       = new ConfigMock();
            var     dependencies     = new ModelDependencies {
                Config = configMock
            };
            var target = new Model(dependencies);

            target.FinishSetup(expectedBoxUrl, expectedUsername, expectedPassword);

            Assert.AreEqual(expectedBoxUrl, configMock.BoxUrlAsString);
            Assert.AreEqual(expectedPassword, configMock.Password);
            Assert.AreEqual(expectedUsername, configMock.Username);
        }
Exemple #5
0
 public Model(ModelDependencies dependencies)
 {
     this._dependencies = dependencies;
 }