public async Task Handle_ShouldPersistWeddingDescription()
        {
            var command = new CreateWeddingDescriptionCommand
            {
                GroomDescription          = "Test GroomDescription",
                BrideDescription          = "Test BrideDescription",
                CeremonyDateTimeLocation  = "Test CeremonyDateTimeLocation",
                CeremonyDescription       = "Test CeremonyDescription",
                ReceptionDateTimeLocation = "Test ReceptionDateTimeLocation",
                ReceptionDescription      = "Test ReceptionDescription"
            };

            var handler = new CreateWeddingDescriptionCommand.CreateWeddingDescriptionCommandHandler(Context);

            var result = await handler.Handle(command, CancellationToken.None);

            var entity = Context.WeddingDescriptions.Find(result);

            entity.ShouldNotBeNull();
            entity.GroomDescription.ShouldBe(command.GroomDescription);
            entity.BrideDescription.ShouldBe(command.BrideDescription);
            entity.CeremonyDateTimeLocation.ShouldBe(command.CeremonyDateTimeLocation);
            entity.CeremonyDescription.ShouldBe(command.CeremonyDescription);
            entity.ReceptionDateTimeLocation.ShouldBe(command.ReceptionDateTimeLocation);
            entity.ReceptionDescription.ShouldBe(command.ReceptionDescription);
        }
Esempio n. 2
0
        public void IsValid_ShouldBeFalse_WhenRequiredFieldsAreNotSet()
        {
            var command = new CreateWeddingDescriptionCommand();

            var validator = new CreateWeddingDescriptionCommandValidator(Context);

            var result = validator.Validate(command);

            result.IsValid.ShouldBe(false);
        }
Esempio n. 3
0
        public void IsValid_ShouldBeTrue_WhenRequiredFieldsAreSet()
        {
            var command = new CreateWeddingDescriptionCommand
            {
                GroomDescription          = "test",
                BrideDescription          = "test",
                CeremonyDateTimeLocation  = "test",
                CeremonyDescription       = "test",
                ReceptionDateTimeLocation = "test",
                ReceptionDescription      = "test"
            };

            var validator = new CreateWeddingDescriptionCommandValidator(Context);

            var result = validator.Validate(command);

            result.IsValid.ShouldBe(true);
        }
Esempio n. 4
0
        public async Task GivenValidCreateWeddingDescriptionCommand_ReturnsSuccessCode()
        {
            var client = await _factory.GetAuthenticatedClientAsync();

            var command = new CreateWeddingDescriptionCommand
            {
                GroomDescription = "Test",
                BrideDescription = "Test",
                CeremonyDateTimeLocation = "Test",
                CeremonyDescription = "Test",
                ReceptionDateTimeLocation = "Test",
                ReceptionDescription = "Test",
            };

            var content = IntegrationTestHelper.GetRequestContent(command);

            var response = await client.PostAsync($"/api/WeddingDescription", content);

            response.EnsureSuccessStatusCode();
        }
 public async Task <ActionResult <long> > Create(CreateWeddingDescriptionCommand command)
 {
     return(await Mediator.Send(command));
 }