本文整理汇总了C#中Cargo类的典型用法代码示例。如果您正苦于以下问题:C# Cargo类的具体用法?C# Cargo怎么用?C# Cargo使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
Cargo类属于命名空间,在下文中一共展示了Cargo类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: toCargoRoutingDTO
public void toCargoRoutingDTO()
{
var origin = L.HONGKONG;
var destination = L.LONGBEACH;
var cargo = new Cargo(new TrackingId("XYZ"), new RouteSpecification(origin, destination, DateTime.Now));
var itinerary = new Itinerary(
Leg.DeriveLeg(SampleVoyages.pacific1, L.HONGKONG, L.TOKYO),
Leg.DeriveLeg(SampleVoyages.pacific1, L.TOKYO, L.LONGBEACH)
);
cargo.AssignToRoute(itinerary);
var dto = DTOAssembler.toDTO(cargo);
Assert.AreEqual(2, dto.getLegs().Count());
LegDTO legDTO = dto.getLegs().ElementAt(0);
Assert.AreEqual("PAC1", legDTO.getVoyageNumber());
Assert.AreEqual("CNHKG", legDTO.getFrom());
Assert.AreEqual("JNTKO", legDTO.getTo());
legDTO = dto.getLegs().ElementAt(1);
Assert.AreEqual("PAC1", legDTO.getVoyageNumber());
Assert.AreEqual("JNTKO", legDTO.getFrom());
Assert.AreEqual("USLBG", legDTO.getTo());
}
示例2: NaoCadastraComNomeVazio
public void NaoCadastraComNomeVazio()
{
Cargo cargo = new Cargo(12, "", 'I');
CargoRepositorio cargoRep = new CargoRepositorio();
bool cadastrar = cargoRep.AdicionarCargo(cargo);
Assert.AreEqual(true, cadastrar);
}
示例3: toDTO
internal static CargoRoutingDTO toDTO(Cargo cargo)
{
var itinerary = cargo.Itinerary;
var legDTOList = new List<LegDTO>();
if(itinerary != null)
{
var legs = itinerary.Legs;
legDTOList = new List<LegDTO>(legs.Count());
foreach(Leg leg in legs)
{
var legDTO = new LegDTO(
leg.Voyage.VoyageNumber.Value,
leg.LoadLocation.UnLocode.Value,
leg.UnloadLocation.UnLocode.Value,
leg.LoadTime,
leg.UnloadTime);
legDTOList.Add(legDTO);
}
}
return new CargoRoutingDTO(
cargo.TrackingId.Value,
cargo.RouteSpecification.Origin.UnLocode.Value,
cargo.RouteSpecification.Destination.UnLocode.Value,
cargo.RouteSpecification.ArrivalDeadline,
cargo.RoutingStatus == RoutingStatus.MISROUTED,
legDTOList
);
}
示例4: DeletarCargo
public void DeletarCargo()
{
Cargo cargo = new Cargo(100, "Presidente", 'I');
CargoRepositorio cargoRep = new CargoRepositorio();
bool delete = cargoRep.DeletarCargo(5);
Assert.AreEqual(true, delete);
}
示例5: OnTriggerEnter
void OnTriggerEnter(Collider otherObject)
{
Debug.Log(string.Format("Ore collided with {0} at {1}", otherObject.name, Time.time));
if (otherObject.name == "Player")
{
Cargo ore = new Cargo(Cargo.CargoType.Ore);
//different OreTypes are worth different amounts
switch (ActiveOreType)
{
case OreType.Green:
ore.Quantity = 1;
break;
case OreType.Blue:
ore.Quantity = 2;
break;
case OreType.Red:
ore.Quantity = 3;
break;
case OreType.Yellow:
ore.Quantity = 5;
break;
}
otherObject.SendMessage("PickupCargo", ore);
Destroy(gameObject);
}
}
示例6: cadastrarCargo
public Boolean cadastrarCargo(Cargo objCargo)
{
objCargo.Codigo = obtemNovoId();
try
{
if (!temDuplicidade(objCargo, "Cadastrar"))
{
db = ServidorSingleton.obterServidor().OpenClient();
db.Store(objCargo);
db.Commit();
return true;
}
else {
return false;
}
}
catch(Exception e)
{
throw new Exception("Erro cadastrando o cargo :" + e.Message);
}
finally {
db.Close();
db.Dispose();
}
}
示例7: FuncionarioBuilder
private FuncionarioBuilder()
{
_usuario = UsuarioBuilder.DadoUmUsuario().Build();
_departamento = DepartamentoBuilder.DadoUmDepartamento().Build();
_cargo = CargoBuilder.DadoUmCargo().Build();
_programa = ProgramaBuilder.DadoUmPrograma().Build();
}
示例8: CargoTest
public void CargoTest()
{
Cargo cargo = new Cargo(23, "Cargo");
Assert.AreEqual("Cargo", cargo.Nome);
Assert.AreEqual(23, cargo.IdCargo);
Assert.AreEqual('\0', cargo.Situacao);
}
示例9: TestCalculatePossibleRoutes
public void TestCalculatePossibleRoutes()
{
var trackingId = new TrackingId("ABC");
var routeSpecification = new RouteSpecification(SampleLocations.HONGKONG,
SampleLocations.HELSINKI, DateTime.Now);
var cargo = new Cargo(trackingId, routeSpecification);
voyageRepositoryMock.Setup(v => v.Find(It.IsAny<VoyageNumber>())).Returns(SampleVoyages.CM002);
IList<Itinerary> candidates = externalRoutingService.FetchRoutesForSpecification(routeSpecification);
Assert.IsNotNull(candidates);
foreach (Itinerary itinerary in candidates)
{
IList<Leg> legs = itinerary.Legs;
Assert.IsNotNull(legs);
Assert.IsFalse(legs.IsEmpty());
// Cargo origin and start of first leg should match
Assert.AreEqual(cargo.Origin, legs[0].LoadLocation);
// Cargo final destination and last leg stop should match
Location lastLegStop = legs[legs.Count - 1].UnloadLocation;
Assert.AreEqual(cargo.RouteSpecification.Destination, lastLegStop);
for (int i = 0; i < legs.Count - 1; i++)
{
// Assert that all legs are connected
Assert.AreEqual(legs[i].UnloadLocation, legs[i + 1].LoadLocation);
}
}
voyageRepositoryMock.Verify();
}
示例10: CargoTest
public void CargoTest()
{
Cargo cargo = new Cargo("Cargo", 'A');
Assert.AreEqual("Cargo", cargo.Nome);
Assert.AreEqual(0, cargo.IdCargo);
Assert.AreEqual('A', cargo.Situacao);
}
示例11: updateCargo
public void updateCargo()
{
TrackingId trackingId = trackingIdFactory.nextTrackingId();
RouteSpecification routeSpecification = new RouteSpecification(L.HONGKONG,
L.GOTHENBURG,
DateTime.Parse("2009-10-15"));
Cargo cargo = new Cargo(trackingId, routeSpecification);
cargoRepository.store(cargo);
HandlingEvent handlingEvent = handlingEventFactory.createHandlingEvent(DateTime.Parse("2009-10-01 14:30"),
cargo.TrackingId,
V.HONGKONG_TO_NEW_YORK.VoyageNumber,
L.HONGKONG.UnLocode,
HandlingActivityType.LOAD,
new OperatorCode("ABCDE"));
handlingEventRepository.store(handlingEvent);
Assert.That(handlingEvent.Activity, Is.Not.EqualTo(cargo.MostRecentHandlingActivity));
cargoUpdater.updateCargo(handlingEvent.SequenceNumber);
Assert.That(handlingEvent.Activity, Is.EqualTo(cargo.MostRecentHandlingActivity));
Assert.True(handlingEvent.Activity != cargo.MostRecentHandlingActivity);
systemEvents.AssertWasCalled(se => se.notifyOfCargoUpdate(cargo));
}
示例12: AdicionarCargo
public bool AdicionarCargo(Cargo cargo)
{
bool podeCadastrar = PodeCadastrar(cargo);
bool verificarNome = VerificarNomeNuloOuVazio(cargo);
if (podeCadastrar && !Eleicao.Iniciou)
{
if (verificarNome)
{
string connectionString = ConfigurationManager.ConnectionStrings["URNA"].ConnectionString;
using (TransactionScope transacao = new TransactionScope())
using (IDbConnection connection = new SqlConnection(connectionString))
{
IDbCommand comando = connection.CreateCommand();
comando.CommandText =
"INSERT INTO Cargo (Nome, Situacao) values(@paramNome, @paramSituacao)";
comando.AddParameter("@paramNome", cargo.Nome);
comando.AddParameter("@paramSituacao", cargo.Situacao);
connection.Open();
comando.ExecuteNonQuery();
transacao.Complete();
connection.Close();
}
}
return true;
}
else
{
return false;
}
}
示例13: CadastrarCargo
public void CadastrarCargo()
{
Cargo cargo = new Cargo(6, "Deputado", 'A');
CargoRepositorio cargoRep = new CargoRepositorio();
bool cadastro = cargoRep.AdicionarCargo(cargo);
Assert.AreEqual(true, cadastro);
}
示例14: Store
public void Store(Cargo cargo)
{
cargoCollection.Save(cargo);
// Delete-orphan does not seem to work correctly when the parent is a component
//Session.CreateSQLQuery("delete from Leg where cargo_id = null").ExecuteUpdate();
}
示例15: NaoAlteraCargoPraAtivoComEleicaoAberta
public void NaoAlteraCargoPraAtivoComEleicaoAberta()
{
Cargo cargo = new Cargo(42, "Sindico", 'A');
CargoRepositorio cargoRep = new CargoRepositorio();
bool altera = cargoRep.AtivarCargo(1);
Assert.AreEqual(false, altera);
}