Adds new database table + migration + unit test + fixes up unit tests to ensure PluginManager.Current = null; is done on teardown.

Created new ServerRegistrationRepository + unit tests + models
This commit is contained in:
Shannon Deminick
2013-02-13 03:29:32 +06:00
parent 102bf058bc
commit 3b25214433
43 changed files with 724 additions and 101 deletions

View File

@@ -0,0 +1,32 @@
using System;
using Umbraco.Core.Persistence;
using Umbraco.Core.Persistence.DatabaseAnnotations;
namespace Umbraco.Core.Models.Rdbms
{
[TableName("umbracoServer")]
[PrimaryKey("id")]
[ExplicitColumns]
internal class ServerRegistrationDto
{
[Column("id")]
[PrimaryKeyColumn(AutoIncrement = true)]
public int Id { get; set; }
[Column("address")]
[Length(100)]
public string Address { get; set; }
[Column("registeredDate")]
[Constraint(Default = "getdate()")]
public DateTime DateRegistered { get; set; }
[Column("lastNotifiedDate")]
[Constraint(Default = "getdate()")]
public DateTime LastNotified { get; set; }
[Column("isActive")]
[Index(IndexTypes.NonClustered)]
public bool IsActive { get; set; }
}
}

View File

@@ -0,0 +1,46 @@
using System;
using Umbraco.Core.Models.EntityBase;
using Umbraco.Core.Sync;
namespace Umbraco.Core.Models
{
internal class ServerRegistration : Entity, IServerAddress, IAggregateRoot
{
public ServerRegistration()
{
}
/// <summary>
/// Creates an item with pre-filled properties
/// </summary>
/// <param name="id"></param>
/// <param name="serverAddress"></param>
/// <param name="createDate"></param>
/// <param name="updateDate"></param>
public ServerRegistration(int id, string serverAddress, DateTime createDate, DateTime updateDate)
{
UpdateDate = updateDate;
CreateDate = createDate;
Key = Id.ToString().EncodeAsGuid();
Id = id;
ServerAddress = serverAddress;
}
/// <summary>
/// Creates a new instance for persisting a new item
/// </summary>
/// <param name="serverAddress"></param>
/// <param name="createDate"></param>
public ServerRegistration(string serverAddress, DateTime createDate)
{
CreateDate = createDate;
UpdateDate = createDate;
Key = 0.ToString().EncodeAsGuid();
ServerAddress = serverAddress;
}
public string ServerAddress { get; set; }
public bool IsActive { get; set; }
}
}