示例#1
0
        public void ToLoadThisObject_CreateObjBasedStringFixedLayoutWithObjectProperty()
        {
            bool   _expectedValue = true;
            var    _actual        = new DTO.OrderDTO();
            string _concatedValue = "123     31/08/2019Product number 1                                  1,12      51   Category Description 1   Any note                                                                   ";

            _actual.ToLoadThisObject(_concatedValue);

            _expectedValue = (_actual.OrderId == 123) &&
                             (_actual.CreateDate == Convert.ToDateTime("31/08/2019")) &&
                             (_actual.Notes == "Any note") &&
                             (_actual.Product.Name == "Product number 1") &&
                             (_actual.Product.Price == 1.12M) &&
                             (_actual.Product.IdCategory == 51) &&
                             (_actual.Product.CategoryDescription == "Category Description 1");


            Assert.True(_expectedValue);
        }
示例#2
0
        public void ToConcatString_ReturnsWithFixedLayoutWithObjectProperty()
        {
            var    _order        = new DTO.OrderDTO();
            string _expectedDate = DateTime.Now.ToShortDateString();

            _order.OrderId    = 123;
            _order.CreateDate = DateTime.Now;
            _order.Notes      = "Any note";

            var _prd1 = new DTO.ProductDTO();

            _prd1.Name                = "Product number 1";
            _prd1.Price               = 1.12M;
            _prd1.IdCategory          = 51;
            _prd1.CategoryDescription = "Category Description 1";

            _order.Product = _prd1;


            var    _actual        = _order.ToConcatString();
            string _expectedValue = "123     " + _expectedDate + "Product number 1                                  1,12      51   Category Description 1   Any note                                                                   ";

            Assert.Equal(_expectedValue, _actual);
        }