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>(); }
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); }
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); }
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); }
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>(); }