public void VerifySetNameAndShortName() { var prefixedUnit = new PrefixedUnit(Guid.NewGuid(), null, null); var vm = new PrefixedUnitDialogViewModel(prefixedUnit, this.transaction, this.session.Object, true, ThingDialogKind.Create, this.dialogService.Object, null); vm.SelectedPrefix = null; Assert.AreEqual(string.Empty, vm.Name); Assert.AreEqual(string.Empty, vm.ShortName); vm.SelectedPrefix = vm.PossiblePrefix.First(); Assert.AreEqual("centigram", vm.Name); Assert.AreEqual("cg", vm.ShortName); }
public void VerifyThatPropertiesAreSet() { var prefixedUnit = new PrefixedUnit(Guid.NewGuid(), null, null); var vm = new PrefixedUnitDialogViewModel(prefixedUnit, this.transaction, this.session.Object, true, ThingDialogKind.Create, this.dialogService.Object, null); Assert.AreEqual(this.genericSiteReferenceDataLibrary.Iid, vm.Container.Iid); Assert.IsNotNull(vm.SelectedPrefix); Assert.IsNotNull(vm.SelectedReferenceUnit); Assert.That(vm.ShortName, Is.Not.Null.Or.Not.Empty); Assert.That(vm.Name, Is.Not.Null.Or.Not.Empty); Assert.That(vm["ShortName"], Is.Empty.Or.Null); Assert.That(vm["Name"], Is.Empty.Or.Null); Assert.IsTrue(vm.OkCommand.CanExecute(null)); }