示例#1
0
        public void ListAlterations_Succesfully_Calling_Repository_MustSucceed()
        {
            //Arrange
            var repository          = A.Fake <IAlterationRepository>();
            var notificationContext = A.Fake <INotificationContext>();
            var alterationService   = new AlterationService(repository, notificationContext);

            //Act
            var ret = alterationService.ListAsync();

            //Assert
            Assert.NotNull(ret);
        }
示例#2
0
        public void Invalid_Alteration_Updating_Must_Not_Call_Repository()
        {
            //Arrange
            var repository          = A.Fake <IAlterationRepository>();
            var notificationContext = A.Fake <INotificationContext>();
            var rightShortenValue   = new ShortenValue(Constants.INVALID_SHORTENVALUE);
            var leftShortenValue    = new ShortenValue(Constants.VALID_SHORTENVALUE);
            var alteration          = new Alteration(Constants.VALID_CUSTOMERID, SuitType.Jacket, rightShortenValue, leftShortenValue);
            var alterationService   = new AlterationService(repository, notificationContext);

            //Act
            var ret = alterationService.CreateAlterationAsync(alteration);

            //Assert
            A.CallTo(() => repository.UpdateAsync(alteration)).MustNotHaveHappened();
        }
示例#3
0
        public void Order_Alteration_Succesfully_Calling_Repository_MustSucceed()
        {
            //Arrange
            var repository          = A.Fake <IAlterationRepository>();
            var notificationContext = A.Fake <INotificationContext>();
            var rightShortenValue   = new ShortenValue(Constants.VALID_SHORTENVALUE);
            var leftShortenValue    = new ShortenValue(Constants.VALID_SHORTENVALUE);
            var alteration          = new Alteration(Constants.VALID_CUSTOMERID, SuitType.Jacket, rightShortenValue, leftShortenValue);
            var alterationService   = new AlterationService(repository, notificationContext);

            //Act
            var ret = alterationService.CreateAlterationAsync(alteration);

            //Assert
            Assert.NotNull(ret);
        }
示例#4
0
        public async void Order_Done_MovingToNextstatus_Must_Throws_Exception()
        {
            //Arrange
            var repository          = A.Fake <IAlterationRepository>();
            var notificationContext = A.Fake <INotificationContext>();
            var rightShortenValue   = new ShortenValue(Constants.VALID_SHORTENVALUE);
            var leftShortenValue    = new ShortenValue(Constants.VALID_SHORTENVALUE);
            var alteration          = new Alteration(Guid.Parse(Constants.VALID_GUIDVALUE), Constants.VALID_CUSTOMERID, SuitType.Jacket, rightShortenValue, leftShortenValue);

            alteration.MoveToNextStatus();
            alteration.MoveToNextStatus();
            A.CallTo(() => repository.GetAsync(Guid.Parse(Constants.VALID_GUIDVALUE))).Returns(alteration);
            var alterationService = new AlterationService(repository, notificationContext);

            //Act & Assert
            await Assert.ThrowsAsync <DomainException>(async() => await alterationService.MoveToTheNextStatusAsync(alteration.Id));
        }