Exemplo n.º 1
0
        public async Task DeleteProperty()
        {
            var tenantRepository = new Mock <ITenantRepository>();

            tenantRepository.Setup(x => x.DeletePropertyAsync(It.IsAny <string>(), It.IsAny <string>())).Returns(
                Task.FromResult((TenantRow?)new TenantRow("Id1", "Tenant 1", null))
                );

            var tenantPropertiesService = new TenantPropertiesService(tenantRepository.Object, _mapper);

            var tenant = await tenantPropertiesService.DeletePropertyAsync("Id1", "data");

            Assert.NotNull(tenant);
            Assert.Equal("Id1", tenant !.Id);
        }
Exemplo n.º 2
0
        public async Task UpdateProperties()
        {
            var tenantRepository = new Mock <ITenantRepository>();

            tenantRepository.Setup(x => x.UpdatePropertiesAsync(It.IsAny <string>(), It.IsAny <TenantProperties>())).Returns(
                Task.FromResult((Tenant?)new Tenant("Id1", "Tenant 1", null))
                );

            var tenantPropertiesService = new TenantPropertiesService(tenantRepository.Object);

            var tenant = await tenantPropertiesService.UpdatePropertiesAsync("Id1", new());

            Assert.NotNull(tenant);
            Assert.Equal("Id1", tenant !.Id);
        }