public void CreateBillToID_WhenBillToIDtExists_ItShouldNotBeCreated() { var repository = new BillToIDsRepository(databaseConnection); var sut = new BMPresenter(databaseConnection, userName, viewer); string billToId = "123456"; sut.Create(billToId); string msg = sut.Create(billToId); Assert.That(msg, Is.EqualTo(string.Format("BillToID: {0} is already existed in DB.{1}Can't create duplicate BillToID!", billToId, Environment.NewLine))); databaseConnection.RunSqlCommand("truncate table BillToIDs"); }
public void CreateBillToID_WhenBillToIDDoesNotExist_ItShouldBeCreated() { var sut = new BMPresenter(databaseConnection, userName, viewer); string billToId = "123456"; string msg = sut.Create(billToId); DataTable billToIdDt = sut.Search(); Assert.That(msg, Is.EqualTo(string.Format("BillToID: {0} is created successfully!", billToId))); Assert.That(billToIdDt.Rows, Has.Count.EqualTo(1)); databaseConnection.RunSqlCommand("truncate table BillToIDs"); }