public void Submit_WhenAlreadySubmitted_ThrowInvalidOperationException() { // Arrange var dataReturnUpload = new DataReturnUpload( A.Dummy <Scheme>(), A.Dummy <string>(), A.Dummy <List <DataReturnUploadError> >(), A.Dummy <string>(), A.Dummy <int>(), A.Dummy <int>()); dataReturnUpload.SetDataReturnVersion(new DataReturnVersion(A.Dummy <DataReturn>())); dataReturnUpload.Submit("*****@*****.**"); // Act Action action = () => dataReturnUpload.Submit("*****@*****.**"); // Assert Assert.Throws <InvalidOperationException>(action); }
public void Submit_WhenContainsNoErrorsOrWarnings_SubmitsWithNoException() { var dataReturnUpload = new DataReturnUpload( A.Dummy <Scheme>(), A.Dummy <string>(), null, A.Dummy <string>(), A.Dummy <int>(), A.Dummy <int>()); dataReturnUpload.SetDataReturnVersion(new DataReturnVersion(A.Dummy <DataReturn>())); var exception = Record.Exception(() => dataReturnUpload.Submit("*****@*****.**")); Assert.Null(exception); Assert.True(dataReturnUpload.DataReturnVersion.IsSubmitted); }
public void Submit_WhenContainsErrors_ThrowInvalidOperationException() { var error = new DataReturnUploadError(ErrorLevel.Error, A.Dummy <UploadErrorType>(), A.Dummy <string>()); var dataReturnUpload = new DataReturnUpload( A.Dummy <Scheme>(), A.Dummy <string>(), new List <DataReturnUploadError> { error }, A.Dummy <string>(), A.Dummy <int>(), A.Dummy <int>()); dataReturnUpload.SetDataReturnVersion(new DataReturnVersion(A.Dummy <DataReturn>())); Assert.Throws <InvalidOperationException>(() => dataReturnUpload.Submit("*****@*****.**")); }
public void Submit_WhenContainsWarnings_SubmitsWithNoException() { var warning = new DataReturnUploadError(ErrorLevel.Warning, A.Dummy <UploadErrorType>(), A.Dummy <string>()); var dataReturnUpload = new DataReturnUpload( A.Dummy <Scheme>(), A.Dummy <string>(), new List <DataReturnUploadError> { warning }, A.Dummy <string>(), A.Dummy <int>(), A.Dummy <int>()); dataReturnUpload.SetDataReturnVersion(new DataReturnVersion(A.Dummy <DataReturn>())); var exception = Record.Exception(() => dataReturnUpload.Submit("*****@*****.**")); Assert.Null(exception); Assert.True(dataReturnUpload.DataReturnVersion.IsSubmitted); }