コード例 #1
0
        public void PropertiesTests()
        {
            var cut = new MoveStateOptionsWizardPage();
            TestsHelper.TestPublicDeclaredPropertiesGetSet(cut, true);

            var newStateInfo = Mock.Create<MoveStateOptionsWizardPage.NewStateInfo>();
            cut.SelectedState = newStateInfo;
            Assert.AreSame(newStateInfo, cut.SelectedState);
        }
コード例 #2
0
        public void SelectedItemsMessage_WhenDtoIsNull_ReturnsFalse()
        {
            //Arrange
            var cut = new MoveStateOptionsWizardPage();
            var wizardManagerViewModel = Mock.Create<IWizardManagerViewModel>();
            Mock.Arrange(() => wizardManagerViewModel.Parameter).Returns((object)null);
            cut.WizardManager = wizardManagerViewModel;

            //Assert
            Assert.IsTrue(cut.SelectedItemsMessage == string.Empty);
        }
コード例 #3
0
        public void SupportsStates_WhenDtoIsNull_ReturnsFalse()
        {
            //Arrange
            var cut = new MoveStateOptionsWizardPage();
            var wizardManagerViewModel = Mock.Create<IWizardManagerViewModel>();
            Mock.Arrange(() => wizardManagerViewModel.Parameter).Returns((object)null);
            cut.WizardManager = wizardManagerViewModel;

            //Assert
            Assert.IsFalse(cut.SupportsStates);
        }
コード例 #4
0
        public void IsApprovable_WhenDtoIsApprovable_ReturnsTrue()
        {
            //Arrange
            var cut = new MoveStateOptionsWizardPage();
            var wizardManagerViewModel = Mock.Create<IWizardManagerViewModel>();
            var approvable = Mock.Create<BulkOperationDto>();
            var value = Mock.Create<Type>();
            Mock.Arrange(() => value.GetInterface(Arg.AnyString, Arg.AnyBool)).Returns(typeof(ISupportStates));
            Mock.Arrange(() => approvable.ItemType).Returns(value);
            Mock.Arrange(() => wizardManagerViewModel.Parameter).Returns(approvable);
            cut.WizardManager = wizardManagerViewModel;

            //Assert
            Assert.IsTrue(cut.SupportsStates);
        }
コード例 #5
0
 /// <summary>
 /// Initializes a new instance of the <see cref="NewStateInfo"/> class.
 /// </summary>
 /// <param name="name">The state name.</param>
 /// <param name="documentation">The state documentation.</param>
 /// <param name="affectedItems">The affected state ids.</param>
 /// <param name="parent">The parent.</param>
 public NewStateInfo(string name, string documentation, ReadOnlyCollection<int> affectedItems, MoveStateOptionsWizardPage parent)
 {
     Name = name;
     Documentation = documentation;
     AffectedItems = affectedItems;
     Parent = parent;
 }
コード例 #6
0
        public void SelectedItemsMessage_WhenDtoNotSupportStates_ReturnsFalse()
        {
            //Arrange
            var cut = new MoveStateOptionsWizardPage();
            var wizardManagerViewModel = Mock.Create<IWizardManagerViewModel>();
            var dto = Mock.Create<BulkOperationDto>();
            var value = Mock.Create<Type>();
            Mock.Arrange(() => value.GetInterface(Arg.AnyString, Arg.AnyBool)).Returns((Type)null);
            Mock.Arrange(() => dto.Count).Returns(11);
            Mock.Arrange(() => wizardManagerViewModel.Parameter).Returns(dto);
            cut.WizardManager = wizardManagerViewModel;
            Mock.Arrange(() => LanguageService.Translate("Msg_BulkItemsSelected")).Returns("{0}");

            //Assert

            Assert.IsTrue(cut.SelectedItemsMessage == "11");
        }
コード例 #7
0
        public void Reset_WhenCalled_ResetsSelectedState()
        {
            //Arrange
            var wizardManagerViewModel = Mock.Create<IWizardManagerViewModel>();
            var cut = new MoveStateOptionsWizardPage
            {
                WizardManager = wizardManagerViewModel,
                SelectedState = Mock.Create<MoveStateOptionsWizardPage.NewStateInfo>()
            };

            //Act
            cut.Reset();

            //Assert
            Assert.IsNull(cut.SelectedState);
        }
コード例 #8
0
        public void Reset_WhenCalled_ResetsAvailableStates()
        {
            //Arrange
            var cut = new MoveStateOptionsWizardPage();
            cut.AvailableStates = Mock.Create<ObservableCollection<MoveStateOptionsWizardPage.NewStateInfo>>();

            //Act
            cut.Reset();

            //Assert
            Assert.IsNull(cut.AvailableStates);
        }