Example #1
0
        public async Task ShouldCallCreateMethodOnRepository()
        {
            var command = new CreateMrGreenUser()
            {
                FirstName      = "Test",
                LastName       = "Test",
                Street         = "Test",
                BuildingNumber = 10,
                PersonalNumber = "11111-111",
                ZipCode        = "32-111",
            };

            await SendAsync(command);

            MockMrGreenRepository.Verify(repository => repository.AddAsync(It.IsAny <MrGreenUser>()), Times.Once);
        }
        public async Task ShouldCallUpdateMethodOnRepository()
        {
            var id      = Guid.NewGuid();
            var command = new UpdateMrGreenUser
            {
                Id             = id,
                FirstName      = "Test",
                LastName       = "Test",
                Street         = "Test",
                BuildingNumber = 10,
                PersonalNumber = "11111-111",
                ZipCode        = "32-111"
            };

            SetMrGreenRepositoryGetResult(id, new MrGreenUser(id, new BasicUserInformation("Test", "Test", new Address("Street", 10, "32-091")), new PersonalNumber("11111-111")));
            await SendAsync(command);

            MockMrGreenRepository.Verify(repository => repository.UpdateAsync(It.IsAny <MrGreenUser>()), Times.Once);
        }