public void ExportResources_OnValidCall_ConfirmResult() { // Arrange var exported = false; var expectedResult = string.Format(@"<ResourceExporter Success=""{0}"" Message=""{1}"" File=""{2}"" />", true, DummyString, DummyString); ShimResourceExporter.ConstructorSPWeb = (_, __) => { }; ShimResourceExporter.AllInstances.ExportStringOutStringOut = (ResourceExporter exp, out string file, out string message) => { file = DummyString; message = DummyString; exported = true; return(true); }; // Act var result = ResourceGridClass.ExportResources(_web); // Assert this.ShouldSatisfyAllConditions( () => exported.ShouldBeTrue(), () => result.ShouldBe(expectedResult)); }
public void ExportResources_OnError_ThrowException() { // Arrange ShimResourceExporter.ConstructorSPWeb = (_, __) => { throw new Exception(DummyError); }; // Act Action action = () => ResourceGridClass.ExportResources(_web); // Assert Should.Throw <APIException>(action).Message.ShouldBe(DummyError); }