public void UpdatingToAlreadyExistingIdReturnsBrushForExistingId() { // Arrange const string id1 = "Id1"; const string id2 = "Id2"; var brushes = CreateProjectBrushes(); var service = new ProjectBrushService(brushes); var userPreferences = Mock.Of <IUserPreferences>(u => u.AssignProjectColours); var id1Brush = service.GetBrush(id1, userPreferences); var id2Brush = service.GetBrush(id2, userPreferences); // Act service.UpdateBrushId(id2, id1); var brush = service.GetBrush(id1, userPreferences); // Assert Assert.That(brush, Is.EqualTo(id1Brush)); Assert.That(brush, Is.Not.EqualTo(id2Brush)); }
public void UpdatingNonExistentIdDoesNotThrowException() { // Arrange var brushes = CreateProjectBrushes(); var service = new ProjectBrushService(brushes); // Assert Assert.DoesNotThrow(() => service.UpdateBrushId("NonExistentId", "NewId")); }
public void UpdateDoesNotThrowExceptionWhenNewIdIsNull() { // Arrange var brushes = CreateProjectBrushes(); var service = new ProjectBrushService(brushes); // Assert Assert.DoesNotThrow(() => service.UpdateBrushId("OldId", null)); }
public void NewIdReturnsBrushOfOldIdAfterUpdatingBrushId() { // Arrange const string newId = "NewId"; const string oldId = "OldId"; var brushes = CreateProjectBrushes(); var service = new ProjectBrushService(brushes); var userPreferences = Mock.Of <IUserPreferences>(u => u.AssignProjectColours); // Act var oldIdBrush = service.GetBrush(oldId, userPreferences); service.UpdateBrushId(oldId, newId); var newIdBrush = service.GetBrush(newId, userPreferences); // Assert Assert.That(oldIdBrush, Is.EqualTo(newIdBrush)); }