Beispiel #1
0
        public void MapFromDomainEntity_NullContent_ReturnNull()
        {
            //Act
            var response = CapitalOrExpense.MapFromDomainEntity(null);

            //Assert
            Assert.IsNull(response);
        }
        public static CapitalOrExpenseDTO MapFromDatabaseEntity(CapitalOrExpense capitalOrExpense)
        {
            if (capitalOrExpense == null)
            {
                return(null);
            }

            return(new CapitalOrExpenseDTO()
            {
                Id = capitalOrExpense.Id,
                Value = capitalOrExpense.Value,
                Position = capitalOrExpense.Position
            });
        }
Beispiel #3
0
        public void MapFromDomainEntity_ValidEntity_ReturnDTOEntity()
        {
            //Arrange
            var capitalOrExpense = new CapitalOrExpenseDTO()
            {
                Id       = Guid.NewGuid(),
                Value    = "Capital",
                Position = 0
            };
            var response = CapitalOrExpense.MapFromDomainEntity(capitalOrExpense);

            Assert.IsNotNull(response);
            Assert.AreEqual(capitalOrExpense.Id, response.Id);
            Assert.AreEqual(capitalOrExpense.Value, response.Value);
            Assert.AreEqual(capitalOrExpense.Position, response.Position);
        }
        private static void SeedCapitalOrExpense(CapRedV2Context context)
        {
            if (context.CapitalOrExpenses.Any())
            {
                return;
            }
            string[] capitalOrExpenses = { "Capital", "Expense" };

            for (int i = 0; i < capitalOrExpenses.Length; i++)
            {
                var capitalOrExpense = new CapitalOrExpense {
                    Id = Guid.NewGuid(), Position = i, Value = capitalOrExpenses[i]
                };
                context.CapitalOrExpenses.Add(capitalOrExpense);
            }
        }