本文整理汇总了C#中TestModel类的典型用法代码示例。如果您正苦于以下问题:C# TestModel类的具体用法?C# TestModel怎么用?C# TestModel使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
TestModel类属于命名空间,在下文中一共展示了TestModel类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。
示例1: EndTest
public TestModel EndTest(ITestEvaluator evaluator)
{
_currentTest.Assessments.Add(evaluator.Name, evaluator.Assess(_currentTest));
TestModel test = _currentTest;
_currentTest = null;
return test;
}
开发者ID:LukeForder,项目名称:TestIt,代码行数:7,代码来源:UserModel.cs
示例2: ValueHelpersWithErrorsGetValueFromModelState
public void ValueHelpersWithErrorsGetValueFromModelState()
{
// Arrange
var model = new TestModel()
{
StringProperty = "ModelStringPropertyValue",
ObjectProperty = "ModelObjectPropertyValue",
};
var helper = DefaultTemplatesUtilities.GetHtmlHelper<TestModel>(model);
var viewData = helper.ViewData;
viewData["StringProperty"] = "ViewDataValue";
viewData.TemplateInfo.HtmlFieldPrefix = "FieldPrefix";
var modelState = new ModelState();
modelState.Value = new ValueProviderResult(
rawValue: new string[] { "StringPropertyRawValue" },
attemptedValue: "StringPropertyAttemptedValue",
culture: CultureInfo.InvariantCulture);
viewData.ModelState["FieldPrefix.StringProperty"] = modelState;
modelState = new ModelState();
modelState.Value = new ValueProviderResult(
rawValue: new string[] { "ModelRawValue" },
attemptedValue: "ModelAttemptedValue",
culture: CultureInfo.InvariantCulture);
viewData.ModelState["FieldPrefix"] = modelState;
// Act & Assert
Assert.Equal("StringPropertyRawValue", helper.Value("StringProperty"));
Assert.Equal("StringPropertyRawValue", helper.ValueFor(m => m.StringProperty));
Assert.Equal("ModelRawValue", helper.ValueForModel());
}
开发者ID:Nakro,项目名称:Mvc,代码行数:32,代码来源:HtmlHelperValueExtensionsTest.cs
示例3: GetNameChainOverload1TestCase2
public void GetNameChainOverload1TestCase2()
{
var model = new TestModel();
var actual = model.GetNameChain( () => model.SubModel.Foo );
Assert.AreEqual( "SubModel.Foo", actual );
}
开发者ID:MannusEtten,项目名称:Extend,代码行数:7,代码来源:Object.Generic.GetNameChain.Test.cs
示例4: DocumentStoreWorksWhenAddingItemThenDeletingItAndThenGrabbingNonExistingItemAndStoringNewOne
public void DocumentStoreWorksWhenAddingItemThenDeletingItAndThenGrabbingNonExistingItemAndStoringNewOne()
{
using (var documentStore = new EmbeddableDocumentStore { RunInMemory = true }.Initialize())
{
documentStore.Conventions.AllowQueriesOnId = true;
using (var session = documentStore.OpenSession())
{
var deletedModel = new TestModel { Id = 1 };
session.Store(deletedModel);
session.SaveChanges();
session.Delete(deletedModel);
session.SaveChanges();
TestModel testModelItem = session.Query<TestModel>().SingleOrDefault(t => t.Id == 2) ??
new TestModel { Id = 2 };
Assert.NotNull(testModelItem);
session.Store(testModelItem);
session.SaveChanges();
var list = session.Query<TestModel>()
.Customize(x => x.WaitForNonStaleResults())
.ToList();
Assert.Equal(1, list.Count());
}
}
}
开发者ID:WimVergouwe,项目名称:ravendb,代码行数:27,代码来源:BuildStarted.cs
示例5: GetNameOverloadTest1
public void GetNameOverloadTest1()
{
var model = new TestModel();
var actual = model.Name.GetName( () => model.Name );
Assert.AreEqual( "Name", actual );
}
开发者ID:MannusEtten,项目名称:Extend,代码行数:7,代码来源:Object.Generic.GetName.Test.cs
示例6: OneContextTwoNodes
public void OneContextTwoNodes()
{
Gtk.Application.Init ();
string context = "Context1";
TestModel model = new TestModel();
/*INode nodeA = */model.CreateAddNode(10, context, new Size(80, 50));
/*INode nodeB = */model.CreateAddNode(20, context, new Size(100, 40));
TimelineLayoutManager layout = new TimelineLayoutManager(model);
layout.Update();
TestRenderer renderer = new TestRenderer();
TimelineView view = new TimelineView(model, renderer);
Gtk.Widget[] children = view.Children;
Assert.That(children.Length, Is.EqualTo(2));
Assert.That(children[0].Visible, Is.True);
Assert.That(children[1].Visible, Is.True);
int ax = (int) view.ChildGetProperty(children[0], "x").Val;
int ay = (int) view.ChildGetProperty(children[0], "y").Val;
int bx = (int) view.ChildGetProperty(children[1], "x").Val;
int by = (int) view.ChildGetProperty(children[1], "y").Val;
Assert.That(ay, Is.GreaterThan(0));
Assert.That(ay, Is.EqualTo(by));
Assert.That(ax, Is.GreaterThan(0));
Assert.That(bx, Is.GreaterThan(0));
Assert.That(ax, Is.Not.EqualTo(bx));
}
开发者ID:SayHalou,项目名称:ospy,代码行数:33,代码来源:TimelineViewTest.cs
示例7: PersistNewObject
public void PersistNewObject()
{
// Arrange
Bootstrapper.Start();
const string Key = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
var repository = Bootstrapper.AmbientContainer.GetInstance<Repository<TestModel>>();
var unitOfWorkFactory = Bootstrapper.AmbientContainer.GetInstance<IUnitOfWorkFactory>();
var unitOfWork = unitOfWorkFactory.CreateUnitOfWork();
var testModel = new TestModel(Key);
// Act
using (unitOfWork.Start())
{
repository.Create(testModel);
unitOfWork.Commit();
}
// Assert
using (unitOfWork.Start())
{
var foundModel = repository.Find.OneMatchingExpression(x => x.Key.Equals(Key));
Assert.That(foundModel != null);
}
}
开发者ID:KaraokeStu,项目名称:LeadPipe.Net,代码行数:28,代码来源:CreateShould.cs
示例8: ReturnsRightOwnerWhenUsingAdditionalParentWithIntProperty
public void ReturnsRightOwnerWhenUsingAdditionalParentWithIntProperty()
{
var testModel = new TestModel();
var owner = ExpressionHelper.GetOwner(() => testModel.IntProperty);
Assert.IsTrue(ReferenceEquals(testModel, owner));
}
开发者ID:justdude,项目名称:DbExport,代码行数:7,代码来源:ExpressionHelperFacts.cs
示例9: GetNameOverloadTest2
public void GetNameOverloadTest2()
{
var model = new TestModel();
var actual = PropertyChanged.GetName( () => PropertyChanged );
Assert.AreEqual( "PropertyChanged", actual );
}
开发者ID:MannusEtten,项目名称:Extend,代码行数:7,代码来源:Object.Generic.GetName.Test.cs
示例10: ReturnResultsAsDynamicList
public void ReturnResultsAsDynamicList()
{
// Arrange
Bootstrapper.Start();
var unitOfWorkFactory = Bootstrapper.AmbientContainer.GetInstance<IUnitOfWorkFactory>();
var unitOfWork = unitOfWorkFactory.CreateUnitOfWork();
var repository = Bootstrapper.AmbientContainer.GetInstance<Repository<TestModel>>();
const string Key = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
var testModel = new TestModel(Key);
IList<dynamic> results;
// Act
using (unitOfWork.Start())
{
repository.Create(testModel);
unitOfWork.Commit();
results = unitOfWork.CurrentSession().CreateSQLQuery("SELECT Key FROM TestModel").AsDynamicList();
}
// Assert
Assert.That(results[0].Key.Equals(Key));
}
开发者ID:KaraokeStu,项目名称:LeadPipe.Net,代码行数:30,代码来源:AsDynamicListShould.cs
示例11: ObjectCache
public void ObjectCache()
{
var model = new TestModel() { Id = 101, Name = "TestName" };
this.helper.Set("TestObject",model);
TestModel result = this.helper.Get<TestModel>("TestObject");
Assert.AreEqual(model, result);
}
开发者ID:AntZhou,项目名称:AntFramework,代码行数:7,代码来源:AntMemcacheUnitTest.cs
示例12: ReturnAllMatchingObjects
public void ReturnAllMatchingObjects()
{
// Arrange
Bootstrapper.Start();
var repository = Bootstrapper.AmbientContainer.GetInstance<Repository<TestModel>>();
var unitOfWorkFactory = Bootstrapper.AmbientContainer.GetInstance<IUnitOfWorkFactory>();
var dataCommandProvider = Bootstrapper.AmbientContainer.GetInstance<IDataCommandProvider>();
var unitOfWork = unitOfWorkFactory.CreateUnitOfWork();
var testModel01 = new TestModel("ABCDEF");
var testModel02 = new TestModel("HIJKLM");
var testModel03 = new TestModel("ABCZZZ");
// Act
using (unitOfWork.Start())
{
repository.Create(testModel01);
repository.Create(testModel02);
repository.Create(testModel03);
unitOfWork.Commit();
}
// Assert
using (unitOfWork.Start())
{
var foundModel = repository.Find.AllMatchingQuery(new TestModelsWithTestPropertiesThatStartWithABC(dataCommandProvider));
Assert.That(foundModel.Count().Equals(2));
}
}
开发者ID:KaraokeStu,项目名称:LeadPipe.Net,代码行数:32,代码来源:GetQueryResultShould.cs
示例13: GetNameTest
public void GetNameTest()
{
var model = new TestModel();
var actual = model.GetName( x => x.Age );
Assert.AreEqual( "Age", actual );
}
开发者ID:MannusEtten,项目名称:Extend,代码行数:7,代码来源:Object.Generic.GetName.Test.cs
示例14: GetNameChainOverload1TestCase1
public void GetNameChainOverload1TestCase1()
{
var model = new TestModel();
var actual = model.GetNameChain( x => model.Age );
Assert.AreEqual( "Age", actual );
}
开发者ID:MannusEtten,项目名称:Extend,代码行数:7,代码来源:Object.Generic.GetNameChain.Test.cs
示例15: ReturnAllMatchingObjectsGivenAndSpecification
public void ReturnAllMatchingObjectsGivenAndSpecification()
{
// Arrange
Bootstrapper.Start();
var repository = Bootstrapper.AmbientContainer.GetInstance<Repository<TestModel>>();
var unitOfWorkFactory = Bootstrapper.AmbientContainer.GetInstance<IUnitOfWorkFactory>();
var unitOfWork = unitOfWorkFactory.CreateUnitOfWork();
var testModel01 = new TestModel("ABCDEF");
var testModel02 = new TestModel("HIJKLM");
var testModel03 = new TestModel("ABCXYZ");
// Act
using (unitOfWork.Start())
{
repository.Create(testModel01);
repository.Create(testModel02);
repository.Create(testModel03);
unitOfWork.Commit();
}
// Assert
using (unitOfWork.Start())
{
var foundModel = repository.Find.AllMatchingSpecification(TestModelSpecifications.TestPropertyStartsWithABCAndEndsWithXYZ()).ToList();
Assert.That(foundModel.Count.Equals(1));
}
}
开发者ID:KaraokeStu,项目名称:LeadPipe.Net,代码行数:31,代码来源:AllMatchingSpecificationShould.cs
示例16: ValidateValidObjectReturnsEmptyListValidationResult
public void ValidateValidObjectReturnsEmptyListValidationResult()
{
var sut = new TestModel() { Name = "Name", SubModel = new SubModel { Property1 = "1" } };
var validationResults = sut.Validate();
Assert.Empty(validationResults);
}
开发者ID:Georadix,项目名称:Georadix.NET,代码行数:8,代码来源:DataAnnotationExtensionsFixture.cs
示例17: GetNameChainOverload1TestCase4
public void GetNameChainOverload1TestCase4()
{
var model = new TestModel();
Expression<Func<Object>> expression1 = () => model.SubModel.Foo;
var actual = model.GetNameChain( expression1 );
Assert.AreEqual( "SubModel.Foo", actual );
}
开发者ID:MannusEtten,项目名称:Extend,代码行数:8,代码来源:Object.Generic.GetNameChain.Test.cs
示例18: BuilderModelLoadAndChangeState
public void BuilderModelLoadAndChangeState()
{
// Создадим и изменим.
TestModel model = new TestModel();
((TestProduct)model.MainItem).Id = "777";
Assert.AreEqual(ModelState.New, model.State);
Assert.IsNull(model.LoadedFileName);
}
开发者ID:DarkGraf,项目名称:STInstaller,代码行数:8,代码来源:BuilderModelTest.cs
示例19: SetUp
public void SetUp()
{
_model = new TestModel();
_router = new StubRouter<TestModel>(_model);
_stringSubject = new StubSubject<string>();
_intSubject = new StubSubject<int>();
_decimalSubject = new StubSubject<decimal>();
}
开发者ID:raybooysen,项目名称:esp-net,代码行数:8,代码来源:WorkflowTests.cs
示例20: TestUiDateTimeModelAsParameter
public ActionResult TestUiDateTimeModelAsParameter()
{
var model = new TestModel {
ModelOne = new UiDateTimeModel("US Eastern Standard Time"),
ModelTwo = new UiDateTimeModel("Pacific Standard Time")
};
return View(model);
}
开发者ID:rantoine,项目名称:CSharpMVCDateTimeConversionFramework,代码行数:9,代码来源:UiDateTimeController.cs
注:本文中的TestModel类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论