本文整理汇总了C#中TestEntity类的典型用法代码示例。如果您正苦于以下问题:C# TestEntity类的具体用法?C# TestEntity怎么用?C# TestEntity使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
TestEntity类属于命名空间,在下文中一共展示了TestEntity类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。
示例1: EqualsWithNewObjectsUsesReferenceEquals
public void EqualsWithNewObjectsUsesReferenceEquals()
{
// Arrange
var ent1 = new TestEntity();
var ent2 = new TestEntity();
// Act
bool different = ent1.Equals( ent2 );
bool different2 = ent2.Equals( ent1 );
bool different3 = ent1 == ent2;
bool equal3 = ent1 != ent2;
var ent3 = ent1;
bool equal = ent1.Equals( ent3 );
bool equal2 = ent3.Equals( ent1 );
bool equal4 = ent1 == ent3;
bool different4 = ent1 != ent3;
// Assert
Assert.IsFalse( different );
Assert.IsFalse( different2 );
Assert.IsFalse( different3 );
Assert.IsFalse( different4 );
Assert.IsTrue( equal );
Assert.IsTrue( equal2 );
Assert.IsTrue( equal3 );
Assert.IsTrue( equal4 );
}
开发者ID:TheSylence,项目名称:GSD,代码行数:28,代码来源:EntityTests.cs
示例2: SetEntityId
private static void SetEntityId(TestEntity entity, long id)
{
var idProperty = entity.GetType()
.GetProperty("Id", BindingFlags.Instance | BindingFlags.Public);
var setter = idProperty.SetMethod;
setter.Invoke(entity, new object[] { id });
}
开发者ID:hello-mean,项目名称:glsec-2014,代码行数:7,代码来源:EntityBaseTest.cs
示例3: IntersectTest
public void IntersectTest()
{
var a = new TestEntity(Vector2.Zero, new Vector2(10, 10));
var b = new TestEntity(Vector2.Zero, new Vector2(10, 10));
Assert.IsTrue(a.Intersects(b));
a.Position = new Vector2(9, 9);
Assert.IsTrue(a.Intersects(b));
a.Position = new Vector2(-9, -9);
Assert.IsTrue(a.Intersects(b));
a.Position = new Vector2(-9, 0);
Assert.IsTrue(a.Intersects(b));
a.Position = new Vector2(0, -9);
Assert.IsTrue(a.Intersects(b));
a.Position = new Vector2(-11, -11);
Assert.IsFalse(a.Intersects(b));
a.Position = new Vector2(-11, 0);
Assert.IsFalse(a.Intersects(b));
a.Position = new Vector2(0, -11);
Assert.IsFalse(a.Intersects(b));
a.Position = new Vector2(11, 11);
Assert.IsFalse(a.Intersects(b));
}
开发者ID:mateuscezar,项目名称:netgore,代码行数:31,代码来源:EntityTests.cs
示例4: Context
public virtual void Context()
{
Entity = new TestEntity();
Session = Mock<ISession>();
var unitOfWork = CreateUnitOfWorkWithStartedTransaction();
Repository = new NhibernateRepository<TestEntity>(unitOfWork);
}
开发者ID:xhafan,项目名称:emailmaker,代码行数:7,代码来源:NhibernateRepositorySetup.cs
示例5: When_include_has_no_conflicts_happy_path
public void When_include_has_no_conflicts_happy_path()
{
var entity1 = new TestEntity("INV-0001");
var entity2 = new TestEntity("INV-0002");
EventData[] events =
{
CreateEvent("e1", Include.Insert(entity1)),
CreateEvent("e2", Include.Insert(entity2))
};
var result = Stream.Write(new Stream(partition), events);
var stored = RetrieveTestEntity(entity1.RowKey);
Assert.That(stored, Is.Not.Null);
stored = RetrieveTestEntity(entity2.RowKey);
Assert.That(stored, Is.Not.Null);
Assert.That(result.Includes.Length, Is.EqualTo(2));
Assert.That(result.Includes[0], Is.SameAs(entity1));
Assert.That(result.Includes[0].ETag, Is.Not.Null.Or.Empty);
Assert.That(result.Includes[1], Is.SameAs(entity2));
Assert.That(result.Includes[1].ETag, Is.Not.Null.Or.Empty);
}
开发者ID:kowalot,项目名称:Streamstone,代码行数:25,代码来源:Including_additional_entities.cs
示例6: Entity_ConstructorAssignsValues
public void Entity_ConstructorAssignsValues()
{
var guid = Guid.NewGuid();
var entity = new TestEntity(guid);
entity.Id.Should().Be(guid);
}
开发者ID:wallaceiam,项目名称:CQRS.Light,代码行数:7,代码来源:EntityTests.cs
示例7: GetHashCode_returns_hash_code_of_Id
public void GetHashCode_returns_hash_code_of_Id()
{
var entity = new TestEntity();
long id = 2;
SetEntityId(entity, id);
Assert.AreEqual(id.GetHashCode(), entity.GetHashCode());
}
开发者ID:r41lblast,项目名称:ndriven-cli,代码行数:7,代码来源:EntityBaseTest.cs
示例8: GivenValueDoesNotMatchInvalidValue_AndValidationContext_WhenValidate_ThenSucceed
public void GivenValueDoesNotMatchInvalidValue_AndValidationContext_WhenValidate_ThenSucceed()
{
TestEntity toValidate = new TestEntity { Value = "not invalid" };
ValidationContext validationContext = new ValidationContext(toValidate) { DisplayName = "Test Entity Value", MemberName = "Value" };
Target.Validate(toValidate.Value, validationContext);
}
开发者ID:modulexcite,项目名称:StudentSuccessDashboard,代码行数:7,代码来源:DoesNotEqualAttributeTest.cs
示例9: GetHashCode_uses_hash_code_that_was_generated_pre_id_set
public void GetHashCode_uses_hash_code_that_was_generated_pre_id_set()
{
var entity = new TestEntity();
var hash = entity.GetHashCode();
SetEntityId(entity, 1);
Assert.AreEqual(hash, entity.GetHashCode());
}
开发者ID:r41lblast,项目名称:ndriven-cli,代码行数:7,代码来源:EntityBaseTest.cs
示例10: ComparisonAttributeTest
public ComparisonAttributeTest()
{
_validEntity = new TestEntity { FirstProperty = 10, SecondProperty = 10 };
_invalidEntity = new TestEntity {FirstProperty = 10, SecondProperty = 20};
_attribute = new ComparisonAttribute("SecondProperty", ComparisonAttribute.ComparisonCondition.Equal);
_attribute.ErrorMessage = _errorMessage;
}
开发者ID:WadeOne,项目名称:EasyTeach,代码行数:7,代码来源:ComparisonAttributeTest.cs
示例11: Test_UpperCase_BulkInsert
public void Test_UpperCase_BulkInsert()
{
// Use Upper Case Schema Name:
subject = new PostgreSQLCopyHelper<TestEntity>("SAMPLE", "UNIT_TEST")
.MapSmallInt("col_smallint", x => x.SmallInt);
// Try to work with the Bulk Inserter:
var entity0 = new TestEntity()
{
SmallInt = Int16.MinValue
};
var entity1 = new TestEntity()
{
SmallInt = Int16.MaxValue
};
subject.SaveAll(connection, new[] { entity0, entity1 });
var result = connection.GetAll("sample", "unit_test");
// Check if we have the amount of rows:
Assert.AreEqual(2, result.Count);
Assert.IsNotNull(result[0][0]);
Assert.IsNotNull(result[1][0]);
Assert.AreEqual(Int16.MinValue, (Int16)result[0][0]);
Assert.AreEqual(Int16.MaxValue, (Int16)result[1][0]);
}
开发者ID:bytefish,项目名称:PostgreSQLCopyHelper,代码行数:30,代码来源:Issue1_UpperCase_Test.cs
示例12: Castle
public void Castle()
{
SystemConfig.ConfigFilesAssemblyName = "CodeSharp.Framework.Castles.Test";
SystemConfig.Configure("ConfigFiles")
.Castle()
.BusinessDependency(Assembly.GetExecutingAssembly());
Assert.AreEqual("abc", SystemConfig.Settings["key1"]);
Assert.DoesNotThrow(() => DependencyResolver.Resolve<ILoggerFactory>().Create(this.GetType()).Info("hi"));
Assert.DoesNotThrow(() => DependencyResolver.Resolve<ITestService>());
Assert.DoesNotThrow(() => DependencyResolver.Resolve<NHibernate.ISessionFactory>());
//NH Tests
var e = new TestEntity("abc");
var s = DependencyResolver.Resolve<ITestService>();
s.Create(e);
DependencyResolver.Resolve<Castle.Facilities.NHibernateIntegration.ISessionManager>().OpenSession().Evict(e);
var e2= s.Get(e.ID);
//private setter?
Assert.AreEqual(e.Name, e2.Name);
Assert.AreEqual("abc", e2.Name);
Assert.DoesNotThrow(() => SystemConfig.Cleanup());
}
开发者ID:gongzunpan,项目名称:infrastructure,代码行数:27,代码来源:SystemConfigTest.cs
示例13: EntitiesWithDifferentIdShouldNotBeEqual
public void EntitiesWithDifferentIdShouldNotBeEqual()
{
var entity1 = new TestEntity(Guid.NewGuid());
var entity2 = new TestEntity(Guid.NewGuid());
Assert.IsFalse(entity1.Equals(entity2));
}
开发者ID:ntrhieu89,项目名称:ChineseCharacterTrainer,代码行数:7,代码来源:EntityTest.cs
示例14: Should_validate
public void Should_validate()
{
var testEntity = new TestEntity();
repository.Expect(x => x.GetById(3)).Return(testEntity);
binder.BindModel(controllerContext, context);
validatingBinder.AssertWasCalled(x => x.UpdateFrom(testEntity, controllerContext.HttpContext.Request.Form, context.ModelState, "foo"));
}
开发者ID:bertusmagnus,项目名称:Sutekishop,代码行数:7,代码来源:DataBinderTester.cs
示例15: GivenNumbersEqual_AndAllowEquality_AndValidationContext_WhenValidate_ThenSucceed
public void GivenNumbersEqual_AndAllowEquality_AndValidationContext_WhenValidate_ThenSucceed()
{
TestEntity toValidate = new TestEntity { Value = "10" };
ValidationContext validationContext = new ValidationContext(toValidate) { DisplayName = "Test Entity Value", MemberName = "Value" };
var target = new NumericGreaterThanAttribute("Value") { AllowEquality = true };
target.Validate("10", validationContext);
}
开发者ID:modulexcite,项目名称:StudentSuccessDashboard,代码行数:8,代码来源:NumericGreaterThanAttributeTest.cs
示例16: EntityRemovedEventShouldBeTriggeredWhenEntityAddedTest
public void EntityRemovedEventShouldBeTriggeredWhenEntityAddedTest()
{
var serviceEntity = new TestEntity { Name = "name" };
Context.Service.AddEntity(serviceEntity);
Assert.IsTrue(Context.WaitFor(() => Context.Entities.Count() == 1, Context.WaitingPeriod));
Context.Service.RemoveEntity(serviceEntity);
Assert.IsTrue(Context.WaitFor(() => !Context.Entities.Any(), Context.WaitingPeriod));
}
开发者ID:brainster-one,项目名称:khrussk,代码行数:8,代码来源:EntitySyncTests.cs
示例17: EntitiesWithSameIdShouldBeEqual
public void EntitiesWithSameIdShouldBeEqual()
{
var guid = Guid.NewGuid();
var entity1 = new TestEntity(guid);
var entity2 = new TestEntity(guid);
Assert.IsTrue(entity1.Equals(entity2));
}
开发者ID:ntrhieu89,项目名称:ChineseCharacterTrainer,代码行数:8,代码来源:EntityTest.cs
示例18: Should_fetch_from_primary_key
public void Should_fetch_from_primary_key()
{
var testEntity = new TestEntity();
repository.Expect(x => x.GetById(3)).Return(testEntity);
var result = binder.BindModel(controllerContext, context);
result.ShouldBeTheSameAs(testEntity);
}
开发者ID:bertusmagnus,项目名称:Sutekishop,代码行数:8,代码来源:DataBinderTester.cs
示例19: EntityID_Can_Init
public void EntityID_Can_Init()
{
var entity = new TestEntity();
Assert.IsTrue(entity.Id == Guid.Empty);
var id = Guid.NewGuid();
entity.Id = id;
Assert.IsTrue(entity.Id == id);
}
开发者ID:mingkongbin,项目名称:anycmd,代码行数:8,代码来源:EntityIDTest.cs
示例20: Equals_should_return_true_if_both_entities_have_same_Id
public void Equals_should_return_true_if_both_entities_have_same_Id()
{
var entity = new TestEntity();
var entity2 = new TestEntity();
SetEntityId(entity, 1);
SetEntityId(entity2, 1);
Assert.True(entity.Equals(entity2));
}
开发者ID:r41lblast,项目名称:ndriven-cli,代码行数:8,代码来源:EntityBaseTest.cs
注:本文中的TestEntity类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论