public void AddNoThresholdSuppression_UpdateData_ReturnJson() { // Arrange InitilizeAddNoThresholdSuppressionTests(); var controller = new GroupController(); ShimEmailGroup.ImportEmailsToNoThresholdUserInt32String = (p1, p2, p3) => new DataTable { Columns = { "Action", "Counts" }, Rows = { { TotalRecordKeyT, "1" }, { TotalRecordKeyT, "2" }, { NewRecordKeyI, "4" }, { ChangedRecordKeyU, "5" }, { DublicateRecordKeyD, "6" }, { SkippedRecordKeyS, "7" } } }; // Act var result = controller.AddNoThresholdSuppression(SampleEmail) as JsonResult; // Assert result.ShouldNotBeNull(); result.Data.ShouldNotBeNull(); dynamic jsonResult = result.Data; Assert.AreEqual(jsonResult.Count, 3); Assert.AreEqual(jsonResult[0], HttpStatusOk); Assert.IsTrue(jsonResult[1].Contains(TotalRecordsMessage + "3")); Assert.IsTrue(jsonResult[1].Contains(NewRecordsMessage + "4")); Assert.IsTrue(jsonResult[1].Contains(ChangedMessage + "5")); Assert.IsTrue(jsonResult[1].Contains(DublicateMessage + "6")); Assert.IsTrue(jsonResult[1].Contains(SkippedMessage + "7")); }
public void AddNoThresholdSuppression_NoEmail_ReturnJson() { // Arrange InitilizeAddNoThresholdSuppressionTests(); var controller = new GroupController(); // Act var result = controller.AddNoThresholdSuppression(String.Empty) as JsonResult; // Assert result.ShouldNotBeNull(); result.Data.ShouldNotBeNull(); dynamic jsonResult = result.Data; Assert.AreEqual(jsonResult.Count, 3); Assert.AreEqual(jsonResult[0], HttpStatusOk); Assert.IsTrue(jsonResult[1].Contains("0" + UpdatedMessage)); }
public void AddNoThresholdSuppression_NoDataUpdate_ReturnJson() { // Arrange InitilizeAddNoThresholdSuppressionTests(); var controller = new GroupController(); ShimEmailGroup.ImportEmailsToNoThresholdUserInt32String = (p1, p2, p3) => new DataTable(); // Act var result = controller.AddNoThresholdSuppression(SampleEmail) as JsonResult; // Assert result.ShouldNotBeNull(); result.Data.ShouldNotBeNull(); dynamic jsonResult = result.Data; Assert.AreEqual(jsonResult.Count, 3); Assert.AreEqual(jsonResult[0], HttpStatusOk); Assert.IsTrue(jsonResult[1].Contains("0" + UpdatedMessage)); }