示例#1
0
        public async Task CreateDroid_WithNameAlreadyExists_ReturnsDroidConflictNameExceptionAsync()
        {
            // Arrange
            var exception = await Record.ExceptionAsync(() => Droid.CreateNewAsync(_nameAlreadyExists, _starWarsQuote, _encrypt.Encrypt, _createDroid)).ConfigureAwait(false);

            // Assert
            exception.Should().BeOfType <DroidConflictNameException>();
        }
示例#2
0
        public async Task AddArmDroid_ArmCreatedSuccessfullyAsync()
        {
            // Act
            var droid = await Droid.CreateNewAsync(_nameNotAlreadyExists, _starWarsQuote, _encrypt.Encrypt, _createDroid).ConfigureAwait(false);

            droid.AddArm();

            // Assert
            droid.Arms.Should().HaveCount(1);
        }
示例#3
0
        public async Task UpdateDroid_WithNamesSet_ReturnsDroidUpdatedSetAsync()
        {
            // Act
            var droid = await Droid.CreateNewAsync(_nameNotAlreadyExists, _starWarsQuote, _encrypt.Encrypt, _createDroid).ConfigureAwait(false);

            droid = await droid.UpdateAsync(_nameNotAlreadyExists, _updateDroid).ConfigureAwait(false);

            // Assert
            droid.Name.Should().Be(_updateDroid.Name);
            droid.Nickname.Should().Be(_updateDroid.Nickname);
        }
示例#4
0
        public async Task CreateDroid_WithNoArmAndNamesSet_ReturnsDroidSetAsync()
        {
            // Act
            var droid = await Droid.CreateNewAsync(_nameNotAlreadyExists, _starWarsQuote, _encrypt.Encrypt, _createDroid).ConfigureAwait(false);

            // Assert
            droid.Arms.Should().HaveCount(0);

            droid.Name.Should().Be(_createDroid.Name);
            droid.Nickname.Should().Be(_createDroid.Nickname);
        }
示例#5
0
        public async Task UpdateDroid_WithArmLimitReached_ReturnsDroidTooManyArmsExceptionAsync()
        {
            // Act
            var droid = await Droid.CreateNewAsync(_nameNotAlreadyExists, _starWarsQuote, _encrypt.Encrypt, _createDroid).ConfigureAwait(false);

            droid.AddArm();
            droid.AddArm();

            // Assert
            var exception = Record.Exception(() => droid.AddArm());

            exception.Should().BeOfType <DroidTooManyArmsException>();
        }