public void IsNew_GivenNonTransientEntityAndPrimaryKeyName_ShouldBeValid() { var guidEntity = new GenericNoMapsIdEntity <Guid> { Id = Guid.Parse("803A25C4-65D9-4F92-9305-0854FD134841") }; var guidNullableEntity = new GenericNoMapsIdEntity <Guid?> { Id = Guid.Parse("803A25C4-65D9-4F92-9305-0854FD134841") }; var intEntity = new GenericNoMapsIdEntity <int> { Id = 1 }; var unsignedIntEntity = new GenericNoMapsIdEntity <uint> { Id = 1 }; var shortEntity = new GenericNoMapsIdEntity <short>() { Id = 1 }; var unsignedShortEntity = new GenericNoMapsIdEntity <ushort>() { Id = 1 }; var longEntity = new GenericNoMapsIdEntity <long>() { Id = 1 }; var unsignedLongEntity = new GenericNoMapsIdEntity <ulong>() { Id = 1 }; var stringEntity = new GenericNoMapsIdEntity <string>() { Id = "ID-1" }; var referenceEntity = new GenericNoMapsIdEntity <ComplexPrimaryKey> { Id = new ComplexPrimaryKey() }; var guidResult = DB.IsNew("id", guidEntity); var guidNullableResult = DB.IsNew("id", guidNullableEntity); var intResult = DB.IsNew("id", intEntity); var unsignedIntResult = DB.IsNew("id", unsignedIntEntity); var shortResult = DB.IsNew("id", shortEntity); var unsignedShortResult = DB.IsNew("id", unsignedShortEntity); var longResult = DB.IsNew("id", longEntity); var unsignedLongResult = DB.IsNew("id", unsignedLongEntity); var stringResult = DB.IsNew("id", stringEntity); var referenceResult = DB.IsNew("id", referenceEntity); guidResult.ShouldBeFalse(); guidNullableResult.ShouldBeFalse(); intResult.ShouldBeFalse(); unsignedIntResult.ShouldBeFalse(); shortResult.ShouldBeFalse(); unsignedShortResult.ShouldBeFalse(); longResult.ShouldBeFalse(); unsignedLongResult.ShouldBeFalse(); stringResult.ShouldBeFalse(); referenceResult.ShouldBeFalse(); }
public void IsNew_GivenTransientEntityAndPrimaryKeyName_ShouldBeValid() { var guidEntity = new GenericNoMapsIdEntity <Guid>(); var guidNullableEntity = new GenericNoMapsIdEntity <Guid?>(); var intEntity = new GenericNoMapsIdEntity <int>(); var unsignedIntEntity = new GenericNoMapsIdEntity <uint>(); var shortEntity = new GenericNoMapsIdEntity <short>(); var unsignedShortEntity = new GenericNoMapsIdEntity <ushort>(); var longEntity = new GenericNoMapsIdEntity <long>(); var unsignedLongEntity = new GenericNoMapsIdEntity <ulong>(); var stringEntity = new GenericNoMapsIdEntity <string>(); var referenceEntity = new GenericNoMapsIdEntity <ComplexPrimaryKey>(); var guidResult = DB.IsNew("Id", guidEntity); var guidNullableResult = DB.IsNew("Id", guidNullableEntity); var intResult = DB.IsNew("Id", intEntity); var unsignedIntResult = DB.IsNew("Id", unsignedIntEntity); var shortResult = DB.IsNew("Id", shortEntity); var unsignedShortResult = DB.IsNew("Id", unsignedShortEntity); var longResult = DB.IsNew("Id", longEntity); var unsignedLongResult = DB.IsNew("Id", unsignedLongEntity); var stringResult = DB.IsNew("Id", stringEntity); var referenceResult = DB.IsNew("Id", referenceEntity); guidResult.ShouldBeTrue(); guidNullableResult.ShouldBeTrue(); intResult.ShouldBeTrue(); unsignedIntResult.ShouldBeTrue(); shortResult.ShouldBeTrue(); unsignedShortResult.ShouldBeTrue(); longResult.ShouldBeTrue(); unsignedLongResult.ShouldBeTrue(); stringResult.ShouldBeTrue(); referenceResult.ShouldBeTrue(); }