public void Add_ShouldAddtaskToCollection_WhenProvidedTaskIsValid() { var taskStub = new Mock <ITask>(); var idProviderStub = new Mock <IIdProvider>(); var consoleLoggerMock = new Mock <ILogger>(); var sut = new TaskManagerFake(idProviderStub.Object, consoleLoggerMock.Object); sut.Add(taskStub.Object); Assert.That(() => sut.ExposedTasks.Contains(taskStub.Object)); }
public void Add_ShouldAddTaskToCollection_WhenProvidedTaskIsValid() { var taskStub = new Mock <ITask>(); var idProviderStub = new Mock <IIdProvider>(); var consoleLoggerStub = new Mock <ILogger>(); var sut = new TaskManagerFake(idProviderStub.Object, consoleLoggerStub.Object); //FAKED not using private fields // we cannot access protected field of TAskMAnager this is why FAKE have to be created that can be accessed sut.Add(taskStub.Object); Assert.That(() => sut.ExposedTasks.Contains(taskStub.Object)); }
public void Remove_ShouldRemoveTask_WhenProvidedTaskIsValid() { var taskStub = new Mock <ITask>(); var providerStub = new Mock <IIdProvider>(); var loggerStub = new Mock <ILogger>(); var sut = new TaskManagerFake(providerStub.Object, loggerStub.Object); sut.Add(taskStub.Object); sut.Remove(taskStub.Object); Assert.That(() => !sut.ExposedTasks.Contains(taskStub.Object)); }