Ejemplo n.º 1
0
        public void ShouldHaveModifiedEvent()
        {
            // Arrange
            Guid   expectedId     = Guid.NewGuid();
            string expectedName   = "ModifiedName";
            string expectedSymbol = "ModifiedSymbol";

            ExpenseType actual = ExpenseType.Create(expectedId, Guid.NewGuid(), "Name",
                                                    "Symbol");

            actual.FlushUncommitedEvents();

            // Act
            actual.Modify(expectedName, expectedSymbol, 1);

            // Assert
            Assert.IsTrue(actual.Events != null);
            Assert.IsTrue(actual.Events.Count == 1);
            var events = actual.FlushUncommitedEvents();

            Assert.IsTrue(events != null);
            Assert.IsTrue(events.Length == 1);
            Assert.IsTrue(events[0] is ExpenseTypeModifiedEvent);
            ExpenseTypeModifiedEvent @event = events[0] as ExpenseTypeModifiedEvent;

            Assert.IsTrue(@event.EntityId == expectedId);
            Assert.IsTrue(@event.Name == expectedName);
            Assert.IsTrue(@event.Symbol == expectedSymbol);
        }
Ejemplo n.º 2
0
        public void ShouldModifyModel()
        {
            // Arrange
            Guid   expectedId     = Guid.NewGuid();
            Guid   expectedUserId = Guid.NewGuid();
            string expectedName   = "ModifiedName";
            string expectedSymbol = "ModifiedSymbol";

            ExpenseType actual = ExpenseType.Create(expectedId, expectedUserId, "Name",
                                                    "Symbol");

            // Act
            actual.Modify(expectedName, expectedSymbol, 1);

            // Assert
            Assert.IsTrue(actual.Id == expectedId);
            Assert.IsTrue(actual.Name == expectedName);
            Assert.IsTrue(actual.Symbol == expectedSymbol);
            Assert.IsTrue(!string.IsNullOrEmpty(actual.SearchValue));
        }