本文整理汇总了C#中ModelDto类的典型用法代码示例。如果您正苦于以下问题:C# ModelDto类的具体用法?C# ModelDto怎么用?C# ModelDto使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
ModelDto类属于命名空间,在下文中一共展示了ModelDto类的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Establish_context
protected override void Establish_context()
{
Mapper.AllowNullDestinationValues = false;
Mapper.CreateMap<ModelObject, ModelDto>();
_result = Mapper.Map<ModelObject, ModelDto>(null);
}
示例2: Establish_context
protected override void Establish_context()
{
Mapper.AddFormatter<HardEncoder>();
Mapper.AddFormatter(new SoftEncoder());
Mapper.AddFormatter(typeof(RokkenEncoder));
Mapper.AddFormatExpression(context => context.SourceValue + " Medium");
Mapper.CreateMap<ModelObject, ModelDto>();
var modelObject = new ModelObject { Value = 14 };
_modelDto = Mapper.Map<ModelObject, ModelDto>(modelObject);
}
示例3: Because_of
protected override void Because_of()
{
_model = new ModelObject();
_dto = Mapper.Map<ModelObject, ModelDto>(_model);
}
示例4: SaveNewModel
private void SaveNewModel()
{
var newModel = new ModelDto();
newModel.ModelNumberk__BackingField = newModelNumber;
newModel.ModelNamek__BackingField = newModelName;
newModel.Typek__BackingField = newModelType;
newModel.Pricek__BackingField = newModelPrice;
newModel.Colork__BackingField = newModelColor;
newModel.IsDiscontinuedk__BackingField = false;
newModel = _service.SaveModel(newModel);
modelsAvailable.Add(newModel);
ResetNewModelFields();
RaisePropertyChanged("ModelsAvailable");
}
示例5: SavingInventoryItemClearsSelectedItemsFields
public void SavingInventoryItemClearsSelectedItemsFields()
{
var athlete = new AthleteDto() { FirstNamek__BackingField = "John", LastNamek__BackingField = "Doe", Inventoryk__BackingField = new List<InventoryItemDto>() };
_inventoryViewModel.MyAthletes = new ObservableCollection<AthleteDto>();
_inventoryViewModel.MyAthletes.Add(athlete);
var eventArea = new EventAreaDto() { EventNamek__BackingField = Constants.POLE_VAULT };
var model = new ModelDto() { ModelNamek__BackingField = "Model name" };
_inventoryViewModel.NewInventorySelectedAthlete = athlete;
_inventoryViewModel.NewInventorySelectedEventArea = eventArea;
_inventoryViewModel.NewInventorySelectedModel = model;
_inventoryViewModel.NewInventoryItemSize = 14;
_inventoryViewModel.NewInventorySelectedSizeIsM = true;
_inventoryViewModel.NewInventorySelectedSizeIsW = false;
_inventoryViewModel.NewInventoryItemWidth = "N";
var inventoryItemDto = new InventoryItemDto() { SerialNumberk__BackingField = 123456, Statusk__BackingField = Constants.IN_STOCK };
_mockAppService.Setup(x => x.SaveInventoryItem(It.IsAny<InventoryItemDto>())).Returns(inventoryItemDto);
_inventoryViewModel.SaveNewInventoryCommand.Execute(null);
Assert.AreEqual(null, _inventoryViewModel.NewInventorySelectedAthlete);
Assert.AreEqual(null, _inventoryViewModel.NewInventorySelectedEventArea);
Assert.AreEqual(null, _inventoryViewModel.NewInventorySelectedModel);
Assert.AreEqual(null, _inventoryViewModel.NewInventoryItemSize);
Assert.AreEqual(true, _inventoryViewModel.NewInventorySelectedSizeIsM);
Assert.AreEqual(false, _inventoryViewModel.NewInventorySelectedSizeIsW);
Assert.AreEqual(String.Empty, _inventoryViewModel.NewInventoryItemWidth);
Assert.AreEqual(-1, _inventoryViewModel.NewInventoryAthleteIndex);
}
示例6: SavingInventoryItemSetsSerialNumberInInventoryLabelModel
public void SavingInventoryItemSetsSerialNumberInInventoryLabelModel()
{
var athlete = new AthleteDto() { FirstNamek__BackingField = "John", LastNamek__BackingField = "Doe", Inventoryk__BackingField = new List<InventoryItemDto>() };
var eventArea = new EventAreaDto() { EventNamek__BackingField = Constants.POLE_VAULT };
var model = new ModelDto() { ModelNamek__BackingField = "Model name" };
_inventoryViewModel.NewInventorySelectedAthlete = athlete;
_inventoryViewModel.NewInventorySelectedEventArea = eventArea;
_inventoryViewModel.NewInventorySelectedModel = model;
_inventoryViewModel.NewInventoryItemSize = 14;
_inventoryViewModel.NewInventorySelectedSizeIsM = true;
_inventoryViewModel.NewInventorySelectedSizeIsW = false;
_inventoryViewModel.NewInventoryItemWidth = "N";
var inventoryItemDto = new InventoryItemDto() { SerialNumberk__BackingField = 123456 };
_mockAppService.Setup(x => x.SaveInventoryItem(It.IsAny<InventoryItemDto>())).Returns(inventoryItemDto);
_inventoryViewModel.SaveNewInventoryCommand.Execute(null);
Assert.AreEqual(inventoryItemDto.SerialNumberk__BackingField.ToString(), _inventoryViewModel.InventoryLabelModel.SerialNumber);
}
示例7: ProcessingMovementDoesNotResetInventoryFilters
public void ProcessingMovementDoesNotResetInventoryFilters()
{
var athlete1 = new AthleteDto() { FirstNamek__BackingField = "Jeff", LastNamek__BackingField = "Artis-Gray", Nicknamek__BackingField = "JArtis-Gray", Genderk__BackingField = 'M', TrainerSizeMk__BackingField = 14, TrainerSizeWk__BackingField = 12, SpikeSizeMk__BackingField = 14, SpikeSizeWk__BackingField = 12, Notesk__BackingField = "Notes about Jeff Artis-Gray", Statusk__BackingField = "Future", Inventoryk__BackingField = new List<InventoryItemDto>() };
var athlete2 = new AthleteDto() { FirstNamek__BackingField = "Darren", LastNamek__BackingField = "Barlow", Nicknamek__BackingField = "DBarlow", Genderk__BackingField = 'M', TrainerSizeMk__BackingField = 14, TrainerSizeWk__BackingField = 12, SpikeSizeMk__BackingField = 14, SpikeSizeWk__BackingField = 12, Notesk__BackingField = "Notes about Darren Barlow", Statusk__BackingField = "Past", Inventoryk__BackingField = new List<InventoryItemDto>() };
var athlete3 = new AthleteDto() { FirstNamek__BackingField = "Jared", LastNamek__BackingField = "Berman", Nicknamek__BackingField = "JBerman", Genderk__BackingField = 'M', TrainerSizeMk__BackingField = 13, TrainerSizeWk__BackingField = 11, SpikeSizeMk__BackingField = 13, SpikeSizeWk__BackingField = 11, Notesk__BackingField = "Notes about Jared Berman", Statusk__BackingField = "Past", Inventoryk__BackingField = new List<InventoryItemDto>() };
var model1 = new ModelDto() { ModelNumberk__BackingField = "524395-386", ModelNamek__BackingField = "Air Pegasus+ 29 Trail", Typek__BackingField = "Running", Pricek__BackingField = 105, Colork__BackingField = "Silver Sage/Team Red/University Red/Total Orange", IsDiscontinuedk__BackingField = false };
var model2 = new ModelDto() { ModelNumberk__BackingField = "524395-038", ModelNamek__BackingField = "Air Pegasus+ 29 Trail", Typek__BackingField = "Running", Pricek__BackingField = 105, Colork__BackingField = "Cool Grey/Total Orange/Signal Blue/Electric Green", IsDiscontinuedk__BackingField = false };
var inventoryItem1 = new InventoryItemDto() { ModelDtok__BackingField = model1, SizeMk__BackingField = 9, SizeWk__BackingField = 7, Widthk__BackingField = "N", AthleteNicknamek__BackingField = athlete1.Nicknamek__BackingField, Statusk__BackingField = Constants.REQUESTED, ReceivedOnk__BackingField = new DateTime(2012, 8, 18, 11, 26, 13).ToShortDateString() };
var inventoryItem2 = new InventoryItemDto() { ModelDtok__BackingField = model1, SizeMk__BackingField = 11, SizeWk__BackingField = 9, Widthk__BackingField = "N", AthleteNicknamek__BackingField = athlete1.Nicknamek__BackingField, Statusk__BackingField = Constants.ORDERED, ReceivedOnk__BackingField = new DateTime(2012, 2, 16, 11, 4, 23).ToShortDateString() };
var inventoryItem3 = new InventoryItemDto() { ModelDtok__BackingField = model1, SizeMk__BackingField = 12, SizeWk__BackingField = 10, Widthk__BackingField = "N", AthleteNicknamek__BackingField = athlete1.Nicknamek__BackingField, Statusk__BackingField = Constants.IN_STOCK, ReceivedOnk__BackingField = new DateTime(2012, 11, 26, 8, 16, 22).ToShortDateString() };
var inventoryItem4 = new InventoryItemDto() { ModelDtok__BackingField = model1, SizeMk__BackingField = 12, SizeWk__BackingField = 10, Widthk__BackingField = "N", AthleteNicknamek__BackingField = athlete2.Nicknamek__BackingField, Statusk__BackingField = Constants.DISTRIBUTED, ReceivedOnk__BackingField = new DateTime(2012, 12, 28, 15, 3, 13).ToShortDateString() };
var inventoryItem5 = new InventoryItemDto() { ModelDtok__BackingField = model1, SizeMk__BackingField = 9, SizeWk__BackingField = 7, Widthk__BackingField = "N", AthleteNicknamek__BackingField = athlete2.Nicknamek__BackingField, Statusk__BackingField = Constants.SURPLUSED, ReceivedOnk__BackingField = new DateTime(2012, 1, 12, 22, 49, 55).ToShortDateString() };
var inventoryItem6 = new InventoryItemDto() { ModelDtok__BackingField = model2, SizeMk__BackingField = 11, SizeWk__BackingField = 9, Widthk__BackingField = "N", AthleteNicknamek__BackingField = athlete2.Nicknamek__BackingField, Statusk__BackingField = Constants.RETURNED, ReceivedOnk__BackingField = new DateTime(2012, 9, 18, 10, 59, 31).ToShortDateString() };
var inventoryItem7 = new InventoryItemDto() { ModelDtok__BackingField = model2, SizeMk__BackingField = 9, SizeWk__BackingField = 7, Widthk__BackingField = "N", AthleteNicknamek__BackingField = athlete3.Nicknamek__BackingField, Statusk__BackingField = Constants.RECALLED, ReceivedOnk__BackingField = new DateTime(2012, 5, 21, 21, 45, 33).ToShortDateString() };
var inventoryItem8 = new InventoryItemDto() { ModelDtok__BackingField = model2, SizeMk__BackingField = 12, SizeWk__BackingField = 10, Widthk__BackingField = "N", AthleteNicknamek__BackingField = athlete3.Nicknamek__BackingField, Statusk__BackingField = Constants.RECORDED_AS_LOST, ReceivedOnk__BackingField = new DateTime(2012, 1, 19, 2, 50, 54).ToShortDateString() };
var inventoryItem9 = new InventoryItemDto() { ModelDtok__BackingField = model2, SizeMk__BackingField = 9, SizeWk__BackingField = 7, Widthk__BackingField = "N", AthleteNicknamek__BackingField = athlete3.Nicknamek__BackingField, Statusk__BackingField = Constants.IN_STOCK, ReceivedOnk__BackingField = new DateTime(2012, 6, 3, 16, 58, 1).ToShortDateString() };
athlete1.Inventoryk__BackingField.Add(inventoryItem1);
athlete1.Inventoryk__BackingField.Add(inventoryItem2);
athlete1.Inventoryk__BackingField.Add(inventoryItem3);
athlete2.Inventoryk__BackingField.Add(inventoryItem4);
athlete2.Inventoryk__BackingField.Add(inventoryItem5);
athlete2.Inventoryk__BackingField.Add(inventoryItem6);
athlete3.Inventoryk__BackingField.Add(inventoryItem7);
athlete3.Inventoryk__BackingField.Add(inventoryItem8);
athlete3.Inventoryk__BackingField.Add(inventoryItem9);
_inventoryViewModel.MyAthletes = new ObservableCollection<AthleteDto>();
_inventoryViewModel.MyAthletes.Add(athlete1);
_inventoryViewModel.MyAthletes.Add(athlete2);
_inventoryViewModel.MyAthletes.Add(athlete3);
_inventoryViewModel.MyInventory.Add(inventoryItem1);
_inventoryViewModel.MyInventory.Add(inventoryItem2);
_inventoryViewModel.MyInventory.Add(inventoryItem3);
_inventoryViewModel.MyInventory.Add(inventoryItem4);
_inventoryViewModel.MyInventory.Add(inventoryItem5);
_inventoryViewModel.MyInventory.Add(inventoryItem6);
_inventoryViewModel.MyInventory.Add(inventoryItem7);
_inventoryViewModel.MyInventory.Add(inventoryItem8);
_inventoryViewModel.MyInventory.Add(inventoryItem9);
_inventoryViewModel.ShowAllInventoryItems = true;
_inventoryViewModel.ShowOnlyDefaultInventoryItems = false;
_inventoryViewModel.FilterInventoryModel.SelectedAthlete = _inventoryViewModel.MyAthletes[0].Nicknamek__BackingField;
_inventoryViewModel.FilterCommand.Execute(null);
Assert.AreEqual(3, _inventoryViewModel.MyInventory.Count);
_inventoryViewModel.SerialNumber = _inventoryViewModel.MyAthletes[0].Inventoryk__BackingField[0].SerialNumberk__BackingField;
_inventoryViewModel.SelectedMovementType = Constants.DISTRIBUTE;
inventoryItem1.Statusk__BackingField = Constants.DISTRIBUTED;
_mockAppService.Setup(x => x.Distribute(It.IsAny<InventoryItemDto>(), It.IsAny<String>())).Returns(inventoryItem1);
_inventoryViewModel.ProcessMovementCommand.Execute(null);
Assert.AreEqual(3, _inventoryViewModel.MyInventory.Count);
}
示例8: SaveNewModelCommand
public void SaveNewModelCommand()
{
_inventoryViewModel.NewModelNumber = "asdfad";
_inventoryViewModel.NewModelName = "dfadsfa";
_inventoryViewModel.SelectedNewModelType = "asdfadf";
_inventoryViewModel.NewModelPrice = 105;
_inventoryViewModel.NewModelColor = "asdfad";
var returnedModel = new ModelDto();
_mockAppService.Setup(x => x.SaveModel(It.IsAny<ModelDto>())).Returns(returnedModel);
_inventoryViewModel.SaveNewModelCommand.Execute(null);
NewModelFieldsAreReset();
Assert.AreEqual(1, _inventoryViewModel.ModelsAvailable.Count);
_mockAppService.VerifyAll();
}
示例9: NewInventoryItemFieldsSetLabelValuesCorrectly
public void NewInventoryItemFieldsSetLabelValuesCorrectly()
{
var athlete = new AthleteDto() { FirstNamek__BackingField = "John", LastNamek__BackingField = "Doe" };
var eventArea = new EventAreaDto() { EventNamek__BackingField = Constants.POLE_VAULT };
var model = new ModelDto() { ModelNamek__BackingField = "Model name" };
_inventoryViewModel.NewInventorySelectedAthlete = athlete;
_inventoryViewModel.NewInventorySelectedEventArea = eventArea;
_inventoryViewModel.NewInventorySelectedModel = model;
_inventoryViewModel.NewInventoryItemSize = 14;
_inventoryViewModel.NewInventorySelectedSizeIsM = true;
_inventoryViewModel.NewInventorySelectedSizeIsW = false;
_inventoryViewModel.NewInventoryItemWidth = "N";
Assert.AreEqual(athlete.FirstNamek__BackingField + " " + athlete.LastNamek__BackingField, _inventoryViewModel.InventoryLabelModel.AthleteFirstAndLastName);
Assert.AreEqual("PV", _inventoryViewModel.InventoryLabelModel.EventAreaAbbreviation);
Assert.AreEqual("M", _inventoryViewModel.InventoryLabelModel.SizingGender);
Assert.AreEqual(_inventoryViewModel.NewInventoryItemSize, _inventoryViewModel.InventoryLabelModel.Size);
Assert.AreEqual("n/a", _inventoryViewModel.InventoryLabelModel.SerialNumber);
Assert.AreEqual(DateTime.Now.ToString("MMM"), _inventoryViewModel.InventoryLabelModel.ReceivedMonth);
Assert.AreEqual(DateTime.Now.Year.ToString(), _inventoryViewModel.InventoryLabelModel.ReceivedYear);
Assert.AreEqual(_inventoryViewModel.NewInventorySelectedModel.ModelNamek__BackingField, _inventoryViewModel.InventoryLabelModel.ModelName);
}
示例10: FilterRemovesAppropriateRowsFromMyInventoryOnEachCallAndResetsAfterClearingFilter
public void FilterRemovesAppropriateRowsFromMyInventoryOnEachCallAndResetsAfterClearingFilter()
{
var athlete1 = new AthleteDto() { FirstNamek__BackingField = "Jeff", LastNamek__BackingField = "Artis-Gray", Nicknamek__BackingField = "JArtis-Gray", Genderk__BackingField = 'M', TrainerSizeMk__BackingField = 14, TrainerSizeWk__BackingField = 12, SpikeSizeMk__BackingField = 14, SpikeSizeWk__BackingField = 12, Notesk__BackingField = "Notes about Jeff Artis-Gray", Statusk__BackingField = "Future", Inventoryk__BackingField = new List<InventoryItemDto>() };
var athlete2 = new AthleteDto() { FirstNamek__BackingField = "Darren", LastNamek__BackingField = "Barlow", Nicknamek__BackingField = "DBarlow", Genderk__BackingField = 'M', TrainerSizeMk__BackingField = 14, TrainerSizeWk__BackingField = 12, SpikeSizeMk__BackingField = 14, SpikeSizeWk__BackingField = 12, Notesk__BackingField = "Notes about Darren Barlow", Statusk__BackingField = "Past", Inventoryk__BackingField = new List<InventoryItemDto>() };
var athlete3 = new AthleteDto() { FirstNamek__BackingField = "Jared", LastNamek__BackingField = "Berman", Nicknamek__BackingField = "JBerman", Genderk__BackingField = 'M', TrainerSizeMk__BackingField = 13, TrainerSizeWk__BackingField = 11, SpikeSizeMk__BackingField = 13, SpikeSizeWk__BackingField = 11, Notesk__BackingField = "Notes about Jared Berman", Statusk__BackingField = "Past", Inventoryk__BackingField = new List<InventoryItemDto>() };
var model1 = new ModelDto() { ModelNumberk__BackingField = "524395-386", ModelNamek__BackingField = "Air Pegasus+ 29 Trail", Typek__BackingField = "Running", Pricek__BackingField = 105, Colork__BackingField = "Silver Sage/Team Red/University Red/Total Orange", IsDiscontinuedk__BackingField = false };
var model2 = new ModelDto() { ModelNumberk__BackingField = "524395-038", ModelNamek__BackingField = "Air Pegasus+ 29 Trail", Typek__BackingField = "Running", Pricek__BackingField = 105, Colork__BackingField = "Cool Grey/Total Orange/Signal Blue/Electric Green", IsDiscontinuedk__BackingField = false };
var inventoryItem1 = new InventoryItemDto() { ModelDtok__BackingField = model1, SizeMk__BackingField = 9, SizeWk__BackingField = 7, Widthk__BackingField = "N", AthleteNicknamek__BackingField = athlete1.Nicknamek__BackingField, Statusk__BackingField = Constants.REQUESTED, ReceivedOnk__BackingField = new DateTime(2012, 8, 18, 11, 26, 13).ToShortDateString() };
var inventoryItem2 = new InventoryItemDto() { ModelDtok__BackingField = model1, SizeMk__BackingField = 11, SizeWk__BackingField = 9, Widthk__BackingField = "N", AthleteNicknamek__BackingField = athlete1.Nicknamek__BackingField, Statusk__BackingField = Constants.ORDERED, ReceivedOnk__BackingField = new DateTime(2012, 2, 16, 11, 4, 23).ToShortDateString() };
var inventoryItem3 = new InventoryItemDto() { ModelDtok__BackingField = model1, SizeMk__BackingField = 12, SizeWk__BackingField = 10, Widthk__BackingField = "N", AthleteNicknamek__BackingField = athlete1.Nicknamek__BackingField, Statusk__BackingField = Constants.IN_STOCK, ReceivedOnk__BackingField = new DateTime(2012, 11, 26, 8, 16, 22).ToShortDateString() };
var inventoryItem4 = new InventoryItemDto() { ModelDtok__BackingField = model1, SizeMk__BackingField = 12, SizeWk__BackingField = 10, Widthk__BackingField = "N", AthleteNicknamek__BackingField = athlete2.Nicknamek__BackingField, Statusk__BackingField = Constants.DISTRIBUTED, ReceivedOnk__BackingField = new DateTime(2012, 12, 28, 15, 3, 13).ToShortDateString() };
var inventoryItem5 = new InventoryItemDto() { ModelDtok__BackingField = model1, SizeMk__BackingField = 9, SizeWk__BackingField = 7, Widthk__BackingField = "N", AthleteNicknamek__BackingField = athlete2.Nicknamek__BackingField, Statusk__BackingField = Constants.SURPLUSED, ReceivedOnk__BackingField = new DateTime(2012, 1, 12, 22, 49, 55).ToShortDateString() };
var inventoryItem6 = new InventoryItemDto() { ModelDtok__BackingField = model2, SizeMk__BackingField = 11, SizeWk__BackingField = 9, Widthk__BackingField = "N", AthleteNicknamek__BackingField = athlete2.Nicknamek__BackingField, Statusk__BackingField = Constants.RETURNED, ReceivedOnk__BackingField = new DateTime(2012, 9, 18, 10, 59, 31).ToShortDateString() };
var inventoryItem7 = new InventoryItemDto() { ModelDtok__BackingField = model2, SizeMk__BackingField = 9, SizeWk__BackingField = 7, Widthk__BackingField = "N", AthleteNicknamek__BackingField = athlete3.Nicknamek__BackingField, Statusk__BackingField = Constants.RECALLED, ReceivedOnk__BackingField = new DateTime(2012, 5, 21, 21, 45, 33).ToShortDateString() };
var inventoryItem8 = new InventoryItemDto() { ModelDtok__BackingField = model2, SizeMk__BackingField = 12, SizeWk__BackingField = 10, Widthk__BackingField = "N", AthleteNicknamek__BackingField = athlete3.Nicknamek__BackingField, Statusk__BackingField = Constants.RECORDED_AS_LOST, ReceivedOnk__BackingField = new DateTime(2012, 1, 19, 2, 50, 54).ToShortDateString() };
var inventoryItem9 = new InventoryItemDto() { ModelDtok__BackingField = model2, SizeMk__BackingField = 9, SizeWk__BackingField = 7, Widthk__BackingField = "N", AthleteNicknamek__BackingField = athlete3.Nicknamek__BackingField, Statusk__BackingField = Constants.IN_STOCK, ReceivedOnk__BackingField = new DateTime(2012, 6, 3, 16, 58, 1).ToShortDateString() };
athlete1.Inventoryk__BackingField.Add(inventoryItem1);
athlete1.Inventoryk__BackingField.Add(inventoryItem2);
athlete1.Inventoryk__BackingField.Add(inventoryItem3);
athlete2.Inventoryk__BackingField.Add(inventoryItem4);
athlete2.Inventoryk__BackingField.Add(inventoryItem5);
athlete2.Inventoryk__BackingField.Add(inventoryItem6);
athlete3.Inventoryk__BackingField.Add(inventoryItem7);
athlete3.Inventoryk__BackingField.Add(inventoryItem8);
athlete3.Inventoryk__BackingField.Add(inventoryItem9);
_inventoryViewModel.MyAthletes = new ObservableCollection<AthleteDto>();
_inventoryViewModel.MyAthletes.Add(athlete1);
_inventoryViewModel.MyAthletes.Add(athlete2);
_inventoryViewModel.MyAthletes.Add(athlete3);
_inventoryViewModel.MyInventory.Add(inventoryItem1);
_inventoryViewModel.MyInventory.Add(inventoryItem2);
_inventoryViewModel.MyInventory.Add(inventoryItem3);
_inventoryViewModel.MyInventory.Add(inventoryItem4);
_inventoryViewModel.MyInventory.Add(inventoryItem5);
_inventoryViewModel.MyInventory.Add(inventoryItem6);
_inventoryViewModel.MyInventory.Add(inventoryItem7);
_inventoryViewModel.MyInventory.Add(inventoryItem8);
_inventoryViewModel.MyInventory.Add(inventoryItem9);
_inventoryViewModel.ShowAllInventoryItems = true;
_inventoryViewModel.ShowOnlyDefaultInventoryItems = false;
Assert.AreEqual(9, _inventoryViewModel.MyInventory.Count);
Assert.AreEqual(9, _inventoryViewModel.MyInventoryToShow.Count);
Assert.AreEqual(3, _inventoryViewModel.FilterInventoryModel.Athletes.Count);
Assert.IsTrue(_inventoryViewModel.FilterInventoryModel.Athletes.Contains(athlete1.Nicknamek__BackingField));
Assert.IsTrue(_inventoryViewModel.FilterInventoryModel.Athletes.Contains(athlete2.Nicknamek__BackingField));
Assert.IsTrue(_inventoryViewModel.FilterInventoryModel.Athletes.Contains(athlete3.Nicknamek__BackingField));
Assert.AreEqual(8, _inventoryViewModel.FilterInventoryModel.Statuses.Count);
Assert.IsTrue(_inventoryViewModel.FilterInventoryModel.Statuses.Contains(Constants.REQUESTED));
Assert.IsTrue(_inventoryViewModel.FilterInventoryModel.Statuses.Contains(Constants.ORDERED));
Assert.IsTrue(_inventoryViewModel.FilterInventoryModel.Statuses.Contains(Constants.IN_STOCK));
Assert.IsTrue(_inventoryViewModel.FilterInventoryModel.Statuses.Contains(Constants.DISTRIBUTED));
Assert.IsTrue(_inventoryViewModel.FilterInventoryModel.Statuses.Contains(Constants.SURPLUSED));
Assert.IsTrue(_inventoryViewModel.FilterInventoryModel.Statuses.Contains(Constants.RETURNED));
Assert.IsTrue(_inventoryViewModel.FilterInventoryModel.Statuses.Contains(Constants.RECALLED));
Assert.IsTrue(_inventoryViewModel.FilterInventoryModel.Statuses.Contains(Constants.RECORDED_AS_LOST));
Assert.AreEqual(1, _inventoryViewModel.FilterInventoryModel.ModelNames.Count);
Assert.IsTrue(_inventoryViewModel.FilterInventoryModel.ModelNames.Contains(model1.ModelNamek__BackingField));
Assert.AreEqual(2, _inventoryViewModel.FilterInventoryModel.ModelNumbers.Count);
Assert.IsTrue(_inventoryViewModel.FilterInventoryModel.ModelNumbers.Contains(model1.ModelNumberk__BackingField));
Assert.AreEqual(3, _inventoryViewModel.FilterInventoryModel.SizeMs.Count);
Assert.IsTrue(_inventoryViewModel.FilterInventoryModel.SizeMs.Contains("9"));
Assert.IsTrue(_inventoryViewModel.FilterInventoryModel.SizeMs.Contains("11"));
Assert.IsTrue(_inventoryViewModel.FilterInventoryModel.SizeMs.Contains("12"));
Assert.AreEqual(3, _inventoryViewModel.FilterInventoryModel.SizeWs.Count);
Assert.IsTrue(_inventoryViewModel.FilterInventoryModel.SizeWs.Contains("7"));
Assert.IsTrue(_inventoryViewModel.FilterInventoryModel.SizeWs.Contains("9"));
Assert.IsTrue(_inventoryViewModel.FilterInventoryModel.SizeWs.Contains("10"));
Assert.AreEqual(1, _inventoryViewModel.FilterInventoryModel.Widths.Count);
Assert.IsTrue(_inventoryViewModel.FilterInventoryModel.Widths.Contains("N"));
Assert.AreEqual(9, _inventoryViewModel.FilterInventoryModel.ReceivedOns.Count);
Assert.IsTrue(_inventoryViewModel.FilterInventoryModel.ReceivedOns.Contains(inventoryItem1.ReceivedOnk__BackingField));
Assert.IsTrue(_inventoryViewModel.FilterInventoryModel.ReceivedOns.Contains(inventoryItem2.ReceivedOnk__BackingField));
Assert.IsTrue(_inventoryViewModel.FilterInventoryModel.ReceivedOns.Contains(inventoryItem3.ReceivedOnk__BackingField));
Assert.IsTrue(_inventoryViewModel.FilterInventoryModel.ReceivedOns.Contains(inventoryItem4.ReceivedOnk__BackingField));
Assert.IsTrue(_inventoryViewModel.FilterInventoryModel.ReceivedOns.Contains(inventoryItem5.ReceivedOnk__BackingField));
Assert.IsTrue(_inventoryViewModel.FilterInventoryModel.ReceivedOns.Contains(inventoryItem6.ReceivedOnk__BackingField));
Assert.IsTrue(_inventoryViewModel.FilterInventoryModel.ReceivedOns.Contains(inventoryItem7.ReceivedOnk__BackingField));
Assert.IsTrue(_inventoryViewModel.FilterInventoryModel.ReceivedOns.Contains(inventoryItem8.ReceivedOnk__BackingField));
Assert.IsTrue(_inventoryViewModel.FilterInventoryModel.ReceivedOns.Contains(inventoryItem9.ReceivedOnk__BackingField));
_inventoryViewModel.FilterInventoryModel.SelectedAthlete = athlete1.Nicknamek__BackingField;
_inventoryViewModel.FilterCommand.Execute(null);
Assert.AreEqual(3, _inventoryViewModel.MyInventory.Count);
Assert.AreEqual(1, _inventoryViewModel.FilterInventoryModel.Athletes.Count);
//.........这里部分代码省略.........
示例11: InventoryViewModel
public InventoryViewModel(IApplicationService service, ILabelPrinter labelPrinter)
{
this._service = service;
this._labelPrinter = labelPrinter;
myInventory = new ObservableCollection<InventoryItemDto>();
myInventoryBackup = new ObservableCollection<InventoryItemDto>();
movementTypes = new ObservableCollection<String>(Constants.MOVEMENT_TYPES);
modelsAvailable = new ObservableCollection<ModelDto>(GetModelsAvailable());
totalsByStatusModel = new TotalByStatusModel();
filterInventoryModel = new FilterInventoryModel();
inventoryLabelModel = new InventoryLabelModel();
showAllInventoryItems = false;
showOnlyDefaultInventoryItems = true;
isAdmin = userDto == null ? false : userDto.IsAdmin;
newInventorySelectedSizeIsM = true;
newInventorySelectedSizeIsW = false;
myInventoryIsVisible = VISIBLE;
newItemEntryIsVisible = HIDDEN;
newInventoryAthleteIndex = -1;
newInventorySelectedAthlete = new AthleteDto();
newInventorySelectedModel = new ModelDto();
ProcessMovementCommand = new RelayCommand(ProcessInventoryMovement);
FilterCommand = new RelayCommand(FilterInventory);
ClearFilterCommand = new RelayCommand(ResetMyInventory);
ShowNewInventoryEntryCommand = new RelayCommand(ShowNewInventoryEntry);
SaveNewInventoryCommand = new RelayCommand(SaveNewInventoryItem);
ShowMyInventoryCommand = new RelayCommand(ShowMyInventory);
ClearInventoryItemEntryFieldsCommand = new RelayCommand(ResetNewInventoryEntryFields);
SaveNewModelCommand = new RelayCommand(SaveNewModel);
ClearNewModelFields = new RelayCommand(ResetNewModelFields);
DistributeItemCommand = new RelayCommand<InventoryItemDto>(itemToDistribute => DistributeItem(itemToDistribute));
ReturnItemToVendorCommand = new RelayCommand<InventoryItemDto>(itemToDistribute => DistributeItem(itemToDistribute));
ReturnToStockCommand = new RelayCommand<InventoryItemDto>(itemToDistribute => DistributeItem(itemToDistribute));
SurplusItemCommand = new RelayCommand<InventoryItemDto>(itemToDistribute => DistributeItem(itemToDistribute));
RecallItemCommand = new RelayCommand<InventoryItemDto>(itemToDistribute => DistributeItem(itemToDistribute));
RecordItemAsLostCommand = new RelayCommand<InventoryItemDto>(itemToDistribute => DistributeItem(itemToDistribute));
PrintInventoryLabelCommand = new RelayCommand<InventoryItemDto>(itemToPrint => PrintInventoryLabel(itemToPrint));
AssignInventoryItemToAnotherAthleteCommand = new RelayCommand<InventoryItemDto>(itemToReassign => AssignInventoryItemToAnotherAthlete(itemToReassign));
ShowInventoryItemHistoryCommand = new RelayCommand<InventoryItemDto>(itemWithHistory => ShowInventoryItemHistory(itemWithHistory));
Messenger.Default.Register<UserDto>(
this,
(u) => UpdateUser(u)
);
Messenger.Default.Register<ObservableCollection<AthleteDto>>(
this,
(a) => MyAthletes = a
);
}
示例12: Should_always_provide_a_dto
public void Should_always_provide_a_dto()
{
_result = Mapper.Map<ModelObject, ModelDto>(null);
_result.ShouldNotBeNull();
}
示例13: SizeWsListIsSortedNaturallyByDoubleValue
public void SizeWsListIsSortedNaturallyByDoubleValue()
{
var model = new ModelDto();
_inventoryViewModel.MyInventory = new ObservableCollection<InventoryItemDto>()
{
new InventoryItemDto() { ModelDtok__BackingField = model, SizeMk__BackingField = 9, SizeWk__BackingField = 11 },
new InventoryItemDto() { ModelDtok__BackingField = model, SizeMk__BackingField = 7, SizeWk__BackingField = 9 },
new InventoryItemDto() { ModelDtok__BackingField = model, SizeMk__BackingField = 14, SizeWk__BackingField = 16 },
new InventoryItemDto() { ModelDtok__BackingField = model, SizeMk__BackingField = 8, SizeWk__BackingField = 10 },
new InventoryItemDto() { ModelDtok__BackingField = model, SizeMk__BackingField = 8, SizeWk__BackingField = 10 },
new InventoryItemDto() { ModelDtok__BackingField = model, SizeMk__BackingField = 10, SizeWk__BackingField = 12 },
new InventoryItemDto() { ModelDtok__BackingField = model, SizeMk__BackingField = 6, SizeWk__BackingField = 8 },
new InventoryItemDto() { ModelDtok__BackingField = model, SizeMk__BackingField = 9, SizeWk__BackingField = 11 },
};
Assert.AreEqual("8", _inventoryViewModel.FilterInventoryModel.SizeWs[0]);
Assert.AreEqual("9", _inventoryViewModel.FilterInventoryModel.SizeWs[1]);
Assert.AreEqual("10", _inventoryViewModel.FilterInventoryModel.SizeWs[2]);
Assert.AreEqual("11", _inventoryViewModel.FilterInventoryModel.SizeWs[3]);
Assert.AreEqual("12", _inventoryViewModel.FilterInventoryModel.SizeWs[4]);
Assert.AreEqual("16", _inventoryViewModel.FilterInventoryModel.SizeWs[5]);
}
示例14: Establish_context
protected override void Establish_context()
{
Mapper.CreateMap<Model, ModelDto>();
Mapper.CreateMap<Item, ItemDto>();
Mapper.CreateMap<SubItem, SubItemDto>();
var model = new Model
{
Items = new List<Item>
{
new SubItem
{
Prop = "value1",
SubProp = "value2"
}
}
};
_result = Mapper.Map<Model, ModelDto>(model);
}