Example #1
0
        public void GetAddressesByReceiverId_works_Properly()
        {
            string errorMessagePrefix = "ReceiverService GetAddressesByReceiverId() method does not work properly.";

            var context = OilsProDbContextInMemoryFactory.InitializeContext();

            this.receiverService = new ReceiverService(context);
            var receiver = new Receiver
            {
                Name = "Receiver1",
                DeliveryAddresses = new List <DeliveryAddress>
                {
                    new DeliveryAddress
                    {
                        Town   = "Town1",
                        Street = "Street1",
                    },
                    new DeliveryAddress
                    {
                        Town   = "Town2",
                        Street = "Street2",
                    },
                }
            };

            context.Receivers.Add(receiver);
            context.SaveChanges();

            var result = receiverService.GetAddressesByReceiverId(receiver.Id);

            Assert.True(result.Count == 2);
        }
Example #2
0
        public IActionResult Details(string id)
        {
            var model = _receiversService.GetAddressesByReceiverId(id);

            ViewBag.ReceiverId = id;

            return(this.View("Components/ReceiversAddresses/Default", model));
        }