Ejemplo n.º 1
0
        public void TestOrderApproved()
        {
            #region Arrange
            var users = new List <User>();
            for (int i = 0; i < 3; i++)
            {
                users.Add(CreateValidEntities.User(i + 1));
                users[i].SetIdTo((i + 1).ToString(CultureInfo.InvariantCulture));
            }
            new FakeUsers(0, UserRepository, users, true);

            var order    = CreateValidEntities.Order(1);
            var approval = CreateValidEntities.Approval(1);
            approval.User       = UserRepository.Queryable.Single(a => a.Id == "3");
            approval.StatusCode = CreateValidEntities.OrderStatusCode(4);
            UserIdentity.Expect(a => a.Current).Return("2");
            #endregion Arrange

            #region Act
            EventService.OrderApproved(order, approval);
            #endregion Act

            #region Assert
            NotificationService.AssertWasCalled(a => a.OrderApproved(order, approval));
            Assert.AreEqual(1, order.OrderTrackings.Count());
            Assert.AreEqual("FirstName2 LastName2", order.OrderTrackings[0].User.FullName);
            Assert.AreEqual("Name4", order.OrderTrackings[0].StatusCode.Name);
            Assert.AreEqual("approved", order.OrderTrackings[0].Description);
            #endregion Assert
        }
Ejemplo n.º 2
0
 protected void ExpectGetUserId()
 {
     UserIdentity.Expect(a => a.GetUserId(Arg <Controller> .Is.Anything)).Return(TestUserId);
 }