public void UnMapItem_Test() { PaulsUsedGoods.Domain.Model.Item itemDomain = new PaulsUsedGoods.Domain.Model.Item(); itemDomain.Id = 1; itemDomain.StoreId = 1; itemDomain.OrderId = null; itemDomain.SellerId = 1; itemDomain.TopicId = 1; itemDomain.Name = "TestObjectName"; itemDomain.Description = "TestObjectDescription"; itemDomain.Price = 10.00; PaulsUsedGoods.DataAccess.Context.Item result = Mapper.UnMapItem(itemDomain); PaulsUsedGoods.DataAccess.Context.Item predictedResult = new PaulsUsedGoods.DataAccess.Context.Item { ItemId = itemDomain.Id, ItemName = itemDomain.Name, ItemDescription = itemDomain.Description, ItemPrice = itemDomain.Price, StoreId = itemDomain.StoreId, OrderId = itemDomain.OrderId, SellerId = itemDomain.SellerId, TopicId = itemDomain.TopicId }; Assert.True(EqualContextItemTest(result, predictedResult)); }
public void MapItem_Test() { PaulsUsedGoods.DataAccess.Context.Item itemContext = new PaulsUsedGoods.DataAccess.Context.Item(); itemContext.ItemId = 1; itemContext.StoreId = 1; itemContext.OrderId = null; itemContext.SellerId = 1; itemContext.TopicId = 1; itemContext.ItemName = "TestObjectName"; itemContext.ItemDescription = "TestObjectDescription"; itemContext.ItemPrice = 10.00; PaulsUsedGoods.Domain.Model.Item result = Mapper.MapItem(itemContext); PaulsUsedGoods.Domain.Model.Item predictedResult = new PaulsUsedGoods.Domain.Model.Item { Id = itemContext.ItemId, Name = itemContext.ItemName, Description = itemContext.ItemDescription, Price = itemContext.ItemPrice, StoreId = itemContext.StoreId, OrderId = itemContext.OrderId, SellerId = itemContext.SellerId, TopicId = itemContext.TopicId }; Assert.True(EqualDomainItemTest(predictedResult, result)); }
private bool EqualDomainItemTest(PaulsUsedGoods.Domain.Model.Item predict, PaulsUsedGoods.Domain.Model.Item result) { if (predict.Id != result.Id || predict.Name != result.Name || predict.Description != result.Description || predict.Price != result.Price || predict.StoreId != result.StoreId || predict.OrderId != result.OrderId || predict.SellerId != result.SellerId || predict.TopicId != result.TopicId ) { return(false); } return(true); }