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); }
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); }
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); }
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); }
/// <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; }
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"); }
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); }
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); }