public void ViewModel_GetModelTestCase() { CreateObjectViewModel firstViewModel = null; Given("Create view-model", frame => firstViewModel = ViewModelBase.CreateViewModel <CreateObjectViewModel>(frame)) .When("Get model", _ => firstViewModel.GetModel <CreateObjectModel>()) .Then("Cheking view-models", model => { firstViewModel.NotNull() .CheckCreateObject(3); Assert.IsNotNull(model, "model can not be null"); }) .RunWindow(Timeuots.Second.Five); }
public void ViewModel_BindModelTestCase() { CreateObjectViewModel viewModel = null; CreateObjectModel result = new CreateObjectModel(); Given("Create view-model", frame => viewModel = ViewModelBase.CreateViewModel <CreateObjectViewModel>(frame)) .When("Bind model", _ => { viewModel.BindModel(result); }) .Then("Cheking models", _ => { viewModel.NotNull().CheckCreateObject(2); Assert.AreEqual(viewModel.ModelOptions, result.ModelOptions, "options must match"); }) .RunWindow(Timeuots.Second.Five); }
public void ViewModel_GetViewModelSomeTypeTestCase() { CreateObjectViewModel firstViewModel = null; Given("Create view-model", frame => firstViewModel = ViewModelBase.CreateViewModel <CreateObjectViewModel>(frame)) .When("Get seccond view-model", _ => firstViewModel.GetViewModel <CreateObjectViewModel>()) .Then("Cheking view-models", secondViewModel => { firstViewModel.NotNull() .CheckCreateObject(3); secondViewModel.NotNull() .CheckCreateObject(0); Assert.AreNotEqual(firstViewModel, secondViewModel, "must be different objects"); TestHelper.CheckBindViewModel(firstViewModel, secondViewModel); }) .RunWindow(Timeuots.Second.Five); }
public void Model_GetModelSameTypeTestCase() { CreateObjectViewModel firstViewModel = null; CreateObjectModel firstModel = null; CreateObjectModel secondModel = null; Given("Create view-model", frame => firstViewModel = ViewModelBase.CreateViewModel <CreateObjectViewModel>(frame)) .When("Get models", _ => { firstModel = firstViewModel.GetModel <CreateObjectModel>(); secondModel = firstModel.GetModel <CreateObjectModel>(); }) .Then("Cheking models", _ => { firstViewModel.NotNull().CheckCreateObject(4); Assert.AreNotEqual(firstModel, secondModel, "must be different objects"); }) .RunWindow(Timeuots.Second.Five); }
public void Model_GetModelTestCase() { CreateObjectViewModel firstViewModel = null; CreateObjectModel firstModel = null; TestModel secondModel = null; Given("Create view-model", frame => firstViewModel = ViewModelBase.CreateViewModel <CreateObjectViewModel>(frame)) .When("Get models", _ => { firstModel = firstViewModel.GetModel <CreateObjectModel>(); secondModel = firstModel.GetModel <TestModel>(); }) .Then("Cheking models", _ => { firstViewModel.NotNull().CheckCreateObject(4); Assert.IsNotNull(firstModel, "first model can not be null"); Assert.IsNotNull(secondModel, "first model can not be null"); Assert.AreEqual(1, firstModel.GetModelCallCounter, $"method '{nameof(ModelBase.GetModel)}' should be called 1 times"); }) .RunWindow(Timeuots.Second.Five); }