Ejemplo n.º 1
0
		public void CanBindPrimaryKeyToEmptyGuid()
		{
			Tag tag = new Tag() { Id = Guid.Empty, Name = "TopMovie" };
			tag.Create();

			var request = new StubRequest();
			request.Params["tag.id"] = Guid.Empty.ToString();

			var binder = new ARDataBinder { AutoLoad = AutoLoadBehavior.Always, TreatEmptyGuidAsNull = false};
			
			var record = (Tag)binder.BindObject(typeof(Tag), "tag", request.ParamsNode);
	
			Assert.AreEqual(tag.Id, record.Id);
		}
Ejemplo n.º 2
0
		public void CanFetchWithEmptyGuid()
		{
			Tag tag = new Tag() { Id = Guid.Empty, Name = "TopMovie" };
			tag.Create();
			
			ARFetcher fetcher = new ARFetcher(new DefaultConverter());
			
			ParameterInfo parameter = typeof(MyController).GetMethod("MyAction3").GetParameters()[0];
			
			ARFetchAttribute attribute = (ARFetchAttribute)parameter.GetCustomAttributes(typeof(ARFetchAttribute), true)[0];
			
			Dictionary<string, object> customActionParameters = new Dictionary<string, object>();
			customActionParameters["id"] = Guid.Empty;

			Tag record = (Tag)fetcher.FetchActiveRecord(
				parameter, attribute, new StubRequest(), customActionParameters);
			
			Assert.AreEqual(tag.Id, record.Id);
		}