Exemplo n.º 1
0
        public void MapToModel_WithSaveResultNullInput_ThrowsException()
        {
            // Arrange
            SaveResult model = null;

            // Act
            Action action = () => model.MapToModel();

            // Assert
            action.Should().Throw <ArgumentNullException>();
        }
Exemplo n.º 2
0
        public void MapToModel_WithValidSaveResultLibraryModel_MapsToModel()
        {
            // Arrange
            SaveResult model = _fixture.Create <SaveResult>();

            // Act
            Application.Models.Spreadsheet.SaveResult result = model.MapToModel();

            // Assert
            result.Should().NotBeNull();
            result.IsSuccess.Should().Be(model.IsSuccess);
            result.Exception.Should().Be(model.Exception);
        }
        public async Task <Application.Models.Spreadsheet.SaveResult> CreateTestResultsSpreadsheetAsync(Class @class, Test test, Application.Models.Spreadsheet.Metadata metadata)
        {
            var libraryMetadata = metadata.MapToLibraryModel();
            ISpreadsheetFile   spreadsheetFile   = _spreadsheetFileFactory.Create(_locationProvider.GetSpreadsheetDirectoryPath().Value, libraryMetadata);
            ISpreadsheetWriter spreadsheetWriter = spreadsheetFile.GetSpreadsheetWriter();

            AddTitle(test, metadata, spreadsheetWriter);
            spreadsheetWriter.NewLine();

            var configurationBlock = AddConfiguration(test, spreadsheetWriter);

            PrintScoreSheet(
                @class,
                test,
                spreadsheetWriter,
                configurationBlock);

            SaveResult saveResult = await spreadsheetFile.SaveAsync();

            return(saveResult.MapToModel());
        }