Esempio n. 1
0
        public static void GetDataWithValidIdForDiffReturnException()
        {
            //Arrange
            const int id       = 201;
            var       settings = new Settings {
                Messages = new MessageSettings()
            };
            IOptions <Settings> options = Options.Create(settings);
            var mockDataRepository      = new Mock <IDataRepository>();
            var mockDiffService         = new Mock <IDiffService>();

            var diffApiService = new DiffApiService(options, mockDataRepository.Object, mockDiffService.Object);

            diffApiService.SaveData(id, Util.DataEntitySameSizeA.Data, EnumDataType.Left).ConfigureAwait(false);
            diffApiService.SaveData(id, Util.DataEntitySameSizeA.Data, EnumDataType.Right).ConfigureAwait(false);

            //Act & Assert
            Assert.IsType <Task <DiffResult> >(diffApiService.GetDiff(id));
        }
Esempio n. 2
0
        public static void SaveDataWithInvalidBase64DataReturnException()
        {
            //Arrange
            const int id       = 0;
            var       settings = new Settings {
                Messages = new MessageSettings()
            };
            IOptions <Settings> options = Options.Create(settings);
            var mockDataRepository      = new Mock <IDataRepository>();
            var mockDiffService         = new Mock <IDiffService>();

            var diffApiService = new DiffApiService(options, mockDataRepository.Object, mockDiffService.Object);

            //Act & Assert
            Assert.ThrowsAsync <ArgumentException>(() => diffApiService.SaveData(id, "123", EnumDataType.Left)).ConfigureAwait(false);
        }