Inheritance: Caliburn.Micro.Screen
        public void ShouldDisableGenereateIfNoSwitchesAreOn()
        {
            var vm = new PasswordGeneratorViewModel(null, null);

            bool canGenerate = vm.CanGenerate;

            Assert.IsFalse(canGenerate);
        }
        public void ShouldEnabledGenerateIfASwitchIsOn()
        {
            var vm = new PasswordGeneratorViewModel(null, null);
            vm.BracketSwitch = true;
            bool canGenerate = vm.CanGenerate;

            Assert.IsTrue(canGenerate);
        }
 public void ShouldHaveOneOnSwitch()
 {
     var vm = new PasswordGeneratorViewModel(null,null);
     vm.UppercaseSwitch = true;
     var onSwitches = vm.OnSwitches();
     Assert.AreEqual(1, onSwitches.Count());
     Assert.AreEqual("UppercaseSwitch", onSwitches.First().Name);
 }
        public void ShouldCallEventAggregator()
        {
            var mockEventAggregator = new MockEventAggregator();
            var vm = new PasswordGeneratorViewModel(null, mockEventAggregator);
            string password = "******";
            vm.SendMessageToEntryEditScreen(password);

            var message = mockEventAggregator.Message as PasswordGenerateMessage;
            Assert.AreEqual(password, message.GeneratedPassword);
        }
        public void ShouldMapUppercaseSwitchToCharacterset()
        {
            var vm = new PasswordGeneratorViewModel(null, null);
            vm.UppercaseSwitch = true;
             var onSwitches = vm.OnSwitches();
             var charSets = vm.MapSwitchesToCharacterSets(onSwitches);

             Assert.AreEqual(1, charSets.Count());
             Assert.AreEqual(PasswordGeneratorCharacterSets.Uppercase, charSets.First());
        }
        public async Task ShouldCalledGeneratePassword()
        {
            var pwGen =new MockPasswordGenerator();
            var vm = new PasswordGeneratorViewModel(pwGen, null);
            vm.Length = 30;
            vm.UppercaseSwitch = true;
            var onSwitches = vm.OnSwitches();
            var charSets = vm.MapSwitchesToCharacterSets(onSwitches);

            var p = await vm.GeneratePassword(charSets);

            Assert.AreEqual(vm.Length, pwGen.Length);
            CollectionAssert.AreEqual(charSets, pwGen.CharacterSet);
        }
 public void ShouldNotHaveAnySwitchesOn()
 {
     var vm = new PasswordGeneratorViewModel(null,null);
     var onSwitches = vm.OnSwitches();
     Assert.AreEqual(0, onSwitches.Count());
 }