public async Task VerifyThatOkCommandWorksWhenRoot() { var vm = new DomainOfExpertiseDialogViewModel(this.domain, this.transaction, this.session.Object, true, ThingDialogKind.Create, this.navigation.Object, this.clone); vm.OkCommand.Execute(null); this.session.Verify(x => x.Write(It.IsAny <OperationContainer>())); Assert.IsTrue(vm.DialogResult.Value); }
public async Task VerifyThatOkCommandCatchesException() { var vm = new DomainOfExpertiseDialogViewModel(this.domain, this.transaction, this.session.Object, true, ThingDialogKind.Create, this.navigation.Object, this.clone); this.session.Setup(x => x.Write(It.IsAny <OperationContainer>())).Throws(new Exception("test")); vm.OkCommand.Execute(null); Assert.IsNotNull(vm.WriteException); Assert.IsNull(vm.DialogResult); }
public void VerifyThatPropertiesAreSet() { this.domain.Name = "test"; this.domain.ShortName = "test"; var vm = new DomainOfExpertiseDialogViewModel(this.domain, this.transaction, this.session.Object, true, ThingDialogKind.Create, this.navigation.Object, this.clone); Assert.AreEqual(this.domain.Name, vm.Name); Assert.AreEqual(this.domain.ShortName, vm.ShortName); Assert.AreEqual(this.domain.IsDeprecated, vm.IsDeprecated); }
public async Task VerifyThatOkCommandWorksWhenNotRoot() { var vm = new DomainOfExpertiseDialogViewModel(this.domain, this.transaction, this.session.Object, false, ThingDialogKind.Create, this.navigation.Object, this.clone); vm.Name = "test"; vm.ShortName = "t"; vm.OkCommand.Execute(null); this.session.Verify(x => x.Write(It.IsAny <OperationContainer>()), Times.Never()); var clone = (DomainOfExpertise)this.transaction.AddedThing.Single(); Assert.AreEqual(vm.Name, clone.Name); Assert.AreEqual(vm.ShortName, clone.ShortName); Assert.AreEqual(vm.IsDeprecated, clone.IsDeprecated); }
public void VerifyThatDefaultConstructorDoesNotThrowException() { var domainOfExpertiseDialogViewModel = new DomainOfExpertiseDialogViewModel(); Assert.IsNotNull(domainOfExpertiseDialogViewModel); }