private void btnAddBrand_Click(object sender, EventArgs e) { try { Brands brands = new Brands { BrandName = txtBrandName.Text }; brandsController.AddBrands(brands); txtBrandName.Text = string.Empty; MessageBox.Show("Marka eklenmiştir !"); } catch (Exception exception) { MessageBox.Show(exception.Message); } }
public async Task Test_AddBrands_ShouldAddBrandsSuccessfully() { //arrange var brands = new List <BrandForCreateDto> { new BrandForCreateDto { Name = "TestBrand" } }; //act var result = await subject.AddBrands(brands); var codeResult = result as StatusCodeResult; //assert Assert.IsInstanceOf <StatusCodeResult>(codeResult); Assert.AreEqual(codeResult.StatusCode, 201); brandRepositoryMock.Verify(x => x.AddBrands(brands), Times.Once); }