示例#1
0
        public async Task TestMethodAdd_ShouldBeValidWhenSameIdExistsOnAnotherDataList()
        {
            // Arrange
            FakeDataRepository fakeData     = new FakeDataRepository();
            DataCommand        cmd          = new DataCommand("1", "fsjbkjsbdkjdfbjvdfjvbdjkfdfjnvxfvlsfnvjdfnvjdfv", "left");
            DataCommand        cmd2         = new DataCommand("1", "fsjbkjsbdkjdfbjvdfjvbdjkfdfjnvxfvlsfnvjdfnvjdfv", "right");
            DataServices       dataServices = new DataServices(fakeData);

            // Act
            await dataServices.AddData(cmd);

            var result = await dataServices.AddData(cmd2);

            // Assert
            Assert.True(result.IsValid);
        }
示例#2
0
        public async Task TestMethodAdd_ShouldBeInvalidWhenRightIdIAlreadyExist()
        {
            // Arrange
            FakeDataRepository fakeData     = new FakeDataRepository();
            DataCommand        cmd          = new DataCommand("1", "fsjbkjsbdkjdfbjvdfjvbdjkfdfjnvxfvlsfnvjdfnvjdfv", "right");
            DataCommand        cmd2         = new DataCommand("1", "fsjbkjsbdkjdfbjvdfjvbdjkfdfjnvxfvlsfnvjdfnvjdfv", "right");
            DataServices       dataServices = new DataServices(fakeData);

            // Act
            await dataServices.AddData(cmd);

            var result = await dataServices.AddData(cmd2);

            // Assert
            Assert.False(result.IsValid);
        }
示例#3
0
        public async Task TestMethodOffSetDiff_ShouldBeValidWhenReturnsTheDiferencesOnLeftDataAndRightData()
        {
            // Arrange
            FakeDataRepository fakeData     = new FakeDataRepository();
            DataCommand        cmd          = new DataCommand("1", "ajdfvx", "left");
            DataCommand        cmd2         = new DataCommand("1", "bjdfvy", "right");
            DataServices       dataServices = new DataServices(fakeData);

            // Act
            await dataServices.AddData(cmd);

            await dataServices.AddData(cmd2);

            var result = dataServices.OffSetDiff("1", cmd.BodyData, cmd2.BodyData);

            // Assert
            Assert.Equal("Left Data Diff: a\0\0\0\0x and Right Data Diff: b\0\0\0\0y", result);
        }
示例#4
0
        public async Task TestMethodCompare_ShouldBeInvalidWhenLeftDataAndRightDataAreNotEquals()
        {
            // Arrange
            FakeDataRepository fakeData     = new FakeDataRepository();
            DataCommand        cmd          = new DataCommand("1", "afsjbkjsbdkjdfbjvdfjvbdjkfdfjnvxfvlsfnvjdfnvjdfvx", "left");
            DataCommand        cmd2         = new DataCommand("1", "bfsjbkjsbdkjdfbjvdfjvbdjkfdfjnvxfvlsfnvjdfnvjdfvy", "right");
            DataServices       dataServices = new DataServices(fakeData);

            // Act
            await dataServices.AddData(cmd);

            await dataServices.AddData(cmd2);

            var result = await dataServices.Compare("1");

            // Assert
            Assert.False(result.IsValid);
        }
示例#5
0
 protected List <T> CreateMany <T>(int count)
 {
     RegisterDateTimeAssertionForType <T>();
     return(FakeDataRepository.CreateMany <T>(count).ToList());
 }
示例#6
0
 protected T Create <T>()
 {
     RegisterDateTimeAssertionForType <T>();
     return(FakeDataRepository.Create <T>());
 }
示例#7
0
 protected IEnumerable <T> CreateMany <T>(int count)
 {
     return(FakeDataRepository.CreateMany <T>(count));
 }
示例#8
0
 protected T Create <T>()
 {
     return(FakeDataRepository.Create <T>());
 }