예제 #1
0
        public void AddAttachments_ThenDeleteAttachments_AttachmentsChangedSuccessfully()
        {
            //Arrange
            var applicationDraft = DraftApplicationFactory.CreateValid();

            var applicationDraftAttachments = this._testFixture.CreateAttachments(2);

            //Act
            applicationDraft.AddAttachments(applicationDraftAttachments);
            applicationDraft.DeleteAttachments(new List <StorageId> {
                applicationDraftAttachments.First().StorageId
            }
                                               .AsEnumerable());

            //Assert
            var attachmentsAddedEvent   = AssertPublishedDomainEvent <DraftApplicationAttachmentsAdded>(applicationDraft);
            var attachmentsDeletedEvent =
                AssertPublishedDomainEvent <DraftApplicationAttachmentsDeleted>(applicationDraft);

            Assert.NotNull(attachmentsAddedEvent);
            Assert.NotNull(attachmentsDeletedEvent);

            Assert.AreEqual(2, attachmentsAddedEvent.AddedAttachments.Count());
            Assert.AreEqual(1, attachmentsDeletedEvent.DeletedAttachments.Count());
            Assert.AreEqual(1, applicationDraft.Attachments.Count());
        }
예제 #2
0
        public void AllFieldsAreFilled_CreatedSuccessfully()
        {
            var applicationDraft = DraftApplicationFactory.CreateValid();

            var draftCreated = AssertPublishedDomainEvent <DraftApplicationCreated>(applicationDraft);

            Assert.NotNull(draftCreated);
        }
예제 #3
0
        public void AddAttachments_AddedSuccessfully()
        {
            //Arrange
            var applicationDraft = DraftApplicationFactory.CreateValid();

            //Act
            applicationDraft.AddAttachments(this._testFixture.CreateAttachments(2));

            //Assert
            var attachmentsAddedEvent = AssertPublishedDomainEvent <DraftApplicationAttachmentsAdded>(applicationDraft);

            Assert.NotNull(attachmentsAddedEvent);
            Assert.AreEqual(2, applicationDraft.Attachments.Count());
        }