public void Add_ValidAdRequest_ReturnsAdResponse() { var request = _factory.GetAdRequest(); var response = _service.Add(request); Assert.IsNotNull(response); Assert.AreSame(typeof(AdResponse), response.GetType()); }
public void ModelNull_ShouldThrow() { var sut = new AdService(AdRepositoryMock.Object); void Act() => sut.Add(null); Assert.Throws <ArgumentNullException>(Act); }
public void ModelNotNull_ShouldAddToRepository() { // arrange var sut = new AdService(AdRepositoryMock.Object); var model = new AddAdModel { Subject = "subject", Body = "body", EmailAddress = "email", PriceSek = 500 }; // act sut.Add(model); // assert AdRepositoryMock.Verify(m => m.Add(It.IsAny <Ad>())); }